@arcgis/core 4.29.0 → 4.29.2
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/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/7427d03e693f32a81377.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/8a9387483b19a5ec5b86.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/geohash/geohashUtils.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 +20 -14
- 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/graphics/data/StreamFeatureManager.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/collisions/CollisionEngine.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/FeatureLayerView2D.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/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/schema/processor/SimpleProcessorSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/SubtypeProcessorSchema.js +1 -1
- package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.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/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/RenderNodes.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/Renderer.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 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};
|
package/views/3d/terrain/Tile.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clamp as e}from"../../../core/mathUtils.js";import{abortMaybe as t}from"../../../core/maybe.js";import i from"../../../core/ObjectPool.js";import{f as s,o as n,j as r,h as a,g as o,l,c as h}from"../../../chunks/vec32.js";import{create as u,unitZ as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEpsilon as c}from"../../../core/libs/gl-matrix-2/math/common.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{create as p,equals as f}from"../../../geometry/support/aaBoundingRect.js";import{d as _,g as m}from"../../../chunks/sphere.js";import{isGroupLayer as y}from"../../../layers/support/layerUtils.js";import{VectorTile as A}from"../../2d/engine/vectorTiles/VectorTile.js";import{ImageWithType as M}from"../support/StreamDataLoader.js";import{ElevationBounds as T}from"./ElevationBounds.js";import{ElevationTileAgent as v}from"./ElevationTileAgent.js";import{TextureUpdate as E}from"./interfaces.js";import{TileFrustumVisibility as I,NeighborIndex as D}from"./ITile.js";import{LayerClasses as L,LayerClass as x}from"./LayerClass.js";import{MapTileAgent as S}from"./MapTileAgent.js";import{RasterTile as O}from"./RasterTile.js";import{maxPatchTesselation as N,getElevationDesiredResolutionLevel as b}from"./TerrainConst.js";import{weakAssert as j,getLayerWithExtentRange as U,isBlendableLayerView as C,oppositeCorner as B,internalAssert as P,enableTerrainInternalChecks as R,neighborEdgeIndices as V,oppositeEdge as w,neighborCornerIndices as G,isNorth as W,isSouth as q,isWest as F,isEast as H,enableWaterproofnessTests as k,almostEquals as X,isWestCorner as Y,isNorthCorner as z}from"./terrainUtils.js";import{tileAgentDone as $}from"./TileAgent.js";import{TilePerLayerInfo as J}from"./TilePerLayerInfo.js";import Q from"./TileTexture.js";import{TileUpdate as K}from"./TileUpdate.js";import{fallsWithinLayer as Z}from"./tileUtils.js";const ee=.1;class te{constructor(){this._lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this.renderData=null,this._dirty=!0,this._previouslyRendered=!1,this.extent=p(),this._elevationBoundsMin=NaN,this._elevationBoundsMax=0,this.layerInfo=[[],[]],this.extentInRadians=p(),this.centerAtSeaLevel=u(),this._center=[u(),_(),u()],this.up=d(),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=null,this._mapTileMemoryInternal=0,this._mapDataRefCount=0,this.screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0,this.extentMidX=0,this.extentMidY=0,this.distanceToPOI=-1,this._lastPOI=u(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0}get lij(){return this._lij}static prune(){ne.prune(0),re.prune(0),J.prune()}get _isCached(){return!this.isLeaf&&this._mapDataRefCount<=0}get maxTesselation(){return this._maxTesselation}get isWithinClippingArea(){return this._isWithinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBoundsMin(){return this._elevationBoundsMin}get elevationBoundsMax(){return this._elevationBoundsMax}get level(){return this._lij[0]}get key(){return`${this._lij[0]}/${this._lij[1]}/${this._lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[oe.MIDDLE][3]}get visible(){return this._dirty&&this.computeVisibility(),this._visible}get frustumVisibility(){return this._dirty&&this.computeVisibility(),this._frustumVisibility}computeVisibility(){this._dirty=!1;const e=this.parent,t=e?.frustumVisibility??I.INTERSECTS;this._frustumVisibility=t===I.INSIDE?I.INSIDE:t===I.OUTSIDE?I.OUTSIDE:this._calculateFrustumVisibilityStatus(this.surface.frustum);const i=this._frustumVisibility!==I.OUTSIDE&&this._intersectsClippingArea;i!==this._visible&&(this._visible=i,this._surface.emit("tiles-visibility-changed"),this._surface.renderer.setDirty(),this.updateAgentSuspension())}get loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){const e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit("tiles-visibility-changed"),this._previouslyRendered=e,this._surface.renderer.setDirty()),e}init(e,t,i,s,n){this._lij[0]=e,this._lij[1]=t,this._lij[2]=i,this.ellipsoid=g(n.tilingScheme.spatialReference),n.tilingScheme.getExtent(e,t,i,this.extent),n.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this.extentMidX=.5*(this.extent[0]+this.extent[2]),this.extentMidY=.5*(this.extent[1]+this.extent[3]),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,n.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[oe.MIDDLE][3]=0,this.elevationLevel=e,s&&!Number.isNaN(s.elevationBoundsMin)?(this._elevationBoundsMin=s.elevationBoundsMin,this._elevationBoundsMax=s.elevationBoundsMax):(this._elevationBoundsMin=0,this._elevationBoundsMax=0),this._pendingUpdates=0,this.renderData=null,this.screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=s,this.unsetChildren(),this._surface=n,this.updateVisibility(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0;for(const r of L){const e=n.numLayers(r),t=this.layerInfo[r];for(const i of t)i.release();t.length=e;for(let i=0;i<e;i++)t[i]=J.acquire(this._surface.upsampleInfoPool),r===x.ELEVATION&&this.findElevationBoundsForLayer(i,-1)}this.computeElevationBounds(),this._maxTesselation=Math.min(n.tilingScheme.pixelSize,N)}dispose(){j(!this.renderData,"tile.renderData was not unloaded"),this._surface.upsampleMapCache.pop(this.key);for(const e of L){for(const t of this.layerInfo[e])t.release();this.layerInfo[e].length=0}this._parent=null;for(let e=0;e<4;++e)this._children[e]=null;this._surface=null,this.setMemoryDirty()}refMapData(){++this._mapDataRefCount,this._isCached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){if(--this._mapDataRefCount,this._isCached){this.setMemoryDirty();const e=this._cachedMemory;e>0&&this._surface.upsampleMapCache.put(this.key,this,e)}}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this._ensureUsedMemory()+(this._isCached?0:this._mapTileMemoryInternal)}get _cachedMemory(){return this._isCached?this._mapTileMemory:0}get _mapTileMemory(){return this._ensureUsedMemory(),this.layerInfo[x.MAP].reduce(((e,t)=>e+(t instanceof A?t.usedMemory/t.referenced:0)),this._mapTileMemoryInternal)}get _cpuImageMemorySize(){const e=4,t=this._surface.tilingScheme.pixelSize;return t*t*e}_ensureUsedMemory(){if(null!=this._usedMemory)return this._usedMemory;this._usedMemory=this._baseUsedMemory,this._mapTileMemoryInternal=0;let e=0;for(const{data:i}of this.layerInfo[x.MAP])i instanceof A?e+=this._getTerrainDataMemory(i):this._mapTileMemoryInternal+=this._getTerrainDataMemory(i);const t=this._cpuImageMemorySize;for(const i of this.layerInfo[x.ELEVATION])this._usedMemory+=i.data?t:0;return this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._mapTileMemoryInternal+=this.renderData.texture?.usedMemory??0),this._isCached&&this._surface.upsampleMapCache.updateSize(this.key,this,this._mapTileMemoryInternal+e),this._usedMemory}getUsedMemoryForLayer(e,t){const i=this.layerInfo[e][t];return i?.data?e===x.MAP?this._isCached?0:this._getTerrainDataMemory(i.data):e===x.ELEVATION?this._cpuImageMemorySize:0:0}_getTerrainDataMemory(e){return e instanceof Q?e.texture.usedMemory:e instanceof HTMLImageElement||e instanceof M?this._cpuImageMemorySize:e instanceof O?e.memoryUsage:e instanceof A?e.usedMemory/e.referenced:0}updateScreenDepth(e){const t=this._center[oe.MIDDLE],i=e,s=t[0],n=t[1],r=t[2],a=i[2]*s+i[6]*n+i[10]*r+i[14];this.screenDepth=a<0?0:a/(i[3]*s+i[7]*n+i[11]*r+i[15])}shouldSplit(e,t,i){if(!this.visible)return K.NONE;if(e.frustum&&(!this._intersectsClippingArea||this._calculateFrustumVisibilityStatus(e.frustum)===I.OUTSIDE))return K.NONE;const h=this.level;s(pe,m(this._center[oe.MIDDLE]),t);let u=n(pe),d=pe,c=m(this._center[oe.MIDDLE]);s(fe,this._center[oe.TOP],t);const g=n(fe);g<u&&(u=g,d=fe,c=this._center[oe.TOP]),s(_e,this._center[oe.BOTTOM],t);const p=n(_e);if(p<u&&(u=p,d=_e,c=this._center[oe.BOTTOM]),this._edgeLen2>u&&h<e.maxLod)return K.SPLIT;const f=Math.sqrt(u),_=e.fovX*f*2,y=this._edgeLen/_,A=()=>{if(h<e.maxLod)return this.elevationLevel=h,K.NONE;const t=h+Math.ceil(-Math.log2(e.relativeWidthLimit/y));return t!==this.elevationLevel?(this.elevationLevel=t,K.ELEVATION):K.NONE},M=null!=i?i-h:1/0;if(M<=.5)return A();const T=r(this.up,pe),v=this._elevationBoundsMax-this._elevationBoundsMin,E=v/this.edgeLen;if(e.aboveGround&&T>0&&E<.001){if(T/f-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-E>0)return K.NONE}const D=null!=i?3-Math.min(M,2):1;if(y*D<e.relativeWidthLimit||h>=e.maxLod)return A();if(h<7)return K.SPLIT;a(me,this.up,T),s(me,me,d);const L=n(me);if(L<=this.radius*this.radius)return K.SPLIT;a(me,me,this.radius/Math.sqrt(L)),o(me,me,c),s(me,t,me);const x=Math.min(1,(Math.abs(r(me,this.up))+.5*v+this._curvatureHeight)/l(me)),S=ee/e.angledSplitBias,O=e.fovY*f*2;return x*(this._edgeLen/O*D)<S*e.relativeHeightLimit?K.NONE:K.SPLIT}setChildren(e,t,i,s){j(!!(e&&t&&i&&s),"Null child passed");const n=this._children;return n[0]=e,n[1]=t,n[2]=i,n[3]=s,n}unsetChildren(){this._children[0]=null,this._children[1]=null,this._children[2]=null,this._children[3]=null}get isLoaded(){return this.renderData?.hasGeometry??!1}load(){this.refMapData();for(const e of L)this._createOrUpdateAgents(0,e);this.surface.renderer.loadTile(this)}unload(e){e.unloadTile(this);for(const t of L){const e=this.layerInfo[t];for(const t of e)t.loadingAgent&&t.loadingAgent!==$&&(se(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0}this.resetPendingUpdate(K.GEOMETRY),this.resetPendingUpdate(K.TEXTURE_NOFADING),this.resetPendingUpdate(K.TEXTURE_FADING),this.unrefMapData()}unloadMapData(){const e=this.layerInfo[x.MAP];for(const t of e)t.loadingAgent&&t.loadingAgent!==$&&(se(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0;this.renderData&&this.renderData.releaseTexture(),this.setMemoryDirty()}updateClippingStatus(e){if(f(e,this._clippingArea))return!1;const t=this._intersectsClippingArea,i=this._isWithinClippingArea;null!=e?(this._intersectsClippingArea=this.intersectsExtent(e),this._isWithinClippingArea=this._isWithinExtent(e)):(this._intersectsClippingArea=!0,this._isWithinClippingArea=!0),this._clippingArea=e,this.updateVisibility();const s=i&&this._isWithinClippingArea,n=!(i||t||this._isWithinClippingArea||this._intersectsClippingArea);return!this.renderData||s||n||this.setPendingUpdate(K.GEOMETRY),!0}updateVisibility(){this._dirty=!0,this._surface.setTileTreeDirty()}getLayerInfo(e,t){return this.layerInfo[t][e]}hasLayerData(e,t){const i=this.layerInfo[t][e];return!(!i?.data||i.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(const e of L){const t=this.layerInfo[e];for(const e of t)if(e.loadingAgent&&e.loadingAgent!==$&&e.loadingAgent.updating)return!0}return!1}_isSuspended(e){return!!this.hasPendingUpdate(K.SPLIT)||e!==x.ELEVATION&&!this.loadable}get hasPendingUpdates(){return 0!==this._pendingUpdates}hasPendingUpdate(e){return(this._pendingUpdates&e)===e}setPendingUpdate(e){const t=this._pendingUpdates;return this._pendingUpdates|=e,e===K.SPLIT||e===K.MERGE?this._surface.setTileTreeDirty():this._surface.requestUpdate(),t!==this._pendingUpdates}resetPendingUpdate(e){return!!this.hasPendingUpdate(e)&&(this._pendingUpdates&=~e,!0)}requestLayerData(e,i,s){const n=this.layerInfo[i][e];if(n.waitingAgents.has(s))return console.warn("agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)",this._lij.toString(),s.tile.lij.toString(),i,e),!0;if(n.waitingAgents.push(s),n.data&&!n.dataInvalidated){console.warn("agent requested existing data (tile %s, agent tile %s, layer: %d/%d)",this._lij.toString(),s.tile.lij.toString(),i,e);const t=n.data&&"type"in n.data&&"vector-tile"===n.data.type;return s.dataArrived(this,t),!0}if(n.requestPromise)return!0;t(n.requestAbort),n.requestAbort=new AbortController;const r=this._surface.requestTileData(this,e,i,n.requestAbort);if(!r)return n.requestAbort=null,!1;const a=()=>{n.requestPromise===r&&(n.requestPromise=null,n.requestAbort=null)};return n.requestPromise=r,r.then(a,a),!0}get isLeaf(){return null==this._children[0]}hasLij(e){return this._lij[0]===e[0]&&this._lij[1]===e[1]&&this._lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;const t=this._children;if(!t[0])return null;return t[0].findByLij(e)||t[1].findByLij(e)||t[2].findByLij(e)||t[3].findByLij(e)}distanceToSquared(e){return n(s(me,m(this._center[oe.MIDDLE]),e))}containsPoint(e){const t=this.extent;return e[0]>=t[0]&&e[1]>=t[1]&&e[0]<=t[2]&&e[1]<=t[3]}containsPointXY(e,t){const i=this.extent;return e>=i[0]&&t>=i[1]&&e<=i[2]&&t<=i[3]}unrequestLayerData(e,t,i){const s=this.layerInfo[t][e],n=s.waitingAgents,r=null!=n.removeUnordered(i);j(r,"agent has not requested this piece of map data"),n.length<1&&(s.abortRequest(),this.setMemoryDirty())}dataArrived(e,t,i){const s=null!=i&&"type"in i&&"vector-tile"===i.type,n=this.layerInfo[t][e];n.data=i,n.dataInvalidated=!1,n.waitingAgents.forAll((e=>e.dataArrived(this,s))),n.waitingAgents.clear(),this.setMemoryDirty()}dataMissing(e,t,i){i.notInTilemap||console.error(`Tile ${this._lij.toString()} layer ${t}/${e} error ${i}`);const s=this.layerInfo[t][e];s.dataMissing=!0,s.waitingAgents.forAll((e=>e.dataMissing())),s.waitingAgents.clear(),this.setMemoryDirty()}updateRenderData(e,t,i){switch(i&&this.forEachLoadedNeighbor((i=>i.updateRenderData(e,t))),e){case x.MAP:return this._updateTexture(t);case x.ELEVATION:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(e===E.FADING?K.TEXTURE_NOFADING:K.TEXTURE_FADING),this.setPendingUpdate(e===E.FADING?K.TEXTURE_FADING:K.TEXTURE_NOFADING))}_updateGeometry(){this.setPendingUpdate(K.GEOMETRY);for(const e of this.layerInfo[x.ELEVATION])e.pendingUpdates|=K.GEOMETRY}invalidateLayerData(e,t){this.layerInfo[t][e].invalidateSourceData(),this.restartAgents(t)}computeElevationBounds(){const e=this._elevationBoundsMin,t=this._elevationBoundsMax;let i=1/0,s=-1/0;const n=this.layerInfo[x.ELEVATION];let r=!0;for(const a of n)null!=a.elevationBounds&&(i=Math.min(i,a.elevationBounds.min),s=Math.max(s,a.elevationBounds.max),a.elevationBounds.hasNoDataValues||(r=!1));r&&(i=Math.min(i,0),s=Math.max(s,0)),e===i&&t===s||(this._elevationBoundsMin=i,this._elevationBoundsMax=s,this.updateRadiusAndCenter(),this._surface.setTileTreeDirty())}_updateCenter(){const e=this._elevationBoundsMin,t=this._elevationBoundsMax,i=.5*(e+t),s=this._center;a(me,this.up,i),o(m(s[oe.MIDDLE]),this.centerAtSeaLevel,me),a(me,this.up,e),o(s[oe.TOP],this.centerAtSeaLevel,me),a(me,this.up,t),o(s[oe.BOTTOM],this.centerAtSeaLevel,me)}findElevationBoundsForLayer(e,t){const i=this.layerInfo[x.ELEVATION][e],s=b(this.level),n=Math.max(this.elevationLevel-s,0),r=i.elevationBounds;if(null!=r&&r.level>=t&&r.level<=n)return;const a=this._surface.layerViewByIndex(e,x.ELEVATION),o=U(a);if(!Z(this,o,!1))return;const l=ae;let h=!1;const u=i.data;if(u&&u.level<=n){const e=i.data;l.min=e.samplerData.data.minValue,l.max=e.samplerData.data.maxValue,l.hasNoDataValues=e.samplerData.data.hasNoDataValues,l.level=this.level,h=!0}else{let t,i,r=0;for(let a=this._parent;a&&(!i||r<s)&&(r=this.elevationLevel-a.level,t=i||t,i=a.layerInfo[x.ELEVATION][e].data,!(!i&&t&&a.level<=n));a=a.parent);i=i||t,i&&(i.computeMinMaxValue(this._lij[0],this._lij[1],this._lij[2],l),l.min!==1/0&&(l.level=i.level,h=!0))}h&&(null==i.elevationBounds&&(i.elevationBounds=new T),i.elevationBounds.copyFrom(l))}modifyLayers(e,t,i){const s=this.layerInfo[i];for(const a of s)a.loadingAgent&&a.loadingAgent!==$&&(se(a.loadingAgent),a.loadingAgent=null),a.waitingAgents.clear();for(let a=0;a<s.length;++a)void 0===e[a]&&s[a].release();const n=new Array(...s),r=t.length;s.length=r;for(let a=0;a<r;a++){const e=t[a];s[a]=e>-1?n[e]:J.acquire(this._surface.upsampleInfoPool)}this.setMemoryDirty()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,E.FADING))}updateAgents(e){if(this.renderData){const t=this.layerInfo[e];for(const e of t)e.loadingAgent===$&&(e.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(const e of L){const t=this._isSuspended(e);for(const i of this.layerInfo[e])i.loadingAgent&&i.loadingAgent!==$&&(i.loadingAgent.setSuspension(t),i.loadingAgent===$&&this.updateRenderData(e,E.FADING))}}removeLayerAgent(e,t){const i=this.layerInfo[t][e];i.loadingAgent&&i.loadingAgent!==$&&i.loadingAgent.dispose(),i.loadingAgent=null}agentDone(e,t){const i=this.layerInfo[t][e];i.loadingAgent=$,i.data||null!=i.upsampleInfo||this._createOrUpdateAgents(e+1,t)}_hasBlendableAncestor(e){return"normal"!==e.blendMode||y(e.parent)&&this._hasBlendableAncestor(e.parent)}_hasBlendModes(e,t,i){for(let s=e;s<t;++s){const e=this._surface.layerViewByIndex(s,i);if(C(e)&&"normal"!==e?.layer?.blendMode||y(e?.layer?.parent)&&this._hasBlendableAncestor(e?.layer?.parent))return!0}return!1}_createOrUpdateAgents(e,t){const i=this.layerInfo[t];if(0===i.length)return;const s=this._isSuspended(t);for(let n=e;n<i.length;++n){const r=i[n];let a=!1;const o=this._surface.layerViewByIndex(n,t),l=U(o);if(r.loadingAgent?Z(this,l,!1)?(r.loadingAgent!==$&&r.loadingAgent.setSuspension(s),r.loadingAgent!==$&&(a=r.loadingAgent.update())):r.dispose():Z(this,l,!1)&&(r.loadingAgent=ie(this,n,t,s),a=r.loadingAgent.startLoading(),a?r.loadingAgent===$&&this.setPendingUpdate(K.GEOMETRY):(se(r.loadingAgent),r.loadingAgent=$)),r.loadingAgent===$&&this.updateRenderData(t,E.FADING),!this._hasBlendModes(e,i.length,t)&&a&&o.isOpaque)return}}_isWithinExtent(e){const t=this.extent;return t[0]>=e[0]&&e[2]>=t[2]&&t[1]>=e[1]&&e[3]>=t[3]}intersectsExtent(e){const t=this.extent;return t[2]>=e[0]&&e[2]>=t[0]&&t[3]>=e[1]&&e[3]>=t[1]}getElevationVerticesPerSide(t){const i=this.elevationLevel-this.level,s=Math.max(this.level-t,b(this.level)-i),n=e(1+(this.maxTesselation>>s),2,this.maxTesselation+1),r=this.getDefaultVerticesPerSide();return Math.max(n,r)}get test(){return{cachedMemory:this._cachedMemory}}_findLIJ(e,t){if(!e)return null;const i=this.surface.rootTiles;if(null!=i)for(const s of i)if(le(s,e)){let i=s,n=e[0]-i.level-1;for(;n>=0&&!i.isLeaf&&!t(i);){const t=e[1]>>n&1,s=e[2]>>n&1;i=i.children[2*t+s],n--}return t(i)?i:null}return null}findNeighborTile(e,t){const i=this._lij,s=this.getNeighborLIJ(i,e);return s?he(i,s)?t(this)?this:null:this._findLIJ(s,t):null}findCorner(e,t){const i=e===D.NORTH_EAST?1:e===D.NORTH_WEST?0:e===D.SOUTH_WEST?2:3;let s=this;for(;s.children[0]&&(!t||!t(s));)s=s.children[i];return s}findNeighborCornerTileExact(e,t){return this.findNeighborTile(e,(e=>t(e)||e.level===this.level))?.findCorner(B(e),t)||null}forAllSubtreeOnSide(e,t){const i=e===D.NORTH?[0,1]:e===D.NORTH_EAST?[1]:e===D.EAST?[1,3]:e===D.SOUTH_EAST?[3]:e===D.SOUTH?[2,3]:e===D.SOUTH_WEST?[2]:e===D.WEST?[0,2]:[0],s=e=>{const n=e.children;!t(e)&&n[0]&&i.forEach((e=>s(n[e])))};s(this)}getNeighborEdgeStartVertexIndex(e,t){if(!t)return 0;const i=this.level-t.level;if(P(!R||i>=0),0===i)return 0;const s=2**i,n=1==(1&e),r=n?0:1,a=t.lij[r+1]*s,o=this._lij[r+1],l=o-a,h=n?s-1-l:l;return R&&(P(a<=o&&o<a+s),P(0<=h&&h<s)),h}forEachLoadedNeighbor(e){const t=this.level,i=e=>e.level===t||e.isLoaded;V.forEach((t=>{const s=this.findNeighborTile(t,i);null!=s&&s!==this&&s.forAllSubtreeOnSide(w(t),(i=>!!i.isLoaded&&(e(i,t),!0)))})),G.forEach((t=>{const s=this.findNeighborTile(t,i)?.findCorner(B(t),(e=>e.isLoaded));P(!s||de(this,s,t)),s?.isLoaded&&e(s,t)}))}getNeighborLIJ(e,t){const i=W(t)?-1:q(t)?1:0,s=F(t)?-1:H(t)?1:0,n=[e[0],e[1]+i,e[2]+s];return n[1]<0?null:this.surface.isGlobal?this.wrapLIJ(n):n[2]<0?null:n}wrapLIJ(e){return!e||e[1]<0||e[1]>=2**e[0]?null:this.surface.wrapEastWest(e)}get westNeighborWestExtent(){return this.extent[0]*(this.isWestEnd?-1:1)}get eastNeighborEastExtent(){return this.extent[2]*(this.isEastEnd?-1:1)}get isEastEnd(){return this._lij[2]===this.surface.lijEastEnd(this.level)-1}get isWestEnd(){return 0===this._lij[2]}get isNorthEnd(){return 0===this._lij[1]}get isSouthEnd(){const e=this.surface.extent,t=e?.[1]??null;return null!=t&&this.extent[1]+c()>=t}checkGeometryWaterproofness(){k&&(P(this.isLoaded),this.renderData?.checkGeometryWaterproofness())}shouldHaveNeighbor(e){const t=this.extent,i=this.surface.rootTilesExtent,s=.25*(t[2]-t[0]);if(W(e)&&t[3]+s>=i[3])return!1;if(q(e)&&t[1]-s<=i[1])return!1;const n=this.surface.isGlobal;return!(!n&&F(e)&&t[0]-s<=i[0])&&!(!n&&H(e)&&t[2]+s>=i[2])}updateDistanceToPOI(e){const t=this._lastPOI;if(this.distanceToPOI>=0&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return;h(this._lastPOI,e);const i=this._center[oe.MIDDLE],s=e[0]-i[0],n=e[1]-i[1],r=e[2]-i[2];this.distanceToPOI=s*s+n*n+r*r}}function ie(e,t,i,s){const n=i===x.ELEVATION?re.acquire():ne.acquire();return n.init(e,t,i,s),n}function se(e){e.dispose(),e instanceof v?re.release(e):e instanceof S&&ne.release(e)}const ne=new i(S),re=new i(v),ae=new T;var oe;function le(e,t){const i=e.lij,s=t[0]-i[0];return!(s<0)&&(t[1]>>s===i[1]&&t[2]>>s===i[2])}function he(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function ue(e,t,i){if(null==e||null==t)return!1;if(0===e.level&&0===t.level){if(e.isEastEnd&&t.isWestEnd&&i===D.EAST)return!0;if(e.isWestEnd&&t.isEastEnd&&i===D.WEST)return!0}const s=Math.max(1e-6*(e.extent[2]-e.extent[0]),1);switch(i){case D.NORTH:return X(e.extent[3],t.extent[1],s);case D.SOUTH:return X(e.extent[1],t.extent[3],s);case D.EAST:return X(e.extent[2],t.extent[0],s)||X(e.extent[2],-t.extent[0],s);case D.WEST:return X(e.extent[0],t.extent[2],s)||X(e.extent[0],-t.extent[2],s)}}function de(e,t,i){return null!=e&&null!=t&&t!==e&&(e.level>=t.level?ce(e,t,i):ce(t,e,B(i)))}function ce(e,t,i){P(e.level>=t.level);const s=Y(i),n=z(i),r=e.extent,a=t.extent,o=[s?r[0]:r[2],n?r[3]:r[1]],l=[s?a[2]:a[0],n?a[1]:a[3]],h=1e-5*(r[2]-r[0]),u=X(o[0],l[0],h)||e.surface.isGlobal&&X(o[0],-l[0],h),d=X(o[1],l[1],h);if(u&&d)return!0;if(e.level===t.level)return P(!1),!1;if(!u&&!d)return P(!1),!1;const c=u?ge(a[1],a[3],r[1],r[3],h):ge(a[0],a[2],r[0],r[2],h);return P(c),c}function ge(e,t,i,s,n){return e-n<=i&&i<=s&&s<=t+n}!function(e){e[e.TOP=0]="TOP",e[e.MIDDLE=1]="MIDDLE",e[e.BOTTOM=2]="BOTTOM"}(oe||(oe={}));const pe=u(),fe=u(),_e=u(),me=u();export{oe as CenterPosition,te as Tile,de as isCornerNeighbor,ue as isEdgeNeighbor,he as lijEquals};
|
|
5
|
+
import{clamp as e}from"../../../core/mathUtils.js";import{abortMaybe as t}from"../../../core/maybe.js";import i from"../../../core/ObjectPool.js";import{f as s,p as n,k as r,h as a,g as o,l,c as h}from"../../../chunks/vec32.js";import{create as u,unitZ as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEpsilon as c}from"../../../core/libs/gl-matrix-2/math/common.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{create as p,equals as f}from"../../../geometry/support/aaBoundingRect.js";import{d as _,g as m}from"../../../chunks/sphere.js";import{isGroupLayer as y}from"../../../layers/support/layerUtils.js";import{VectorTile as A}from"../../2d/engine/vectorTiles/VectorTile.js";import{ImageWithType as M}from"../support/StreamDataLoader.js";import{ElevationBounds as T}from"./ElevationBounds.js";import{ElevationTileAgent as v}from"./ElevationTileAgent.js";import{TextureUpdate as E}from"./interfaces.js";import{TileFrustumVisibility as I,NeighborIndex as D}from"./ITile.js";import{LayerClasses as L,LayerClass as x}from"./LayerClass.js";import{MapTileAgent as S}from"./MapTileAgent.js";import{RasterTile as O}from"./RasterTile.js";import{maxPatchTesselation as N,getElevationDesiredResolutionLevel as b}from"./TerrainConst.js";import{weakAssert as j,getLayerWithExtentRange as U,isBlendableLayerView as C,oppositeCorner as B,internalAssert as P,enableTerrainInternalChecks as R,neighborEdgeIndices as V,oppositeEdge as w,neighborCornerIndices as G,isNorth as W,isSouth as q,isWest as F,isEast as H,enableWaterproofnessTests as k,almostEquals as X,isWestCorner as Y,isNorthCorner as z}from"./terrainUtils.js";import{tileAgentDone as $}from"./TileAgent.js";import{TilePerLayerInfo as J}from"./TilePerLayerInfo.js";import Q from"./TileTexture.js";import{TileUpdate as K}from"./TileUpdate.js";import{fallsWithinLayer as Z}from"./tileUtils.js";const ee=.1;class te{constructor(){this._lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this.renderData=null,this._dirty=!0,this._previouslyRendered=!1,this.extent=p(),this._elevationBoundsMin=NaN,this._elevationBoundsMax=0,this.layerInfo=[[],[]],this.extentInRadians=p(),this.centerAtSeaLevel=u(),this._center=[u(),_(),u()],this.up=d(),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=null,this._mapTileMemoryInternal=0,this._mapDataRefCount=0,this.screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0,this.extentMidX=0,this.extentMidY=0,this.distanceToPOI=-1,this._lastPOI=u(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0}get lij(){return this._lij}static prune(){ne.prune(0),re.prune(0),J.prune()}get _isCached(){return!this.isLeaf&&this._mapDataRefCount<=0}get maxTesselation(){return this._maxTesselation}get isWithinClippingArea(){return this._isWithinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBoundsMin(){return this._elevationBoundsMin}get elevationBoundsMax(){return this._elevationBoundsMax}get level(){return this._lij[0]}get key(){return`${this._lij[0]}/${this._lij[1]}/${this._lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[oe.MIDDLE][3]}get visible(){return this._dirty&&this.computeVisibility(),this._visible}get frustumVisibility(){return this._dirty&&this.computeVisibility(),this._frustumVisibility}computeVisibility(){this._dirty=!1;const e=this.parent,t=e?.frustumVisibility??I.INTERSECTS;this._frustumVisibility=t===I.INSIDE?I.INSIDE:t===I.OUTSIDE?I.OUTSIDE:this._calculateFrustumVisibilityStatus(this.surface.frustum);const i=this._frustumVisibility!==I.OUTSIDE&&this._intersectsClippingArea;i!==this._visible&&(this._visible=i,this._surface.emit("tiles-visibility-changed"),this._surface.renderer.setDirty(),this.updateAgentSuspension())}get loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){const e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit("tiles-visibility-changed"),this._previouslyRendered=e,this._surface.renderer.setDirty()),e}init(e,t,i,s,n){this._lij[0]=e,this._lij[1]=t,this._lij[2]=i,this.ellipsoid=g(n.tilingScheme.spatialReference),n.tilingScheme.getExtent(e,t,i,this.extent),n.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this.extentMidX=.5*(this.extent[0]+this.extent[2]),this.extentMidY=.5*(this.extent[1]+this.extent[3]),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,n.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[oe.MIDDLE][3]=0,this.elevationLevel=e,s&&!Number.isNaN(s.elevationBoundsMin)?(this._elevationBoundsMin=s.elevationBoundsMin,this._elevationBoundsMax=s.elevationBoundsMax):(this._elevationBoundsMin=0,this._elevationBoundsMax=0),this._pendingUpdates=0,this.renderData=null,this.screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=s,this.unsetChildren(),this._surface=n,this.updateVisibility(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0;for(const r of L){const e=n.numLayers(r),t=this.layerInfo[r];for(const i of t)i.release();t.length=e;for(let i=0;i<e;i++)t[i]=J.acquire(this._surface.upsampleInfoPool),r===x.ELEVATION&&this.findElevationBoundsForLayer(i,-1)}this.computeElevationBounds(),this._maxTesselation=Math.min(n.tilingScheme.pixelSize,N)}dispose(){j(!this.renderData,"tile.renderData was not unloaded"),this._surface.upsampleMapCache.pop(this.key);for(const e of L){for(const t of this.layerInfo[e])t.release();this.layerInfo[e].length=0}this._parent=null;for(let e=0;e<4;++e)this._children[e]=null;this._surface=null,this.setMemoryDirty()}refMapData(){++this._mapDataRefCount,this._isCached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){if(--this._mapDataRefCount,this._isCached){this.setMemoryDirty();const e=this._cachedMemory;e>0&&this._surface.upsampleMapCache.put(this.key,this,e)}}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this._ensureUsedMemory()+(this._isCached?0:this._mapTileMemoryInternal)}get _cachedMemory(){return this._isCached?this._mapTileMemory:0}get _mapTileMemory(){return this._ensureUsedMemory(),this.layerInfo[x.MAP].reduce(((e,t)=>e+(t instanceof A?t.usedMemory/t.referenced:0)),this._mapTileMemoryInternal)}get _cpuImageMemorySize(){const e=4,t=this._surface.tilingScheme.pixelSize;return t*t*e}_ensureUsedMemory(){if(null!=this._usedMemory)return this._usedMemory;this._usedMemory=this._baseUsedMemory,this._mapTileMemoryInternal=0;let e=0;for(const{data:i}of this.layerInfo[x.MAP])i instanceof A?e+=this._getTerrainDataMemory(i):this._mapTileMemoryInternal+=this._getTerrainDataMemory(i);const t=this._cpuImageMemorySize;for(const i of this.layerInfo[x.ELEVATION])this._usedMemory+=i.data?t:0;return this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._mapTileMemoryInternal+=this.renderData.texture?.usedMemory??0),this._isCached&&this._surface.upsampleMapCache.updateSize(this.key,this,this._mapTileMemoryInternal+e),this._usedMemory}getUsedMemoryForLayer(e,t){const i=this.layerInfo[e][t];return i?.data?e===x.MAP?this._isCached?0:this._getTerrainDataMemory(i.data):e===x.ELEVATION?this._cpuImageMemorySize:0:0}_getTerrainDataMemory(e){return e instanceof Q?e.texture.usedMemory:e instanceof HTMLImageElement||e instanceof M?this._cpuImageMemorySize:e instanceof O?e.memoryUsage:e instanceof A?e.usedMemory/e.referenced:0}updateScreenDepth(e){const t=this._center[oe.MIDDLE],i=e,s=t[0],n=t[1],r=t[2],a=i[2]*s+i[6]*n+i[10]*r+i[14];this.screenDepth=a<0?0:a/(i[3]*s+i[7]*n+i[11]*r+i[15])}shouldSplit(e,t,i){if(!this.visible)return K.NONE;if(e.frustum&&(!this._intersectsClippingArea||this._calculateFrustumVisibilityStatus(e.frustum)===I.OUTSIDE))return K.NONE;const h=this.level;s(pe,m(this._center[oe.MIDDLE]),t);let u=n(pe),d=pe,c=m(this._center[oe.MIDDLE]);s(fe,this._center[oe.TOP],t);const g=n(fe);g<u&&(u=g,d=fe,c=this._center[oe.TOP]),s(_e,this._center[oe.BOTTOM],t);const p=n(_e);if(p<u&&(u=p,d=_e,c=this._center[oe.BOTTOM]),this._edgeLen2>u&&h<e.maxLod)return K.SPLIT;const f=Math.sqrt(u),_=e.fovX*f*2,y=this._edgeLen/_,A=()=>{if(h<e.maxLod)return this.elevationLevel=h,K.NONE;const t=h+Math.ceil(-Math.log2(e.relativeWidthLimit/y));return t!==this.elevationLevel?(this.elevationLevel=t,K.ELEVATION):K.NONE},M=null!=i?i-h:1/0;if(M<=.5)return A();const T=r(this.up,pe),v=this._elevationBoundsMax-this._elevationBoundsMin,E=v/this.edgeLen;if(e.aboveGround&&T>0&&E<.001){if(T/f-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-E>0)return K.NONE}const D=null!=i?3-Math.min(M,2):1;if(y*D<e.relativeWidthLimit||h>=e.maxLod)return A();if(h<7)return K.SPLIT;a(me,this.up,T),s(me,me,d);const L=n(me);if(L<=this.radius*this.radius)return K.SPLIT;a(me,me,this.radius/Math.sqrt(L)),o(me,me,c),s(me,t,me);const x=Math.min(1,(Math.abs(r(me,this.up))+.5*v+this._curvatureHeight)/l(me)),S=ee/e.angledSplitBias,O=e.fovY*f*2;return x*(this._edgeLen/O*D)<S*e.relativeHeightLimit?K.NONE:K.SPLIT}setChildren(e,t,i,s){j(!!(e&&t&&i&&s),"Null child passed");const n=this._children;return n[0]=e,n[1]=t,n[2]=i,n[3]=s,n}unsetChildren(){this._children[0]=null,this._children[1]=null,this._children[2]=null,this._children[3]=null}get isLoaded(){return this.renderData?.hasGeometry??!1}load(){this.refMapData();for(const e of L)this._createOrUpdateAgents(0,e);this.surface.renderer.loadTile(this)}unload(e){e.unloadTile(this);for(const t of L){const e=this.layerInfo[t];for(const t of e)t.loadingAgent&&t.loadingAgent!==$&&(se(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0}this.resetPendingUpdate(K.GEOMETRY),this.resetPendingUpdate(K.TEXTURE_NOFADING),this.resetPendingUpdate(K.TEXTURE_FADING),this.unrefMapData()}unloadMapData(){const e=this.layerInfo[x.MAP];for(const t of e)t.loadingAgent&&t.loadingAgent!==$&&(se(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0;this.renderData&&this.renderData.releaseTexture(),this.setMemoryDirty()}updateClippingStatus(e){if(f(e,this._clippingArea))return!1;const t=this._intersectsClippingArea,i=this._isWithinClippingArea;null!=e?(this._intersectsClippingArea=this.intersectsExtent(e),this._isWithinClippingArea=this._isWithinExtent(e)):(this._intersectsClippingArea=!0,this._isWithinClippingArea=!0),this._clippingArea=e,this.updateVisibility();const s=i&&this._isWithinClippingArea,n=!(i||t||this._isWithinClippingArea||this._intersectsClippingArea);return!this.renderData||s||n||this.setPendingUpdate(K.GEOMETRY),!0}updateVisibility(){this._dirty=!0,this._surface.setTileTreeDirty()}getLayerInfo(e,t){return this.layerInfo[t][e]}hasLayerData(e,t){const i=this.layerInfo[t][e];return!(!i?.data||i.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(const e of L){const t=this.layerInfo[e];for(const e of t)if(e.loadingAgent&&e.loadingAgent!==$&&e.loadingAgent.updating)return!0}return!1}_isSuspended(e){return!!this.hasPendingUpdate(K.SPLIT)||e!==x.ELEVATION&&!this.loadable}get hasPendingUpdates(){return 0!==this._pendingUpdates}hasPendingUpdate(e){return(this._pendingUpdates&e)===e}setPendingUpdate(e){const t=this._pendingUpdates;return this._pendingUpdates|=e,e===K.SPLIT||e===K.MERGE?this._surface.setTileTreeDirty():this._surface.requestUpdate(),t!==this._pendingUpdates}resetPendingUpdate(e){return!!this.hasPendingUpdate(e)&&(this._pendingUpdates&=~e,!0)}requestLayerData(e,i,s){const n=this.layerInfo[i][e];if(n.waitingAgents.has(s))return console.warn("agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)",this._lij.toString(),s.tile.lij.toString(),i,e),!0;if(n.waitingAgents.push(s),n.data&&!n.dataInvalidated){console.warn("agent requested existing data (tile %s, agent tile %s, layer: %d/%d)",this._lij.toString(),s.tile.lij.toString(),i,e);const t=n.data&&"type"in n.data&&"vector-tile"===n.data.type;return s.dataArrived(this,t),!0}if(n.requestPromise)return!0;t(n.requestAbort),n.requestAbort=new AbortController;const r=this._surface.requestTileData(this,e,i,n.requestAbort);if(!r)return n.requestAbort=null,!1;const a=()=>{n.requestPromise===r&&(n.requestPromise=null,n.requestAbort=null)};return n.requestPromise=r,r.then(a,a),!0}get isLeaf(){return null==this._children[0]}hasLij(e){return this._lij[0]===e[0]&&this._lij[1]===e[1]&&this._lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;const t=this._children;if(!t[0])return null;return t[0].findByLij(e)||t[1].findByLij(e)||t[2].findByLij(e)||t[3].findByLij(e)}distanceToSquared(e){return n(s(me,m(this._center[oe.MIDDLE]),e))}containsPoint(e){const t=this.extent;return e[0]>=t[0]&&e[1]>=t[1]&&e[0]<=t[2]&&e[1]<=t[3]}containsPointXY(e,t){const i=this.extent;return e>=i[0]&&t>=i[1]&&e<=i[2]&&t<=i[3]}unrequestLayerData(e,t,i){const s=this.layerInfo[t][e],n=s.waitingAgents,r=null!=n.removeUnordered(i);j(r,"agent has not requested this piece of map data"),n.length<1&&(s.abortRequest(),this.setMemoryDirty())}dataArrived(e,t,i){const s=null!=i&&"type"in i&&"vector-tile"===i.type,n=this.layerInfo[t][e];n.data=i,n.dataInvalidated=!1,n.waitingAgents.forAll((e=>e.dataArrived(this,s))),n.waitingAgents.clear(),this.setMemoryDirty()}dataMissing(e,t,i){i.notInTilemap||console.error(`Tile ${this._lij.toString()} layer ${t}/${e} error ${i}`);const s=this.layerInfo[t][e];s.dataMissing=!0,s.waitingAgents.forAll((e=>e.dataMissing())),s.waitingAgents.clear(),this.setMemoryDirty()}updateRenderData(e,t,i){switch(i&&this.forEachLoadedNeighbor((i=>i.updateRenderData(e,t))),e){case x.MAP:return this._updateTexture(t);case x.ELEVATION:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(e===E.FADING?K.TEXTURE_NOFADING:K.TEXTURE_FADING),this.setPendingUpdate(e===E.FADING?K.TEXTURE_FADING:K.TEXTURE_NOFADING))}_updateGeometry(){this.setPendingUpdate(K.GEOMETRY);for(const e of this.layerInfo[x.ELEVATION])e.pendingUpdates|=K.GEOMETRY}invalidateLayerData(e,t){this.layerInfo[t][e].invalidateSourceData(),this.restartAgents(t)}computeElevationBounds(){const e=this._elevationBoundsMin,t=this._elevationBoundsMax;let i=1/0,s=-1/0;const n=this.layerInfo[x.ELEVATION];let r=!0;for(const a of n)null!=a.elevationBounds&&(i=Math.min(i,a.elevationBounds.min),s=Math.max(s,a.elevationBounds.max),a.elevationBounds.hasNoDataValues||(r=!1));r&&(i=Math.min(i,0),s=Math.max(s,0)),e===i&&t===s||(this._elevationBoundsMin=i,this._elevationBoundsMax=s,this.updateRadiusAndCenter(),this._surface.setTileTreeDirty())}_updateCenter(){const e=this._elevationBoundsMin,t=this._elevationBoundsMax,i=.5*(e+t),s=this._center;a(me,this.up,i),o(m(s[oe.MIDDLE]),this.centerAtSeaLevel,me),a(me,this.up,e),o(s[oe.TOP],this.centerAtSeaLevel,me),a(me,this.up,t),o(s[oe.BOTTOM],this.centerAtSeaLevel,me)}findElevationBoundsForLayer(e,t){const i=this.layerInfo[x.ELEVATION][e],s=b(this.level),n=Math.max(this.elevationLevel-s,0),r=i.elevationBounds;if(null!=r&&r.level>=t&&r.level<=n)return;const a=this._surface.layerViewByIndex(e,x.ELEVATION),o=U(a);if(!Z(this,o,!1))return;const l=ae;let h=!1;const u=i.data;if(u&&u.level<=n){const e=i.data;l.min=e.samplerData.data.minValue,l.max=e.samplerData.data.maxValue,l.hasNoDataValues=e.samplerData.data.hasNoDataValues,l.level=this.level,h=!0}else{let t,i,r=0;for(let a=this._parent;a&&(!i||r<s)&&(r=this.elevationLevel-a.level,t=i||t,i=a.layerInfo[x.ELEVATION][e].data,!(!i&&t&&a.level<=n));a=a.parent);i=i||t,i&&(i.computeMinMaxValue(this._lij[0],this._lij[1],this._lij[2],l),l.min!==1/0&&(l.level=i.level,h=!0))}h&&(null==i.elevationBounds&&(i.elevationBounds=new T),i.elevationBounds.copyFrom(l))}modifyLayers(e,t,i){const s=this.layerInfo[i];for(const a of s)a.loadingAgent&&a.loadingAgent!==$&&(se(a.loadingAgent),a.loadingAgent=null),a.waitingAgents.clear();for(let a=0;a<s.length;++a)void 0===e[a]&&s[a].release();const n=new Array(...s),r=t.length;s.length=r;for(let a=0;a<r;a++){const e=t[a];s[a]=e>-1?n[e]:J.acquire(this._surface.upsampleInfoPool)}this.setMemoryDirty()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,E.FADING))}updateAgents(e){if(this.renderData){const t=this.layerInfo[e];for(const e of t)e.loadingAgent===$&&(e.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(const e of L){const t=this._isSuspended(e);for(const i of this.layerInfo[e])i.loadingAgent&&i.loadingAgent!==$&&(i.loadingAgent.setSuspension(t),i.loadingAgent===$&&this.updateRenderData(e,E.FADING))}}removeLayerAgent(e,t){const i=this.layerInfo[t][e];i.loadingAgent&&i.loadingAgent!==$&&i.loadingAgent.dispose(),i.loadingAgent=null}agentDone(e,t){const i=this.layerInfo[t][e];i.loadingAgent=$,i.data||null!=i.upsampleInfo||this._createOrUpdateAgents(e+1,t)}_hasBlendableAncestor(e){return"normal"!==e.blendMode||y(e.parent)&&this._hasBlendableAncestor(e.parent)}_hasBlendModes(e,t,i){for(let s=e;s<t;++s){const e=this._surface.layerViewByIndex(s,i);if(C(e)&&"normal"!==e?.layer?.blendMode||y(e?.layer?.parent)&&this._hasBlendableAncestor(e?.layer?.parent))return!0}return!1}_createOrUpdateAgents(e,t){const i=this.layerInfo[t];if(0===i.length)return;const s=this._isSuspended(t);for(let n=e;n<i.length;++n){const r=i[n];let a=!1;const o=this._surface.layerViewByIndex(n,t),l=U(o);if(r.loadingAgent?Z(this,l,!1)?(r.loadingAgent!==$&&r.loadingAgent.setSuspension(s),r.loadingAgent!==$&&(a=r.loadingAgent.update())):r.dispose():Z(this,l,!1)&&(r.loadingAgent=ie(this,n,t,s),a=r.loadingAgent.startLoading(),a?r.loadingAgent===$&&this.setPendingUpdate(K.GEOMETRY):(se(r.loadingAgent),r.loadingAgent=$)),r.loadingAgent===$&&this.updateRenderData(t,E.FADING),!this._hasBlendModes(e,i.length,t)&&a&&o.isOpaque)return}}_isWithinExtent(e){const t=this.extent;return t[0]>=e[0]&&e[2]>=t[2]&&t[1]>=e[1]&&e[3]>=t[3]}intersectsExtent(e){const t=this.extent;return t[2]>=e[0]&&e[2]>=t[0]&&t[3]>=e[1]&&e[3]>=t[1]}getElevationVerticesPerSide(t){const i=this.elevationLevel-this.level,s=Math.max(this.level-t,b(this.level)-i),n=e(1+(this.maxTesselation>>s),2,this.maxTesselation+1),r=this.getDefaultVerticesPerSide();return Math.max(n,r)}get test(){return{cachedMemory:this._cachedMemory}}_findLIJ(e,t){if(!e)return null;const i=this.surface.rootTiles;if(null!=i)for(const s of i)if(le(s,e)){let i=s,n=e[0]-i.level-1;for(;n>=0&&!i.isLeaf&&!t(i);){const t=e[1]>>n&1,s=e[2]>>n&1;i=i.children[2*t+s],n--}return t(i)?i:null}return null}findNeighborTile(e,t){const i=this._lij,s=this.getNeighborLIJ(i,e);return s?he(i,s)?t(this)?this:null:this._findLIJ(s,t):null}findCorner(e,t){const i=e===D.NORTH_EAST?1:e===D.NORTH_WEST?0:e===D.SOUTH_WEST?2:3;let s=this;for(;s.children[0]&&(!t||!t(s));)s=s.children[i];return s}findNeighborCornerTileExact(e,t){return this.findNeighborTile(e,(e=>t(e)||e.level===this.level))?.findCorner(B(e),t)||null}forAllSubtreeOnSide(e,t){const i=e===D.NORTH?[0,1]:e===D.NORTH_EAST?[1]:e===D.EAST?[1,3]:e===D.SOUTH_EAST?[3]:e===D.SOUTH?[2,3]:e===D.SOUTH_WEST?[2]:e===D.WEST?[0,2]:[0],s=e=>{const n=e.children;!t(e)&&n[0]&&i.forEach((e=>s(n[e])))};s(this)}getNeighborEdgeStartVertexIndex(e,t){if(!t)return 0;const i=this.level-t.level;if(P(!R||i>=0),0===i)return 0;const s=2**i,n=1==(1&e),r=n?0:1,a=t.lij[r+1]*s,o=this._lij[r+1],l=o-a,h=n?s-1-l:l;return R&&(P(a<=o&&o<a+s),P(0<=h&&h<s)),h}forEachLoadedNeighbor(e){const t=this.level,i=e=>e.level===t||e.isLoaded;V.forEach((t=>{const s=this.findNeighborTile(t,i);null!=s&&s!==this&&s.forAllSubtreeOnSide(w(t),(i=>!!i.isLoaded&&(e(i,t),!0)))})),G.forEach((t=>{const s=this.findNeighborTile(t,i)?.findCorner(B(t),(e=>e.isLoaded));P(!s||de(this,s,t)),s?.isLoaded&&e(s,t)}))}getNeighborLIJ(e,t){const i=W(t)?-1:q(t)?1:0,s=F(t)?-1:H(t)?1:0,n=[e[0],e[1]+i,e[2]+s];return n[1]<0?null:this.surface.isGlobal?this.wrapLIJ(n):n[2]<0?null:n}wrapLIJ(e){return!e||e[1]<0||e[1]>=2**e[0]?null:this.surface.wrapEastWest(e)}get westNeighborWestExtent(){return this.extent[0]*(this.isWestEnd?-1:1)}get eastNeighborEastExtent(){return this.extent[2]*(this.isEastEnd?-1:1)}get isEastEnd(){return this._lij[2]===this.surface.lijEastEnd(this.level)-1}get isWestEnd(){return 0===this._lij[2]}get isNorthEnd(){return 0===this._lij[1]}get isSouthEnd(){const e=this.surface.extent,t=e?.[1]??null;return null!=t&&this.extent[1]+c()>=t}checkGeometryWaterproofness(){k&&(P(this.isLoaded),this.renderData?.checkGeometryWaterproofness())}shouldHaveNeighbor(e){const t=this.extent,i=this.surface.rootTilesExtent,s=.25*(t[2]-t[0]);if(W(e)&&t[3]+s>=i[3])return!1;if(q(e)&&t[1]-s<=i[1])return!1;const n=this.surface.isGlobal;return!(!n&&F(e)&&t[0]-s<=i[0])&&!(!n&&H(e)&&t[2]+s>=i[2])}updateDistanceToPOI(e){const t=this._lastPOI;if(this.distanceToPOI>=0&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return;h(this._lastPOI,e);const i=this._center[oe.MIDDLE],s=e[0]-i[0],n=e[1]-i[1],r=e[2]-i[2];this.distanceToPOI=s*s+n*n+r*r}}function ie(e,t,i,s){const n=i===x.ELEVATION?re.acquire():ne.acquire();return n.init(e,t,i,s),n}function se(e){e.dispose(),e instanceof v?re.release(e):e instanceof S&&ne.release(e)}const ne=new i(S),re=new i(v),ae=new T;var oe;function le(e,t){const i=e.lij,s=t[0]-i[0];return!(s<0)&&(t[1]>>s===i[1]&&t[2]>>s===i[2])}function he(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function ue(e,t,i){if(null==e||null==t)return!1;if(0===e.level&&0===t.level){if(e.isEastEnd&&t.isWestEnd&&i===D.EAST)return!0;if(e.isWestEnd&&t.isEastEnd&&i===D.WEST)return!0}const s=Math.max(1e-6*(e.extent[2]-e.extent[0]),1);switch(i){case D.NORTH:return X(e.extent[3],t.extent[1],s);case D.SOUTH:return X(e.extent[1],t.extent[3],s);case D.EAST:return X(e.extent[2],t.extent[0],s)||X(e.extent[2],-t.extent[0],s);case D.WEST:return X(e.extent[0],t.extent[2],s)||X(e.extent[0],-t.extent[2],s)}}function de(e,t,i){return null!=e&&null!=t&&t!==e&&(e.level>=t.level?ce(e,t,i):ce(t,e,B(i)))}function ce(e,t,i){P(e.level>=t.level);const s=Y(i),n=z(i),r=e.extent,a=t.extent,o=[s?r[0]:r[2],n?r[3]:r[1]],l=[s?a[2]:a[0],n?a[1]:a[3]],h=1e-5*(r[2]-r[0]),u=X(o[0],l[0],h)||e.surface.isGlobal&&X(o[0],-l[0],h),d=X(o[1],l[1],h);if(u&&d)return!0;if(e.level===t.level)return P(!1),!1;if(!u&&!d)return P(!1),!1;const c=u?ge(a[1],a[3],r[1],r[3],h):ge(a[0],a[2],r[0],r[2],h);return P(c),c}function ge(e,t,i,s,n){return e-n<=i&&i<=s&&s<=t+n}!function(e){e[e.TOP=0]="TOP",e[e.MIDDLE=1]="MIDDLE",e[e.BOTTOM=2]="BOTTOM"}(oe||(oe={}));const pe=u(),fe=u(),_e=u(),me=u();export{oe as CenterPosition,te as Tile,de as isCornerNeighbor,ue as isEdgeNeighbor,he as lijEquals};
|
|
@@ -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"../../../../../core/PooledArray.js";import{fromQuat as
|
|
5
|
+
import t from"../../../../../core/PooledArray.js";import{fromQuat as e,scale as r}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{conjugate as n}from"../../../../../core/libs/gl-matrix-2/math/quat.js";import{create as a}from"../../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{k as s,z as c,u as l,s as f,m as i,c as u,t as m,g as b}from"../../../../../chunks/vec32.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{signedDistance as p}from"../../../../../geometry/support/plane.js";import{empty as g,within as d,union as j}from"../../lib/depthRange.js";function w(t,e){const r=g(),{eye:o,frustum:n,viewForward:a}=t;e.forAll((t=>{const e=null!=t.offsetObb?t.offsetObb:t.obb,l=s(c(C,e.center,o),a),f=e.projectedRadius(a);if(d(r,l-f)&&d(r,l+f))return;const i=M(e,n);if(-1===i)return;if(0===i)return k.far=l+f,k.near=l-f,void j(r,k);const u=x.pushNew();u.near=l-f,u.far=l+f,u.mask=i,u.object=t}));for(let l=0;l<x.length;l++){const t=x.data[l];if(d(r,t.near)&&d(r,t.far))continue;k.far=t.far,k.near=1/0;const e=R(null!=t.object.offsetObb?t.object.offsetObb:t.object.obb,o,y,(e=>{let r=O;for(let o=0;o<F&&e.length>0;o++){if(0==(t.mask&1<<o))continue;z(n[o],e,r);const a=e;e=r,r=a}for(let t=0;t<e.length;t+=3){f(q,e.data[t],e.data[t+1],e.data[t+2]);const r=s(c(q,q,o),a);k.near=Math.min(k.near,r)}}));0===e&&(k.near=0),j(r,k)}return x.length=0,r}const x=new t({allocator:t=>t||{near:1/0,far:-1/0,mask:0,object:null},deallocator:t=>(t.object=null,t)}),k=g(),q=h(),v=h(),y=new t({deallocator:null}),O=new t({deallocator:null});function z(t,e,r){r.length=0;const o=e.length-3;A(q,e,o);const n=p(t,q);n<=0&&(r.push(q[0]),r.push(q[1]),r.push(q[2]));let a=0,s=n;for(;a<o;a+=3){A(v,e,a);const o=p(t,v);if(s*o<0){i(q,v,q,o/(o-s)),P(r,q)}o<=0&&P(r,v),s=o,u(q,v)}if(s*n<0){A(v,e,o);i(q,v,q,n/(n-s)),P(r,q)}}function A(t,e,r){return f(t,e.data[r],e.data[r+1],e.data[r+2])}function P(t,e){t.push(e[0]),t.push(e[1]),t.push(e[2])}function R(t,o,a,s){n(B,t.quaternion),c(C,o,t.center),l(C,C,B);const i=t.halfSize,u=8*((C[0]<-i[0]?-1:C[0]>i[0]?1:0)+3*(C[1]<-i[1]?-1:C[1]>i[1]?1:0)+9*(C[2]<-i[2]?-1:C[2]>i[2]?1:0)+13),h=S[u];if(0===h)return h;e(N,t.quaternion),r(N,N,t.halfSize);const p=(e,r)=>{const o=S[u+r+1];return f(e,((1&o)<<1)-1,(2&o)-1,((4&o)>>1)-1),m(e,e,N),b(e,t.center,e)};return a.length=0,P(a,p(D,0)),P(a,p(E,1)),P(a,p(C,2)),P(a,p(G,3)),s(a),1===h?h:(a.length=0,P(a,D),P(a,G),P(a,p(C,4)),P(a,p(H,5)),s(a),2===h||(a.length=0,P(a,D),P(a,H),P(a,p(C,6)),P(a,E),s(a)),h)}const S=(()=>{const t=new Array(216);let e=0;const r=r=>{for(let o=0;o<r.length;o++)t[e+o]=r[o];e+=8};return r([3,0,6,2,3,1,5,4]),r([2,0,2,3,1,5,4,0]),r([3,1,0,2,3,7,5,4]),r([2,0,1,3,2,6,4,0]),r([1,0,1,3,2,0,0,0]),r([2,1,5,7,3,2,0,0]),r([3,2,0,1,3,7,6,4]),r([2,2,0,1,3,7,6,0]),r([3,3,0,1,5,7,6,2]),r([2,0,1,5,4,6,2,0]),r([1,0,1,5,4,0,0,0]),r([2,1,3,7,5,4,0,0]),r([1,0,2,6,4,0,0,0]),r([0,0,0,0,0,0,0,0]),r([1,1,3,7,5,0,0,0]),r([2,2,3,7,6,4,0,0]),r([1,2,3,7,6,0,0,0]),r([2,3,1,5,7,6,2,0]),r([3,4,0,1,5,7,6,2]),r([2,5,7,6,4,0,1,0]),r([3,5,0,1,3,7,6,4]),r([2,4,5,7,6,2,0,0]),r([1,4,5,7,6,0,0,0]),r([2,5,1,3,7,6,4,0]),r([3,6,0,2,3,7,5,4]),r([2,6,2,3,7,5,4,0]),r([3,7,6,2,3,1,5,4]),t})(),F=4;function M(t,e){let r=0;for(let o=0;o<F;o++){const n=t.intersectPlane(e[o]);if(n>0)return-1;0===n&&(r|=1<<o)}return r}const N=o(),B=a(),C=h(),D=h(),E=h(),G=h(),H=h();export{w as computeDepthRange};
|
|
@@ -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{invert as t,transpose as n}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as
|
|
5
|
+
import{invert as t,transpose as n}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{z as e,t as s,F as i,s as a,n as m,c,k as p,b as r,o as h}from"../../../../../chunks/vec32.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as l}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as x}from"../../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as b}from"../../../../../geometry/support/FloatArray.js";import{compactIndices as _,getContinuousIndexArray as I}from"../../../../../geometry/support/Indices.js";import{ViewingMode as f}from"../../../../ViewingMode.js";import{componentMinimalSizeForIntersectionData as C,ComponentIntersectionData as u}from"./ComponentIntersectionData.js";import{Vertices as M}from"../../lib/Attribute.js";import{getVisibility as g}from"../../lib/ComponentUtils.js";import{computeInvDir as A,intersectAabbInvDir as j,intersectTriangles as y}from"../../materials/internal/MaterialUtil.js";class B{constructor(t,n,o){this.viewingMode=t,this.positionData=n,this._components=o,this._planetCenter=d(),this._planetNorth=d(),this._componentIndicesForBsp=null,this._componentBspNodes=[],this._aabb=[0,0,0,0,0,0],this._indices=n.indices?_(n.indices):I(n.positions.length/3),this._positions=n.positions,this._componentIntersectionData=new Array(o.count)}destroy(){this._positions=null,this._indices=null,this._componentIntersectionData.length=0,this._perComponentAabbs=null}getComponentAabb(t,n){const o=this._ensureComponentAabbs(),e=6*t;return n[0]=o[e],n[1]=o[e+1],n[2]=o[e+2],n[3]=o[e+3],n[4]=o[e+4],n[5]=o[e+5],n}getComponentAabbs(){return this._ensureComponentAabbs()}_ensureComponentAabbs(){return this._perComponentAabbs||(this._perComponentAabbs=this._computePerComponentAabbs()),this._perComponentAabbs}getComponentPositions(t,n){n.indices=this._indices,n.data=this._positions,n.stride=3,n.startIndex=this._components.offsets[t],n.endIndex=this._components.offsets[t+1]}intersect(o,p,r,h,d,l,x,b){const{position:_}=x,I=e(D,o,_),g=e(F,p,_),B=t(P,x.rotationScale);s(I,I,B),s(g,g,B);const v=n(R,B),k=new M(this._positions,3),z=this._indices,E=this._components.offsets,G=A(I,g,w);if(this.viewingMode===f.Global){const t=this._planetCenter;i(t,_),s(t,t,B);const n=this._planetNorth;a(n,0,0,1),s(n,n,B),m(n,n)}const L=c(U,I),O=c(V,g),S=e(q,g,I);m(S,S);const T=t=>{const n=this.getComponentAabb(t,N);if(null!=d){const n=d[t];null==h||b?(I[2]=L[2]-n,g[2]=O[2]-n):h.componentOffset=n}if(null==h||b||h.applyToAabb(n),!j(n,I,G,r))return;const o=E[t]/3,e=E[t+1]/3,i=(n,o,e)=>l(t,n,s(o,o,v),e);(null==h||b)&&e-o>C?(null==this._componentIntersectionData[t]&&(this._componentIntersectionData[t]=new u(this._indices,o,e,k)),this._componentIntersectionData[t].intersectRay(I,g,i)):y(I,g,o,e,z,k,void 0,h,i)};this._intersectComponents(T,b,I,g)}_intersectComponents(t,n,o,s){const i=this._components.pickability,a=this._components.visibility;if(this._components.visibility.componentCount<H){const n=n=>(g(i,n)&&t(n),!0);return void a.forEachComponent(n)}0===this._componentBspNodes.length&&this._generateComponentBspRoot();const c=this._componentIndicesForBsp,r=n=>{g(i,n)&&a.isVisible(n)&&t(n)},h=(t,n)=>{for(let o=t;o<n;++o)r(c[o])};if(n){let t=0;for(;t>=0;){const n=this._componentBspNodes[t],e=n.plane;if(!e||-1===n.child0&&-1===n.child1){h(n.minComponentIndexIndex,n.maxComponentIndexIndex);break}{h(n.minMidComponentIndexIndex,n.maxMidComponentIndexIndex);const s=p(e,o)-e[3];if(s<0){if(-1===n.child0){h(n.minComponentIndexIndex,n.minMidComponentIndexIndex);break}t=n.child0}else{if(!(s>0))break;if(-1===n.child1){h(n.maxMidComponentIndexIndex,n.maxComponentIndexIndex);break}t=n.child1}}}}else{const t=J;e(t,s,o),m(t,t);const n=this._componentBspNodes,i=e=>{const s=n[e],a=s.plane;if(!a||-1===s.child0&&-1===s.child1)h(s.minComponentIndexIndex,s.maxComponentIndexIndex);else{const n=p(a,o)-a[3],e=p(a,t);s.minComponentIndexIndex<s.minMidComponentIndexIndex&&(n<=0||e<0)&&(-1!==s.child0?i(s.child0):h(s.minComponentIndexIndex,s.minMidComponentIndexIndex)),h(s.minMidComponentIndexIndex,s.maxMidComponentIndexIndex),s.maxMidComponentIndexIndex<s.maxComponentIndexIndex&&(n>=0||e>0)&&(-1!==s.child1?i(s.child1):h(s.maxMidComponentIndexIndex,s.maxComponentIndexIndex))}};i(0)}}_generateComponentBspRoot(){const t=this._components.count,n=new Uint16Array(t);this._componentIndicesForBsp=n;for(let e=0;e<t;++e)n[e]=e;const o=this._ensureComponentAabbs(),s=this._planetCenter,d=this._planetNorth,x=G;i(x,s),m(x,x);r(L,d,x);const b=this._aabb,_=b[2],I=[];let C=0;const u=this._componentBspNodes;u.length=0;const M=(t,n)=>{const e=6*t,s=o[e],i=o[e+1],m=o[e+2],c=o[e+3],r=o[e+4],h=o[e+5],d=a(O,.5*(s+c),.5*(i+r),.5*(m+h)),l=.5*(c-s),x=.5*(r-i),b=.5*(h-m),_=Math.sqrt(l*l+x*x+b*b),I=n,f=n[3],C=p(I,d)-f;return Math.abs(C)>_?Math.sign(C):0},g=(t,e,s)=>{let i=1/0,a=1/0,m=1/0,c=-1/0,p=-1/0,r=-1/0;for(let h=e;h<s;++h){const t=6*n[h];i=Math.min(i,o[t]),c=Math.max(c,o[t+3]),a=Math.min(a,o[t+1]),p=Math.max(p,o[t+4]),m=Math.min(m,o[t+2]),r=Math.max(r,o[t+5])}t[0]=i,t[1]=a,t[2]=m,t[3]=c,t[4]=p,t[5]=r},A=this.viewingMode===f.Local;let j=!1;if(!A){const t=a(O,.5*(b[0]+b[3]),.5*(b[1]+b[4]),.5*(b[2]+b[5])),n=h(s,t);j=_>.5*n}const y=(t,o,i,h,x)=>{const b=u.length;let _;if(j||i>=T||o-t<S)_=new v(t,o,o,o,null);else{g(k,t,o);const h=k[0],x=k[1],f=k[2],C=k[3],u=k[4],j=C-h,B=u-x,w=l(),N=w;if(A)j>=B?(a(N,1,0,0),w[3]=-.5*(h+C)):(a(N,0,1,0),w[3]=-.5*(x+u));else{const t=z,n=E;a(t,.5*(h+C),.5*(x+u),f),e(t,t,s),m(t,t),r(n,t,d),m(n,n),j>=B?c(N,n):(r(N,n,t),m(N,N)),w[3]=p(N,s)}let D,F;{let e=t,s=o;for(;e<s;){const t=n[e];M(t,w)<0?++e:(--s,n[e]=n[s],n[s]=t)}D=e;let i=e;for(s=o;i<s;){const t=n[s-1];M(t,w)>0?--s:(n[s-1]=n[i],n[i]=t,++i)}F=s}_=new v(t,D,F,o,w),D>=t+S&&I.push((()=>y(t,D,i+1,b,!0))),o>=F+S&&I.push((()=>y(F,o,i+1,b,!1)))}if(u.push(_),-1!==h){const t=u[h];x?t.child0=b:t.child1=b}};for(I.push((()=>y(0,t,0,-1,!1)));C<I.length;){(0,I[C])(),++C}}_computePerComponentAabbs(){const t=this._components.count,n=b(6*t),o=this._indices,e=this._positions,s=this._components.offsets;let i=0,a=1/0,m=1/0,c=1/0,p=-1/0,r=-1/0,h=-1/0;for(let d=0;d<t;d++){const t=s[d],l=s[d+1];let x=1/0,b=1/0,_=1/0,I=-1/0,f=-1/0,C=-1/0;for(let n=t;n<l;n++){const t=3*o[n],s=e[t],i=e[t+1],a=e[t+2];x=Math.min(x,s),b=Math.min(b,i),_=Math.min(_,a),I=Math.max(I,s),f=Math.max(f,i),C=Math.max(C,a)}n[i++]=x,n[i++]=b,n[i++]=_,n[i++]=I,n[i++]=f,n[i++]=C,a=Math.min(a,x),m=Math.min(m,b),c=Math.min(c,_),p=Math.max(p,I),r=Math.max(r,f),h=Math.max(h,C)}return this._aabb[0]=a,this._aabb[1]=m,this._aabb[2]=c,this._aabb[3]=p,this._aabb[4]=r,this._aabb[5]=h,n}get positions(){return this._positions}get indices(){return this._indices}get aabb(){return this._ensureComponentAabbs(),this._aabb}}class v{constructor(t,n,o,e,s){this.minComponentIndexIndex=t,this.minMidComponentIndexIndex=n,this.maxMidComponentIndexIndex=o,this.maxComponentIndexIndex=e,this.plane=s,this.child0=-1,this.child1=-1}}const w=d(),N=x(),k=[0,0,0,0,0,0],D=d(),F=d(),P=o(),R=o(),U=d(),V=d(),q=d(),z=d(),E=d(),G=d(),L=d(),O=d(),S=5,T=10,H=7,J=d();export{B as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../../chunks/tslib.es6.js";import has from"../../../../../../core/has.js";import{releaseMaybe as t}from"../../../../../../core/maybe.js";import{invert as r,transpose as o}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as s}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{H as a}from"../../../../../../chunks/vec32.js";import{fromArray as i,fromValues as l}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{v as n}from"../../../../../../chunks/vec42.js";import{fromValues as u}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ColorMixModeEnum as h}from"../../../../layers/support/symbolColorUtils.js";import{OverlayContent as p}from"../../../../terrain/OverlayContent.js";import{ComponentTechnique as c}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as d,IntegratedMeshMode as m}from"./ComponentTechniqueConfiguration.js";import{ComponentDataType as g}from"./shader/ComponentData.glsl.js";import{VertexDiscardMode as x}from"./shader/VertexDiscardByOpacity.glsl.js";import{MaterialBase as y,parameter as f,parameterBlock as b,MaterialParameterBlock as T}from"../../../core/material/MaterialBase.js";import{RenderPassIdentifier as v}from"../../../core/renderPasses/AllRenderPasses.js";import{ShaderOutput as M}from"../../../core/shaderLibrary/ShaderOutput.js";import{NormalType as O}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{NormalsDoubleSidedMode as C}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as w}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{defaultMaskAlphaCutoff as S}from"../../../core/shaderLibrary/util/AlphaCutoff.js";import{EllipsoidMode as P}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{TwoVectorPosition as j}from"../../../core/util/TwoVectorPosition.js";import{AlphaDiscardMode as q,CullFaceOptions as N}from"../../../lib/basicInterfaces.js";import{TransparencyPassType as A}from"../../../lib/TransparencyPassType.js";import{defaultAdvancedMRRFactors as D}from"../../../materials/pbrUtils.js";class R extends y{constructor(e,t){super(),this.toMapSpace=t,this.baseColor=u(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=i(D),this.emissiveFactor=l(0,0,0),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null,this.objectOpacity=1,this.commonMaterialParameters=new W,this.componentParameters=new _,this.textureAlphaCutoff=S,this.alphaDiscardMode=q.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=P.Earth,this.hasOccludees=!1,this._techniqueConfiguration=new d;const a=new j(e.position),n=s(e.rotationScale);r(n,n),o(n,n),this.transformNormalGlobalFromModel=n,this.transformWorldFromModelTL=a.low,this.transformWorldFromModelTH=a.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this._technique=t(this._technique),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get texture(){return null!=this.baseColorTexture?this.baseColorTexture.glTexture:null}get textureMetallicRoughness(){return null!=this.metallicRoughnessTexture?this.metallicRoughnessTexture.glTexture:null}get textureEmissive(){return null!=this.emissionTexture?this.emissionTexture.glTexture:null}get textureOcclusion(){return null!=this.occlusionTexture?this.occlusionTexture.glTexture:null}get textureNormal(){return null!=this.normalTexture?this.normalTexture.glTexture:null}prepareTechnique(e,t,r,o){const s=this._techniqueConfiguration;s.hasVertexColors=o.colors,s.hasNormals=o.hasNormals,s.textureCoordinateType=o.textureCoordinates,s.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,s.hasEmissionTexture=null!=this.emissionTexture,s.hasOcclusionTexture=null!=this.occlusionTexture,s.hasNormalTexture=null!=this.normalTexture,s.transparencyPassType=t.identifier===v.Material&&null!=r.transparencyPassType?r.transparencyPassType:A.NONE,s.multipassEnabled=t.identifier===v.Material&&r.multipassEnabled,s.cullAboveGround=t.identifier===v.Material&&r.multipassTerrain.cullAboveGround,s.ellipsoidMode=this.ellipsoidMode,s.componentData=this.componentParameters.type,s.cullFace=this.commonMaterialParameters.cullFace,s.doubleSidedMode=this.commonMaterialParameters.doubleSided?C.View:C.None,s.hasColorTexture=null!=this.baseColorTexture;const a=this._computeWhichMaterialPass();if(s.blendingEnabled=a===F.Transparent||a===F.OpaqueAndTransparent,s.alphaDiscardMode=this.alphaDiscardMode,s.integratedMeshMode=this.isIntegratedMesh?L(r)?B(r)?m.ColorOverlayWithWater:m.ColorOverlay:m.NoOverlay:m.None,s.hasPolygonOffset=this.polygonOffsetEnabled,s.pbrMode=s.integratedMeshMode===m.ColorOverlayWithWater?w.WaterOnIntegratedMesh:this.usePBR?this.hasParametersFromSource?has("enable-feature:im-shading")&&this.isIntegratedMesh?w.Simplified:w.Schematic:w.Normal:w.Disabled,s.normalType=o.needsNormals?s.hasNormals?O.Compressed:O.ScreenDerivative:O.Ground,s.hasSlicePlane=null!=r.slicePlane&&this.commonMaterialParameters.hasSlicePlane,t.identifier===v.ShadowMap)s.output=M.Shadow,s.vertexDiscardMode=x.None;else if(t.identifier===v.Highlight)s.output=M.Highlight,s.vertexDiscardMode=x.None;else{switch(a===F.OpaqueAndTransparent?s.vertexDiscardMode=t.transparent?x.Opaque:x.Transparent:s.vertexDiscardMode=x.None,s.output=t.output,s.receiveAmbientOcclusion=!1,s.receiveShadows=!1,t.output){case M.Color:s.receiveAmbientOcclusion=null!=r.ssao,s.hasOccludees=r.hasOccludees,s.receiveShadows=r.shadowMap.ready,s.hasScreenSpaceReflections=null!=r.ssr.lastFrameColor,s.hasCloudsReflections=null!=r.cloudsFade.data;break;case M.Alpha:s.hasOccludees=r.hasOccludees;break;case M.ObjectAndLayerIdColor:s.objectAndLayerIdColor=!0}s.snowCover=this.hasSnowCover(r)}return this._technique=e.releaseAndAcquire(c,s,this._technique),this._setClean(),this._technique}hasSnowCover(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}submit(e,t,r){if(0===this.objectOpacity)return;const o=r.renderable.geometry,s=r.components,a=r.renderable.meta.cameraDepthSquared,i=s.geometryRanges,l=s.highlightRanges,n=s.defaultShadowMapRanges;switch(this._computeWhichMaterialPass()){case F.Opaque:e.materialOpaque.submitDraw(this,o,i,a);break;case F.Transparent:e.materialTransparent.submitDraw(this,o,i,a);break;case F.OpaqueAndTransparent:e.materialOpaque.submitDraw(this,o,i,a),e.materialTransparent.submitDraw(this,o,i,a);break;case F.IntegratedMesh:e.materialIntegratedMesh.submitDraw(this,o,i,a),k(t)&&e.highlightIntegratedMesh.submitDraw(this,o,i,a)}const u=this.componentParameters.castShadows!==I.None;u&&e.shadowMap.submitDraw(this,o,i,a),null!=l&&(e.highlight.submitDraw(this,o,l,a),u&&e.highlightShadowMap.submitDraw(this,o,l,a)),u&&null!=n&&e.defaultShadowMap.submitDraw(this,o,n,a)}_computeWhichMaterialPass(){return this.isIntegratedMesh?F.IntegratedMesh:this.objectOpacity<1?F.Transparent:this.componentParameters.opaqueOverride===I.All?F.Opaque:this.baseColor[3]<1||this.alphaDiscardMode===q.Blend||this.alphaDiscardMode===q.MaskBlend?F.Transparent:this.componentParameters.transparent===I.None?F.Opaque:this.componentParameters.transparent===I.All?F.Transparent:F.OpaqueAndTransparent}}var F,I;e([f({vectorOps:n})],R.prototype,"baseColor",void 0),e([f()],R.prototype,"usePBR",void 0),e([f()],R.prototype,"hasParametersFromSource",void 0),e([f({vectorOps:a})],R.prototype,"mrrFactors",void 0),e([f({vectorOps:a})],R.prototype,"emissiveFactor",void 0),e([f({dispose:!0})],R.prototype,"baseColorTexture",void 0),e([f({dispose:!0})],R.prototype,"metallicRoughnessTexture",void 0),e([f({dispose:!0})],R.prototype,"emissionTexture",void 0),e([f({dispose:!0})],R.prototype,"occlusionTexture",void 0),e([f({dispose:!0})],R.prototype,"normalTexture",void 0),e([f()],R.prototype,"objectOpacity",void 0),e([b()],R.prototype,"commonMaterialParameters",void 0),e([b()],R.prototype,"componentParameters",void 0),e([f()],R.prototype,"textureAlphaCutoff",void 0),e([f()],R.prototype,"alphaDiscardMode",void 0),e([f()],R.prototype,"isIntegratedMesh",void 0),e([f()],R.prototype,"polygonOffsetEnabled",void 0),e([f()],R.prototype,"ellipsoidMode",void 0),e([f()],R.prototype,"hasOccludees",void 0),function(e){e[e.Opaque=0]="Opaque",e[e.Transparent=1]="Transparent",e[e.OpaqueAndTransparent=2]="OpaqueAndTransparent",e[e.IntegratedMesh=3]="IntegratedMesh"}(F||(F={}));class W extends T{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=N.Back,this.hasSlicePlane=!0}}e([f()],W.prototype,"doubleSided",void 0),e([f()],W.prototype,"cullFace",void 0),e([f()],W.prototype,"hasSlicePlane",void 0);class _ extends T{constructor(){super(...arguments),this.externalColor=u(1,1,1,1),this.externalColorMixMode=h.Multiply,this.castShadows=I.All}get transparent(){return this.externalColor[3]<1?I.All:I.None}get opaqueOverride(){return this.externalColorMixMode===h.Replace&&1===this.externalColor[3]?I.All:I.None}get visible(){return this.externalColor[3]>0?I.All:I.None}get type(){return g.Uniform}}e([f({vectorOps:n})],_.prototype,"externalColor",void 0),e([f()],_.prototype,"externalColorMixMode",void 0),e([f()],_.prototype,"castShadows",void 0),function(e){e[e.All=0]="All",e[e.Some=1]="Some",e[e.None=2]="None"}(I||(I={}));class E extends T{constructor(){super(...arguments),this.texture=null,this.transparent=I.None,this.opaqueOverride=I.None,this.castShadows=I.None}get type(){return g.Varying}}function k(e){return null!=e.overlay?.getTexture(p.Highlight)}function B(e){return null!=e.overlay?.getTexture(p.WaterNormal)}function L(e){return null!=e.overlay?.getTexture(p.ColorNoRasterImage)}e([f()],E.prototype,"texture",void 0),e([f()],E.prototype,"transparent",void 0),e([f()],E.prototype,"opaqueOverride",void 0),e([f()],E.prototype,"castShadows",void 0);export{W as CommonMaterialParameters,R as ComponentMaterial,I as ComponentParameterSummary,_ as ComponentParametersUniform,E as ComponentParametersVarying};
|
|
5
|
+
import{_ as e}from"../../../../../../chunks/tslib.es6.js";import has from"../../../../../../core/has.js";import{releaseMaybe as t}from"../../../../../../core/maybe.js";import{invert as r,transpose as o}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as s}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{I as a}from"../../../../../../chunks/vec32.js";import{fromArray as i,fromValues as l}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{v as n}from"../../../../../../chunks/vec42.js";import{fromValues as u}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ColorMixModeEnum as h}from"../../../../layers/support/symbolColorUtils.js";import{OverlayContent as p}from"../../../../terrain/OverlayContent.js";import{ComponentTechnique as c}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as d,IntegratedMeshMode as m}from"./ComponentTechniqueConfiguration.js";import{ComponentDataType as g}from"./shader/ComponentData.glsl.js";import{VertexDiscardMode as x}from"./shader/VertexDiscardByOpacity.glsl.js";import{MaterialBase as y,parameter as f,parameterBlock as b,MaterialParameterBlock as T}from"../../../core/material/MaterialBase.js";import{RenderPassIdentifier as v}from"../../../core/renderPasses/AllRenderPasses.js";import{ShaderOutput as M}from"../../../core/shaderLibrary/ShaderOutput.js";import{NormalType as O}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{NormalsDoubleSidedMode as C}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as w}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{defaultMaskAlphaCutoff as S}from"../../../core/shaderLibrary/util/AlphaCutoff.js";import{EllipsoidMode as P}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{TwoVectorPosition as j}from"../../../core/util/TwoVectorPosition.js";import{AlphaDiscardMode as q,CullFaceOptions as N}from"../../../lib/basicInterfaces.js";import{TransparencyPassType as A}from"../../../lib/TransparencyPassType.js";import{defaultAdvancedMRRFactors as D}from"../../../materials/pbrUtils.js";class R extends y{constructor(e,t){super(),this.toMapSpace=t,this.baseColor=u(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=i(D),this.emissiveFactor=l(0,0,0),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null,this.objectOpacity=1,this.commonMaterialParameters=new W,this.componentParameters=new _,this.textureAlphaCutoff=S,this.alphaDiscardMode=q.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=P.Earth,this.hasOccludees=!1,this._techniqueConfiguration=new d;const a=new j(e.position),n=s(e.rotationScale);r(n,n),o(n,n),this.transformNormalGlobalFromModel=n,this.transformWorldFromModelTL=a.low,this.transformWorldFromModelTH=a.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this._technique=t(this._technique),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get texture(){return null!=this.baseColorTexture?this.baseColorTexture.glTexture:null}get textureMetallicRoughness(){return null!=this.metallicRoughnessTexture?this.metallicRoughnessTexture.glTexture:null}get textureEmissive(){return null!=this.emissionTexture?this.emissionTexture.glTexture:null}get textureOcclusion(){return null!=this.occlusionTexture?this.occlusionTexture.glTexture:null}get textureNormal(){return null!=this.normalTexture?this.normalTexture.glTexture:null}prepareTechnique(e,t,r,o){const s=this._techniqueConfiguration;s.hasVertexColors=o.colors,s.hasNormals=o.hasNormals,s.textureCoordinateType=o.textureCoordinates,s.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,s.hasEmissionTexture=null!=this.emissionTexture,s.hasOcclusionTexture=null!=this.occlusionTexture,s.hasNormalTexture=null!=this.normalTexture,s.transparencyPassType=t.identifier===v.Material&&null!=r.transparencyPassType?r.transparencyPassType:A.NONE,s.multipassEnabled=t.identifier===v.Material&&r.multipassEnabled,s.cullAboveGround=t.identifier===v.Material&&r.multipassTerrain.cullAboveGround,s.ellipsoidMode=this.ellipsoidMode,s.componentData=this.componentParameters.type,s.cullFace=this.commonMaterialParameters.cullFace,s.doubleSidedMode=this.commonMaterialParameters.doubleSided?C.View:C.None,s.hasColorTexture=null!=this.baseColorTexture;const a=this._computeWhichMaterialPass();if(s.blendingEnabled=a===F.Transparent||a===F.OpaqueAndTransparent,s.alphaDiscardMode=this.alphaDiscardMode,s.integratedMeshMode=this.isIntegratedMesh?L(r)?B(r)?m.ColorOverlayWithWater:m.ColorOverlay:m.NoOverlay:m.None,s.hasPolygonOffset=this.polygonOffsetEnabled,s.pbrMode=s.integratedMeshMode===m.ColorOverlayWithWater?w.WaterOnIntegratedMesh:this.usePBR?this.hasParametersFromSource?has("enable-feature:im-shading")&&this.isIntegratedMesh?w.Simplified:w.Schematic:w.Normal:w.Disabled,s.normalType=o.needsNormals?s.hasNormals?O.Compressed:O.ScreenDerivative:O.Ground,s.hasSlicePlane=null!=r.slicePlane&&this.commonMaterialParameters.hasSlicePlane,t.identifier===v.ShadowMap)s.output=M.Shadow,s.vertexDiscardMode=x.None;else if(t.identifier===v.Highlight)s.output=M.Highlight,s.vertexDiscardMode=x.None;else{switch(a===F.OpaqueAndTransparent?s.vertexDiscardMode=t.transparent?x.Opaque:x.Transparent:s.vertexDiscardMode=x.None,s.output=t.output,s.receiveAmbientOcclusion=!1,s.receiveShadows=!1,t.output){case M.Color:s.receiveAmbientOcclusion=null!=r.ssao,s.hasOccludees=r.hasOccludees,s.receiveShadows=r.shadowMap.ready,s.hasScreenSpaceReflections=null!=r.ssr.lastFrameColor,s.hasCloudsReflections=null!=r.cloudsFade.data;break;case M.Alpha:s.hasOccludees=r.hasOccludees;break;case M.ObjectAndLayerIdColor:s.objectAndLayerIdColor=!0}s.snowCover=this.hasSnowCover(r)}return this._technique=e.releaseAndAcquire(c,s,this._technique),this._setClean(),this._technique}hasSnowCover(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}submit(e,t,r){if(0===this.objectOpacity)return;const o=r.renderable.geometry,s=r.components,a=r.renderable.meta.cameraDepthSquared,i=s.geometryRanges,l=s.highlightRanges,n=s.defaultShadowMapRanges;switch(this._computeWhichMaterialPass()){case F.Opaque:e.materialOpaque.submitDraw(this,o,i,a);break;case F.Transparent:e.materialTransparent.submitDraw(this,o,i,a);break;case F.OpaqueAndTransparent:e.materialOpaque.submitDraw(this,o,i,a),e.materialTransparent.submitDraw(this,o,i,a);break;case F.IntegratedMesh:e.materialIntegratedMesh.submitDraw(this,o,i,a),k(t)&&e.highlightIntegratedMesh.submitDraw(this,o,i,a)}const u=this.componentParameters.castShadows!==I.None;u&&e.shadowMap.submitDraw(this,o,i,a),null!=l&&(e.highlight.submitDraw(this,o,l,a),u&&e.highlightShadowMap.submitDraw(this,o,l,a)),u&&null!=n&&e.defaultShadowMap.submitDraw(this,o,n,a)}_computeWhichMaterialPass(){return this.isIntegratedMesh?F.IntegratedMesh:this.objectOpacity<1?F.Transparent:this.componentParameters.opaqueOverride===I.All?F.Opaque:this.baseColor[3]<1||this.alphaDiscardMode===q.Blend||this.alphaDiscardMode===q.MaskBlend?F.Transparent:this.componentParameters.transparent===I.None?F.Opaque:this.componentParameters.transparent===I.All?F.Transparent:F.OpaqueAndTransparent}}var F,I;e([f({vectorOps:n})],R.prototype,"baseColor",void 0),e([f()],R.prototype,"usePBR",void 0),e([f()],R.prototype,"hasParametersFromSource",void 0),e([f({vectorOps:a})],R.prototype,"mrrFactors",void 0),e([f({vectorOps:a})],R.prototype,"emissiveFactor",void 0),e([f({dispose:!0})],R.prototype,"baseColorTexture",void 0),e([f({dispose:!0})],R.prototype,"metallicRoughnessTexture",void 0),e([f({dispose:!0})],R.prototype,"emissionTexture",void 0),e([f({dispose:!0})],R.prototype,"occlusionTexture",void 0),e([f({dispose:!0})],R.prototype,"normalTexture",void 0),e([f()],R.prototype,"objectOpacity",void 0),e([b()],R.prototype,"commonMaterialParameters",void 0),e([b()],R.prototype,"componentParameters",void 0),e([f()],R.prototype,"textureAlphaCutoff",void 0),e([f()],R.prototype,"alphaDiscardMode",void 0),e([f()],R.prototype,"isIntegratedMesh",void 0),e([f()],R.prototype,"polygonOffsetEnabled",void 0),e([f()],R.prototype,"ellipsoidMode",void 0),e([f()],R.prototype,"hasOccludees",void 0),function(e){e[e.Opaque=0]="Opaque",e[e.Transparent=1]="Transparent",e[e.OpaqueAndTransparent=2]="OpaqueAndTransparent",e[e.IntegratedMesh=3]="IntegratedMesh"}(F||(F={}));class W extends T{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=N.Back,this.hasSlicePlane=!0}}e([f()],W.prototype,"doubleSided",void 0),e([f()],W.prototype,"cullFace",void 0),e([f()],W.prototype,"hasSlicePlane",void 0);class _ extends T{constructor(){super(...arguments),this.externalColor=u(1,1,1,1),this.externalColorMixMode=h.Multiply,this.castShadows=I.All}get transparent(){return this.externalColor[3]<1?I.All:I.None}get opaqueOverride(){return this.externalColorMixMode===h.Replace&&1===this.externalColor[3]?I.All:I.None}get visible(){return this.externalColor[3]>0?I.All:I.None}get type(){return g.Uniform}}e([f({vectorOps:n})],_.prototype,"externalColor",void 0),e([f()],_.prototype,"externalColorMixMode",void 0),e([f()],_.prototype,"castShadows",void 0),function(e){e[e.All=0]="All",e[e.Some=1]="Some",e[e.None=2]="None"}(I||(I={}));class E extends T{constructor(){super(...arguments),this.texture=null,this.transparent=I.None,this.opaqueOverride=I.None,this.castShadows=I.None}get type(){return g.Varying}}function k(e){return null!=e.overlay?.getTexture(p.Highlight)}function B(e){return null!=e.overlay?.getTexture(p.WaterNormal)}function L(e){return null!=e.overlay?.getTexture(p.ColorNoRasterImage)}e([f()],E.prototype,"texture",void 0),e([f()],E.prototype,"transparent",void 0),e([f()],E.prototype,"opaqueOverride",void 0),e([f()],E.prototype,"castShadows",void 0);export{W as CommonMaterialParameters,R as ComponentMaterial,I as ComponentParameterSummary,_ as ComponentParametersUniform,E as ComponentParametersVarying};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{c as t,
|
|
5
|
+
import{c as t,z as s,g as i,h as r}from"../../../../../chunks/vec32.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";class e{constructor(t){this._low=o(),this._high=o(),t&&this.set(t)}get low(){return this._low}get high(){return this._high}set(i){t(this._low,t(c,i));const r=s(c,i,this._low);t(this._high,r)}get(t){return i(t,this._low,this._high)}getLowScaled(t){return r(t,this._low,1)}}const c=h();export{e as TwoVectorPosition};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Logger.js";import o from"../../../../core/PooledArray.js";import{hasFeatureFlagWebGLDebug as s}from"../../../webgl/checkWebGLError.js";class r{constructor(e){this._context=e,this._nodes=new o}destroy(){this._nodes.forEach((e=>e.destroy())),this._nodes.clear()}add(e){this._nodes.push(e),s&&console.log(`Registered render nodes: ${this._nodes.map((({declaredClass:e})=>e)).join(", ")}`)}remove(e){this._nodes.remove(e),s&&console.log(`Registered render nodes: ${this._nodes.map((({declaredClass:e})=>e)).join(", ")}`)}produces(e){return this._nodes.some((({produces:o})=>o===e))}require(e,o){return
|
|
5
|
+
import e from"../../../../core/Logger.js";import o from"../../../../core/PooledArray.js";import{hasFeatureFlagWebGLDebug as s}from"../../../webgl/checkWebGLError.js";class r{constructor(e){this._context=e,this._nodes=new o}destroy(){this._nodes.forEach((e=>e.destroy())),this._nodes.clear()}add(e){this._nodes.push(e),s&&console.log(`Registered render nodes: ${this._nodes.map((({declaredClass:e})=>e)).join(", ")}`)}remove(e){this._nodes.remove(e),s&&console.log(`Registered render nodes: ${this._nodes.map((({declaredClass:e})=>e)).join(", ")}`)}produces(e){return this._nodes.some((({produces:o})=>o===e))}require(e,o){return this._nodes.reduce(((s,{consumes:r,produces:t})=>s+(r.required.includes(e)&&t===o?1:0)),0)}optional(e,o){return this._nodes.reduce(((s,{consumes:r,produces:t})=>s+(r.optional?.includes(e)&&t===o?1:0)),0)}updateAnimation(){return this._nodes.reduce(((e,o)=>o.updateAnimation()||e),!1)}render(o,s,r){const t=o.name,n=this._nodes.filter((({produces:e})=>e===t));return 0===n.length||(n.forEach((n=>{const c=[o];for(const e of n.consumes.required){if(e===t)continue;const o=s.get(e);if(!o)return void r(c);c.push(o)}if(n.consumes.optional)for(const e of n.consumes.optional){if(e===t)continue;const o=s.get(e);o&&c.push(o)}try{const e=n.doRender(c,this._context);e&&e!==o&&(o.release(),o=e,s.set(t,o))}catch(d){e.getLogger(n).errorOnce(d)}r(c)})),this._context.rctx.enforceState()),o}}export{r as RenderNodes};
|
|
@@ -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{unitRGBAFromColor as e}from"../../../../../core/colorUtils.js";import{smoothstep as i,clamp as s}from"../../../../../core/mathUtils.js";import{watch as a,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{n as c,s as n,
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as e}from"../../../../../core/colorUtils.js";import{smoothstep as i,clamp as s}from"../../../../../core/mathUtils.js";import{watch as a,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{n as c,s as n,k as p}from"../../../../../chunks/vec32.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as m}from"../../../../ViewingMode.js";import{SyncRenderPlugin as l,ConsumesHighlight as _}from"../RenderPlugin.js";import{defaultShadowOpacity as u,defaultShadowDifference as g,defaultShadowColor as f}from"./HighlightDefaults.js";import{ShadowHighlightPassParameters as w,ShadowHighlightTechnique as y}from"./ShadowHighlightTechnique.js";import{RenderSlot as x}from"../../lib/RenderSlot.js";const O=.001953125,b=4e4,v=5e4;let P=class extends l{constructor(t){super(t),this._maxOpacity=1,this._passParameters=new w,this._shadowDifference=.2,this._context=null,this.produces=new Map([[x.SHADOW_HIGHLIGHT,()=>this._isVisible]])}consumes(){return _}initializeRenderContext(t){this._context=t,this.addHandles([a((()=>this.view.highlightOptions.shadowOpacity),(t=>{this._passParameters.shadowOpacity=t??u,this._updateOccludedShadowOpacity(),this._updateMaxOpacity()}),r),a((()=>this.view.highlightOptions.shadowDifference),(t=>{this._shadowDifference=t??g,this._updateOccludedShadowOpacity(),this._updateMaxOpacity()}),r),a((()=>this.view.highlightOptions.shadowColor),(t=>{this._passParameters.shadowColor=e(t??f),this._updateMaxOpacity()}),r)])}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_updateMaxOpacity(){const t=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=t*this._passParameters.shadowColor[3]}uninitializeRenderContext(){this._context=null}enable(){this._context&&null==this._technique&&(this._technique=this._context.techniqueRepository.acquire(y))}renderNode(t,e,i,s){const a=i?.get("highlights")?.getTexture();if(!this._context||!a||!this._isVisible)return;if(!this._technique?.compiled)return void this._context.requestRender();const r=t.bindParameters;if(!r.shadowMap.enabled||!r.linearDepth)return;this._passParameters.highlight=a,this._passParameters.origin=r.camera.center;const o=t.rctx;o.bindFramebuffer(s?.fbo),o.bindTechnique(this._technique,r,this._passParameters),o.screen.draw()}updateParameters(t,e){this._passParameters.opacityElevation=1-i(b,v,t.relativeElevation);const a=this.viewingMode===m.Global?c(j,t.center):n(j,0,0,1),r=p(a,e);this._passParameters.dayNightTerminator=i(0,1,s(30*r,0,1)),this._isVisible&&this.enable()}get _isVisible(){const{opacityElevation:t,dayNightTerminator:e}=this._passParameters;return this._maxOpacity*t*e>=O}};t([o()],P.prototype,"_context",void 0),t([o()],P.prototype,"view",void 0),t([o()],P.prototype,"viewingMode",void 0),P=t([h("esri.views.3d.webgl-engine.effects.highlight.ShadowHighlight")],P);const j=d();export{P as ShadowHighlight};
|
|
@@ -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 i from"../../../../core/PooledArray.js";import{
|
|
5
|
+
import i from"../../../../core/PooledArray.js";import{m as t,a as e}from"../../../../chunks/vec32.js";import{fromValues as s,clone as r,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{assert as h}from"./Util.js";class o{constructor(i,e,o){this.primitiveIndices=i,this._numIndexPerPrimitive=e,this.position=o,this._children=void 0,h(i.length>=1),h(3===o.size||4===o.size);const{data:c,size:l,indices:m}=o;h(m.length%this._numIndexPerPrimitive==0),h(m.length>=i.length*this._numIndexPerPrimitive);const d=i.length;let u=l*m[this._numIndexPerPrimitive*i[0]];a.clear(),a.push(u);const f=s(c[u],c[u+1],c[u+2]),x=r(f);for(let t=0;t<d;++t){const e=this._numIndexPerPrimitive*i[t];for(let i=0;i<this._numIndexPerPrimitive;++i){u=l*m[e+i],a.push(u);let t=c[u];f[0]=Math.min(t,f[0]),x[0]=Math.max(t,x[0]),t=c[u+1],f[1]=Math.min(t,f[1]),x[1]=Math.max(t,x[1]),t=c[u+2],f[2]=Math.min(t,f[2]),x[2]=Math.max(t,x[2])}}this.bbMin=f,this.bbMax=x;const P=t(n(),this.bbMin,this.bbMax,.5);this.radius=.5*Math.max(Math.max(x[0]-f[0],x[1]-f[1]),x[2]-f[2]);let v=this.radius*this.radius;for(let t=0;t<a.length;++t){u=a.at(t);const i=c[u]-P[0],e=c[u+1]-P[1],s=c[u+2]-P[2],r=i*i+e*e+s*s;if(r<=v)continue;const n=Math.sqrt(r),h=.5*(n-this.radius);this.radius=this.radius+h,v=this.radius*this.radius;const o=h/n;P[0]+=i*o,P[1]+=e*o,P[2]+=s*o}this.center=P,a.clear()}getChildren(){if(this._children||e(this.bbMin,this.bbMax)<=1)return this._children;const i=t(n(),this.bbMin,this.bbMax,.5),s=this.primitiveIndices.length,r=new Uint8Array(s),h=new Array(8);for(let t=0;t<8;++t)h[t]=0;const{data:a,size:c,indices:l}=this.position;for(let t=0;t<s;++t){let e=0;const s=this._numIndexPerPrimitive*this.primitiveIndices[t];let n=c*l[s],o=a[n],m=a[n+1],d=a[n+2];for(let i=1;i<this._numIndexPerPrimitive;++i){n=c*l[s+i];const t=a[n],e=a[n+1],r=a[n+2];t<o&&(o=t),e<m&&(m=e),r<d&&(d=r)}o<i[0]&&(e|=1),m<i[1]&&(e|=2),d<i[2]&&(e|=4),r[t]=e,++h[e]}let m=0;for(let t=0;t<8;++t)h[t]>0&&++m;if(m<2)return;const d=new Array(8);for(let t=0;t<8;++t)d[t]=h[t]>0?new Uint32Array(h[t]):void 0;for(let t=0;t<8;++t)h[t]=0;for(let t=0;t<s;++t){const i=r[t];d[i][h[i]++]=this.primitiveIndices[t]}this._children=new Array;for(let t=0;t<8;++t)void 0!==d[t]&&this._children.push(new o(d[t],this._numIndexPerPrimitive,this.position));return this._children}static prune(){a.prune()}}const a=new i({deallocator:null});export{o as BoundingInfo};
|
|
@@ -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 i from"../../../../core/Accessor.js";import e from"../../../../core/Logger.js";import{lerp as r}from"../../../../core/mathUtils.js";import{createScreenPointArray as s,createRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{copy as a,multiply as p,frustum as u,equals as _,invert as l,transpose as c,lookAt as v}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as w}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as d,exactEquals as y}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{f as m,s as f,p as x,c as M,i as T,y as D,j,w as R,v as P,h as F,l as O,b as V,n as C,D as b}from"../../../../chunks/vec32.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d as I,e as E,a as L,c as H,f as G,t as B}from"../../../../chunks/vec42.js";import{fromValues as A,create as U}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as k,copy as z,fromMatrix as W}from"../../../../geometry/support/frustum.js";import{create as X}from"../../../../geometry/support/ray.js";import{projectPointSignedLength as Y}from"../../../../geometry/support/vector.js";import{ViewingMode as q}from"../../../ViewingMode.js";import{fovd2fovx as N,fovx2fovd as J,fovd2fovy as K,fovy2fovd as Q}from"./fov.js";var Z;let $=Z=class extends i{constructor(t){super(t),this._ray=X(),this._viewport=A(0,0,1,1),this._padding=A(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=g(1,1e3),this._viewDirty=!0,this._viewMatrix=w(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=w(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=w(),this._frustumDirty=!0,this._frustum=k(),this._fullViewport=U(),this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=S(),this._up=S(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get rows(){return this._rows}set rows(t){this._rows=Math.max(1,t)}get columns(){return this._columns}set columns(t){this._columns=Math.max(1,t)}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin)}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return m(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){a(this._viewMatrix,t),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get viewForward(){return this._ensureViewClean(),f(S(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),f(S(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),f(S(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const t=I(U(),this._viewport,1/this.pixelRatio),i=this._get("screenViewport");return i&&E(t,i)?i:t}get screenPadding(){if(1===this.pixelRatio)return this._padding;const t=I(U(),this._padding,1/this.pixelRatio),i=this._get("screenPadding");return i&&E(t,i)?i:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[ot.LEFT],this._viewport[0]!==t&&(this._viewport[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[ot.BOTTOM],this._viewport[1]!==t&&(this._viewport[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[ot.RIGHT]+this._padding[ot.LEFT]}set fullWidth(t){this.width=t-(this._padding[ot.RIGHT]+this._padding[ot.LEFT])}get fullHeight(){return this._viewport[3]+this._padding[ot.TOP]+this._padding[ot.BOTTOM]}set fullHeight(t){this.height=t-(this._padding[ot.TOP]+this._padding[ot.BOTTOM])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[ot.LEFT],this._fullViewport[1]=this._viewport[1]-this._padding[ot.BOTTOM],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){L(this._padding,t)||(this._viewport[0]+=t[ot.LEFT]-this._padding[ot.LEFT],this._viewport[1]+=t[ot.BOTTOM]-this._padding[ot.BOTTOM],this._viewport[2]-=t[ot.RIGHT]+t[ot.LEFT]-(this._padding[ot.RIGHT]+this._padding[ot.LEFT]),this._viewport[3]-=t[ot.TOP]+t[ot.BOTTOM]-(this._padding[ot.TOP]+this._padding[ot.BOTTOM]),H(this._padding,t),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(p(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){const t=this.width,i=this.height,e=this.near*Math.tan(this.fovY/2)*2,r=e*this._aspect,s=e/this.rows,o=r/this.columns,n=-r/2+this.column*o,h=n+o,a=-e/2+this.row*s,p=a+s,l=u(w(),n*(1+2*this._padding[ot.LEFT]/t),h*(1+2*this._padding[ot.RIGHT]/t),a*(1+2*this._padding[ot.BOTTOM]/i),p*(1+2*this._padding[ot.TOP]/i),this.near,this.far),c=this._get("projectionMatrix");return c&&_(c,l)?c:l}get inverseProjectionMatrix(){return l(w(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||w()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return N(this._fov,this.width,this.height)}set fovX(t){this._fov=J(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return K(this._fov,this.width,this.height)}set fovY(t){this._fov=Q(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return x(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(l(this._viewInverseTransposeMatrix,this.viewMatrix),c(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const i=2*t-1;return 2*this.near*this.far/(this.far+this.near-i*(this.far-this.near))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}copyFrom(t){M(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,H(this._viewport,t.viewport),this.notifyChange("_viewport"),H(this._padding,t.padding),this.notifyChange("_padding"),d(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.row=t.row,this.column=t.column,this.rows=t.rows,this.columns=t.columns,this.relativeElevation=t.relativeElevation;const i=t;return this._viewDirty=i._viewDirty,this._viewDirty||(a(this._viewMatrix,t.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=i._frustumDirty,this._frustumDirty||(z(this._frustum,t.frustum),this._frustumDirty=!1),i._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(a(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),H(this._fullViewport,t.fullViewport),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up}clone(){return(new Z).copyFrom(this)}equals(t){return T(this.eye,t.eye)&&T(this.center,t.center)&&T(this.up,t.up)&&L(this._viewport,t.viewport)&&L(this._padding,t.padding)&&y(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation&&this.row===t.row&&this.column===t.column&&this.rows===t.rows&&this.columns===t.columns}almostEquals(t){const i=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||G(t.screenPadding,this.screenPadding)>=i||G(this.screenViewport,t.screenViewport)>=i||this.row!==t.row||this.column!==t.column||this.rows!==t.rows||this.columns!==t.columns)return!1;D(et,t.eye,t.center),D(rt,this.eye,this.center);const e=j(et,rt),r=R(et),s=R(rt),o=5e-4;return e*e>=(1-1e-10)*r*s&&P(t.eye,this.eye)<Math.max(r,s)*o*o}computeRenderPixelSizeAt(t){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(t))}computeRenderPixelSizeAtDist(t){return t*this.perRenderPixelRatio}computeScreenPixelSizeAt(t){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(t))}_viewDirectionDistance(t){return Math.abs(Y(this.viewForward,m(et,t,this.eye)))}computeScreenPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeDistanceFromRadius(t,i){return t/Math.tan(Math.min(this.fovX,this.fovY)/(2*(i||1)))}getScreenCenter(t=s()){return t[0]=(this.padding[ot.LEFT]+this.width/2)/this.pixelRatio,t[1]=(this.padding[ot.TOP]+this.height/2)/this.pixelRatio,t}getRenderCenter(t,i=.5,e=.5){return t[0]=this.padding[ot.LEFT]+this.width*i,t[1]=this.padding[ot.BOTTOM]+this.height*e,t[2]=.5,t}setGLViewport(t){const i=this.viewport,e=this.padding;t.setViewport(i[0]-e[3],i[1]-e[2],i[2]+e[1]+e[3],i[3]+e[0]+e[2])}applyProjection(t,i){t!==tt&&M(tt,t),tt[3]=1,B(tt,tt,this.projectionMatrix);const e=Math.abs(tt[3]);F(tt,tt,1/e);const s=this.fullViewport;i[0]=r(0,s[0]+s[2],.5+.5*tt[0]),i[1]=r(0,s[1]+s[3],.5+.5*tt[1]),i[2]=.5*(tt[2]+1),i[3]=e}unapplyProjection(t,i){const e=this.fullViewport;tt[0]=(t[0]/(e[0]+e[2])*2-1)*t[3],tt[1]=(t[1]/(e[1]+e[3])*2-1)*t[3],tt[2]=(2*t[2]-1)*t[3],tt[3]=t[3],null!=this.inverseProjectionMatrix&&(B(tt,tt,this.inverseProjectionMatrix),i[0]=tt[0],i[1]=tt[1],i[2]=tt[2])}projectToScreen(t,i){return this.projectToRenderScreen(t,st),this.renderToScreen(st,i),i}projectToRenderScreen(t,i){if(tt[0]=t[0],tt[1]=t[1],tt[2]=t[2],tt[3]=1,B(tt,tt,this.viewProjectionMatrix),0===tt[3])return null;const e=tt;F(e,e,1/Math.abs(tt[3]));const s=this.fullViewport,o=r(0,s[0]+s[2],.5+.5*e[0]),n=r(0,s[1]+s[3],.5+.5*e[1]);return"x"in i?(i.x=o,i.y=n):(i[0]=o,i[1]=n,i.length>2&&(i[2]=.5*(e[2]+1))),i}unprojectFromScreen(t,i){return this.unprojectFromRenderScreen(this.screenToRender(t,st),i)}unprojectFromRenderScreen(t,i){if(p(it,this.projectionMatrix,this.viewMatrix),!l(it,it))return null;const e=this.fullViewport;return tt[0]=2*(t[0]-e[0])/e[2]-1,tt[1]=2*(t[1]-e[1])/e[3]-1,tt[2]=2*t[2]-1,tt[3]=1,B(tt,tt,it),0===tt[3]?null:(i[0]=tt[0]/tt[3],i[1]=tt[1]/tt[3],i[2]=tt[2]/tt[3],i)}constrainWindowSize(t,i,e,r){const s=t*this.pixelRatio,o=i*this.pixelRatio,n=Math.max(s-e/2,0),h=Math.max(this.fullHeight-o-r/2,0),a=-Math.min(s-e/2,0),p=-Math.min(this.fullHeight-o-r/2,0),u=e-a- -Math.min(this.fullWidth-s-e/2,0),_=r-p- -Math.min(o-r/2,0);return[Math.round(n),Math.round(h),Math.round(u),Math.round(_)]}computeUp(t){t===q.Global?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,i){const e=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return i[0]=e,i[1]=r,i}renderToScreen(t,i){const e=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;i[0]=e,i[1]=r}_computeUpGlobal(){m(et,this.center,this.eye);const t=O(this.center);t<1?(f(this._up,0,0,1),this._markViewDirty(),this.notifyChange("_up")):Math.abs(j(et,this.center))>.9999*O(et)*t||(V(this._up,et,this.center),V(this._up,this._up,et),C(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_computeUpLocal(){b(et,this.eye,this.center),Math.abs(et[2])<=.9999&&(F(et,et,et[2]),f(this._up,-et[0],-et[1],1-et[2]),C(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_compareAndSetView(t,i,r=""){"number"==typeof t[0]&&isFinite(t[0])&&"number"==typeof t[1]&&isFinite(t[1])&&"number"==typeof t[2]&&isFinite(t[2])?T(t,i)||(M(i,t),this._markViewDirty(),r.length&&this.notifyChange(r)):e.getLogger("esri.views.3d.webgl-engine.lib.Camera").warn("Camera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(W(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(v(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};t([n()],$.prototype,"_viewport",void 0),t([n()],$.prototype,"_padding",void 0),t([n()],$.prototype,"_fov",void 0),t([n()],$.prototype,"_nearFar",void 0),t([n()],$.prototype,"_viewDirty",void 0),t([n()],$.prototype,"_viewMatrix",void 0),t([n()],$.prototype,"_pixelRatio",void 0),t([n()],$.prototype,"pixelRatio",null),t([n()],$.prototype,"row",void 0),t([n()],$.prototype,"column",void 0),t([n()],$.prototype,"_rows",void 0),t([n()],$.prototype,"rows",null),t([n()],$.prototype,"_columns",void 0),t([n()],$.prototype,"columns",null),t([n()],$.prototype,"eye",null),t([n()],$.prototype,"center",null),t([n()],$.prototype,"_center",void 0),t([n()],$.prototype,"up",null),t([n()],$.prototype,"_up",void 0),t([n({readOnly:!0})],$.prototype,"viewForward",null),t([n({readOnly:!0})],$.prototype,"viewUp",null),t([n({readOnly:!0})],$.prototype,"viewRight",null),t([n({readOnly:!0})],$.prototype,"nearFar",null),t([n()],$.prototype,"near",null),t([n()],$.prototype,"far",null),t([n()],$.prototype,"viewport",null),t([n({readOnly:!0})],$.prototype,"screenViewport",null),t([n({readOnly:!0})],$.prototype,"screenPadding",null),t([n()],$.prototype,"x",null),t([n()],$.prototype,"y",null),t([n()],$.prototype,"width",null),t([n()],$.prototype,"height",null),t([n()],$.prototype,"fullWidth",null),t([n()],$.prototype,"fullHeight",null),t([n({readOnly:!0})],$.prototype,"_aspect",null),t([n()],$.prototype,"padding",null),t([n({readOnly:!0})],$.prototype,"projectionMatrix",null),t([n({readOnly:!0})],$.prototype,"inverseProjectionMatrix",null),t([n()],$.prototype,"fov",null),t([n()],$.prototype,"fovX",null),t([n()],$.prototype,"fovY",null),$=Z=t([h("esri.views.3d.webgl-engine.lib.Camera")],$);const tt=U(),it=w(),et=S(),rt=S(),st=o();var ot;!function(t){t[t.TOP=0]="TOP",t[t.RIGHT=1]="RIGHT",t[t.BOTTOM=2]="BOTTOM",t[t.LEFT=3]="LEFT"}(ot||(ot={}));export{$ as Camera,ot as PaddingSide};
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import i from"../../../../core/Accessor.js";import e from"../../../../core/Logger.js";import{lerp as r}from"../../../../core/mathUtils.js";import{createScreenPointArray as s,createRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{copy as a,multiply as p,frustum as u,equals as _,invert as l,transpose as c,lookAt as v}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as w}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as d,exactEquals as y}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{f as m,s as f,q as x,c as M,j as T,z as D,k as j,x as R,w as P,h as F,l as O,b as V,n as C,E as b}from"../../../../chunks/vec32.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d as I,e as E,a as L,c as H,f as G,t as B}from"../../../../chunks/vec42.js";import{fromValues as A,create as k}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as U,copy as z,fromMatrix as W}from"../../../../geometry/support/frustum.js";import{create as q}from"../../../../geometry/support/ray.js";import{projectPointSignedLength as X}from"../../../../geometry/support/vector.js";import{ViewingMode as Y}from"../../../ViewingMode.js";import{fovd2fovx as N,fovx2fovd as J,fovd2fovy as K,fovy2fovd as Q}from"./fov.js";var Z;let $=Z=class extends i{constructor(t){super(t),this._ray=q(),this._viewport=A(0,0,1,1),this._padding=A(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=g(1,1e3),this._viewDirty=!0,this._viewMatrix=w(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=w(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=w(),this._frustumDirty=!0,this._frustum=U(),this._fullViewport=k(),this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=S(),this._up=S(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get rows(){return this._rows}set rows(t){this._rows=Math.max(1,t)}get columns(){return this._columns}set columns(t){this._columns=Math.max(1,t)}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin)}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return m(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){a(this._viewMatrix,t),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get viewForward(){return this._ensureViewClean(),f(S(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),f(S(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),f(S(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const t=I(k(),this._viewport,1/this.pixelRatio),i=this._get("screenViewport");return i&&E(t,i)?i:t}get screenPadding(){if(1===this.pixelRatio)return this._padding;const t=I(k(),this._padding,1/this.pixelRatio),i=this._get("screenPadding");return i&&E(t,i)?i:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[ot.LEFT],this._viewport[0]!==t&&(this._viewport[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[ot.BOTTOM],this._viewport[1]!==t&&(this._viewport[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[ot.RIGHT]+this._padding[ot.LEFT]}set fullWidth(t){this.width=t-(this._padding[ot.RIGHT]+this._padding[ot.LEFT])}get fullHeight(){return this._viewport[3]+this._padding[ot.TOP]+this._padding[ot.BOTTOM]}set fullHeight(t){this.height=t-(this._padding[ot.TOP]+this._padding[ot.BOTTOM])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[ot.LEFT],this._fullViewport[1]=this._viewport[1]-this._padding[ot.BOTTOM],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){L(this._padding,t)||(this._viewport[0]+=t[ot.LEFT]-this._padding[ot.LEFT],this._viewport[1]+=t[ot.BOTTOM]-this._padding[ot.BOTTOM],this._viewport[2]-=t[ot.RIGHT]+t[ot.LEFT]-(this._padding[ot.RIGHT]+this._padding[ot.LEFT]),this._viewport[3]-=t[ot.TOP]+t[ot.BOTTOM]-(this._padding[ot.TOP]+this._padding[ot.BOTTOM]),H(this._padding,t),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(p(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){const t=this.width,i=this.height,e=this.near*Math.tan(this.fovY/2)*2,r=e*this._aspect,s=e/this.rows,o=r/this.columns,n=-r/2+this.column*o,h=n+o,a=-e/2+this.row*s,p=a+s,l=u(w(),n*(1+2*this._padding[ot.LEFT]/t),h*(1+2*this._padding[ot.RIGHT]/t),a*(1+2*this._padding[ot.BOTTOM]/i),p*(1+2*this._padding[ot.TOP]/i),this.near,this.far),c=this._get("projectionMatrix");return c&&_(c,l)?c:l}get inverseProjectionMatrix(){return l(w(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||w()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return N(this._fov,this.width,this.height)}set fovX(t){this._fov=J(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return K(this._fov,this.width,this.height)}set fovY(t){this._fov=Q(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return x(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(l(this._viewInverseTransposeMatrix,this.viewMatrix),c(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const i=2*t-1;return 2*this.near*this.far/(this.far+this.near-i*(this.far-this.near))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}copyFrom(t){M(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,H(this._viewport,t.viewport),this.notifyChange("_viewport"),H(this._padding,t.padding),this.notifyChange("_padding"),d(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.row=t.row,this.column=t.column,this.rows=t.rows,this.columns=t.columns,this.relativeElevation=t.relativeElevation;const i=t;return this._viewDirty=i._viewDirty,this._viewDirty||(a(this._viewMatrix,t.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=i._frustumDirty,this._frustumDirty||(z(this._frustum,t.frustum),this._frustumDirty=!1),i._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(a(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),H(this._fullViewport,t.fullViewport),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up}clone(){return(new Z).copyFrom(this)}equals(t){return T(this.eye,t.eye)&&T(this.center,t.center)&&T(this.up,t.up)&&L(this._viewport,t.viewport)&&L(this._padding,t.padding)&&y(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation&&this.row===t.row&&this.column===t.column&&this.rows===t.rows&&this.columns===t.columns}almostEquals(t){const i=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||G(t.screenPadding,this.screenPadding)>=i||G(this.screenViewport,t.screenViewport)>=i||this.row!==t.row||this.column!==t.column||this.rows!==t.rows||this.columns!==t.columns)return!1;D(et,t.eye,t.center),D(rt,this.eye,this.center);const e=j(et,rt),r=R(et),s=R(rt),o=5e-4;return e*e>=(1-1e-10)*r*s&&P(t.eye,this.eye)<Math.max(r,s)*o*o}computeRenderPixelSizeAt(t){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(t))}computeRenderPixelSizeAtDist(t){return t*this.perRenderPixelRatio}computeScreenPixelSizeAt(t){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(t))}_viewDirectionDistance(t){return Math.abs(X(this.viewForward,m(et,t,this.eye)))}computeScreenPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeDistanceFromRadius(t,i){return t/Math.tan(Math.min(this.fovX,this.fovY)/(2*(i||1)))}getScreenCenter(t=s()){return t[0]=(this.padding[ot.LEFT]+this.width/2)/this.pixelRatio,t[1]=(this.padding[ot.TOP]+this.height/2)/this.pixelRatio,t}getRenderCenter(t,i=.5,e=.5){return t[0]=this.padding[ot.LEFT]+this.width*i,t[1]=this.padding[ot.BOTTOM]+this.height*e,t[2]=.5,t}setGLViewport(t){const i=this.viewport,e=this.padding;t.setViewport(i[0]-e[3],i[1]-e[2],i[2]+e[1]+e[3],i[3]+e[0]+e[2])}applyProjection(t,i){t!==tt&&M(tt,t),tt[3]=1,B(tt,tt,this.projectionMatrix);const e=Math.abs(tt[3]);F(tt,tt,1/e);const s=this.fullViewport;i[0]=r(0,s[0]+s[2],.5+.5*tt[0]),i[1]=r(0,s[1]+s[3],.5+.5*tt[1]),i[2]=.5*(tt[2]+1),i[3]=e}unapplyProjection(t,i){const e=this.fullViewport;tt[0]=(t[0]/(e[0]+e[2])*2-1)*t[3],tt[1]=(t[1]/(e[1]+e[3])*2-1)*t[3],tt[2]=(2*t[2]-1)*t[3],tt[3]=t[3],null!=this.inverseProjectionMatrix&&(B(tt,tt,this.inverseProjectionMatrix),i[0]=tt[0],i[1]=tt[1],i[2]=tt[2])}projectToScreen(t,i){return this.projectToRenderScreen(t,st),this.renderToScreen(st,i),i}projectToRenderScreen(t,i){if(tt[0]=t[0],tt[1]=t[1],tt[2]=t[2],tt[3]=1,B(tt,tt,this.viewProjectionMatrix),0===tt[3])return null;const e=tt;F(e,e,1/Math.abs(tt[3]));const s=this.fullViewport,o=r(0,s[0]+s[2],.5+.5*e[0]),n=r(0,s[1]+s[3],.5+.5*e[1]);return"x"in i?(i.x=o,i.y=n):(i[0]=o,i[1]=n,i.length>2&&(i[2]=.5*(e[2]+1))),i}unprojectFromScreen(t,i){return this.unprojectFromRenderScreen(this.screenToRender(t,st),i)}unprojectFromRenderScreen(t,i){if(p(it,this.projectionMatrix,this.viewMatrix),!l(it,it))return null;const e=this.fullViewport;return tt[0]=2*(t[0]-e[0])/e[2]-1,tt[1]=2*(t[1]-e[1])/e[3]-1,tt[2]=2*t[2]-1,tt[3]=1,B(tt,tt,it),0===tt[3]?null:(i[0]=tt[0]/tt[3],i[1]=tt[1]/tt[3],i[2]=tt[2]/tt[3],i)}constrainWindowSize(t,i,e,r){const s=t*this.pixelRatio,o=i*this.pixelRatio,n=Math.max(s-e/2,0),h=Math.max(this.fullHeight-o-r/2,0),a=-Math.min(s-e/2,0),p=-Math.min(this.fullHeight-o-r/2,0),u=e-a- -Math.min(this.fullWidth-s-e/2,0),_=r-p- -Math.min(o-r/2,0);return[Math.round(n),Math.round(h),Math.round(u),Math.round(_)]}computeUp(t){t===Y.Global?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,i){const e=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return i[0]=e,i[1]=r,i}renderToScreen(t,i){const e=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;i[0]=e,i[1]=r}_computeUpGlobal(){m(et,this.center,this.eye);const t=O(this.center);t<1?(f(this._up,0,0,1),this._markViewDirty(),this.notifyChange("_up")):Math.abs(j(et,this.center))>.9999*O(et)*t||(V(this._up,et,this.center),V(this._up,this._up,et),C(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_computeUpLocal(){b(et,this.eye,this.center),Math.abs(et[2])<=.9999&&(F(et,et,et[2]),f(this._up,-et[0],-et[1],1-et[2]),C(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_compareAndSetView(t,i,r=""){"number"==typeof t[0]&&isFinite(t[0])&&"number"==typeof t[1]&&isFinite(t[1])&&"number"==typeof t[2]&&isFinite(t[2])?T(t,i)||(M(i,t),this._markViewDirty(),r.length&&this.notifyChange(r)):e.getLogger("esri.views.3d.webgl-engine.lib.Camera").warn("Camera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(W(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(v(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};t([n()],$.prototype,"_viewport",void 0),t([n()],$.prototype,"_padding",void 0),t([n()],$.prototype,"_fov",void 0),t([n()],$.prototype,"_nearFar",void 0),t([n()],$.prototype,"_viewDirty",void 0),t([n()],$.prototype,"_viewMatrix",void 0),t([n()],$.prototype,"_pixelRatio",void 0),t([n()],$.prototype,"pixelRatio",null),t([n()],$.prototype,"row",void 0),t([n()],$.prototype,"column",void 0),t([n()],$.prototype,"_rows",void 0),t([n()],$.prototype,"rows",null),t([n()],$.prototype,"_columns",void 0),t([n()],$.prototype,"columns",null),t([n()],$.prototype,"eye",null),t([n()],$.prototype,"center",null),t([n()],$.prototype,"_center",void 0),t([n()],$.prototype,"up",null),t([n()],$.prototype,"_up",void 0),t([n({readOnly:!0})],$.prototype,"viewForward",null),t([n({readOnly:!0})],$.prototype,"viewUp",null),t([n({readOnly:!0})],$.prototype,"viewRight",null),t([n({readOnly:!0})],$.prototype,"nearFar",null),t([n()],$.prototype,"near",null),t([n()],$.prototype,"far",null),t([n()],$.prototype,"viewport",null),t([n({readOnly:!0})],$.prototype,"screenViewport",null),t([n({readOnly:!0})],$.prototype,"screenPadding",null),t([n()],$.prototype,"x",null),t([n()],$.prototype,"y",null),t([n()],$.prototype,"width",null),t([n()],$.prototype,"height",null),t([n()],$.prototype,"fullWidth",null),t([n()],$.prototype,"fullHeight",null),t([n({readOnly:!0})],$.prototype,"_aspect",null),t([n()],$.prototype,"padding",null),t([n({readOnly:!0})],$.prototype,"projectionMatrix",null),t([n({readOnly:!0})],$.prototype,"inverseProjectionMatrix",null),t([n()],$.prototype,"fov",null),t([n()],$.prototype,"fovX",null),t([n()],$.prototype,"fovY",null),$=Z=t([h("esri.views.3d.webgl-engine.lib.Camera")],$);const tt=k(),it=w(),et=S(),rt=S(),st=o();var ot;!function(t){t[t.TOP=0]="TOP",t[t.RIGHT=1]="RIGHT",t[t.BOTTOM=2]="BOTTOM",t[t.LEFT=3]="LEFT"}(ot||(ot={}));export{$ as Camera,ot as PaddingSide};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{f as n,b as e,n as o,h as s,g as r,j as l,s as h,c as u,e as c}from"../../../../chunks/vec32.js";import{fromValues as a,create as f,clone as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{clone as i,create as g,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as m}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as O,floatArrayFrom as M}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as A,getContinuousIndexArray as I}from"../../../../geometry/support/Indices.js";import{create as y,fromPositionAndNormal as N,intersectRay as P}from"../../../../geometry/support/plane.js";import{wrap as T}from"../../../../geometry/support/ray.js";import{Attribute as S}from"./Attribute.js";import{Vec3Compact as b}from"./BufferVectorMath.js";import{ContentObjectType as R}from"./ContentObjectType.js";import{Geometry as j}from"./Geometry.js";import{assert as L}from"./Util.js";import{VertexAttribute as d}from"./VertexAttribute.js";const E=b,x=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],U=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],V=[0,0,1,0,1,1,0,1],v=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],F=new Array(36);for(let Nt=0;Nt<6;Nt++)for(let t=0;t<6;t++)F[6*Nt+t]=Nt;const C=new Array(36);for(let Nt=0;Nt<6;Nt++)C[6*Nt]=0,C[6*Nt+1]=1,C[6*Nt+2]=2,C[6*Nt+3]=2,C[6*Nt+4]=3,C[6*Nt+5]=0;function G(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(24);for(let o=0;o<8;o++)e[3*o]=x[o][0]*n[0],e[3*o+1]=x[o][1]*n[1],e[3*o+2]=x[o][2]*n[2];return new j(t,[[d.POSITION,new S(e,v,3,!0)],[d.NORMAL,new S(U,F,3)],[d.UV0,new S(V,C,2)]])}const D=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],q=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],B=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],k=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function z(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(18);for(let o=0;o<6;o++)e[3*o]=D[o][0]*n[0],e[3*o+1]=D[o][1]*n[1],e[3*o+2]=D[o][2]*n[2];return new j(t,[[d.POSITION,new S(e,B,3,!0)],[d.NORMAL,new S(q,k,3)]])}const Z=a(-.5,0,-.5),H=a(.5,0,-.5),J=a(0,0,.5),K=a(0,.5,0),Q=f(),W=f(),X=f(),Y=f(),$=f();n(Q,Z,K),n(W,Z,H),e(X,Q,W),o(X,X),n(Q,H,K),n(W,H,J),e(Y,Q,W),o(Y,Y),n(Q,J,K),n(W,J,Z),e($,Q,W),o($,$);const _=[Z,H,J,K],tt=[0,-1,0,X[0],X[1],X[2],Y[0],Y[1],Y[2],$[0],$[1],$[2]],nt=[0,1,2,3,1,0,3,2,1,3,0,2],et=[0,0,0,1,1,1,2,2,2,3,3,3];function ot(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(12);for(let o=0;o<4;o++)e[3*o]=_[o][0]*n[0],e[3*o+1]=_[o][1]*n[1],e[3*o+2]=_[o][2]*n[2];return new j(t,[[d.POSITION,new S(e,nt,3,!0)],[d.NORMAL,new S(tt,et,3)]])}function st(t,n,e,o,s={uv:!0}){const r=-Math.PI,l=2*Math.PI,h=-Math.PI/2,u=Math.PI,c=Math.max(3,Math.floor(e)),a=Math.max(2,Math.floor(o)),f=(c+1)*(a+1),p=O(3*f),i=O(3*f),g=O(2*f),w=[];let m=0;for(let O=0;O<=a;O++){const t=[],e=O/a,o=h+e*u,s=Math.cos(o);for(let h=0;h<=c;h++){const u=h/c,a=r+u*l,f=Math.cos(a)*s,w=Math.sin(o),O=-Math.sin(a)*s;p[3*m]=f*n,p[3*m+1]=w*n,p[3*m+2]=O*n,i[3*m]=f,i[3*m+1]=w,i[3*m+2]=O,g[2*m]=u,g[2*m+1]=e,t.push(m),++m}w.push(t)}const M=new Array;for(let O=0;O<a;O++)for(let t=0;t<c;t++){const n=w[O][t],e=w[O][t+1],o=w[O+1][t+1],s=w[O+1][t];0===O?(M.push(n),M.push(o),M.push(s)):O===a-1?(M.push(n),M.push(e),M.push(o)):(M.push(n),M.push(e),M.push(o),M.push(o),M.push(s),M.push(n))}const I=[[d.POSITION,new S(p,M,3,!0)],[d.NORMAL,new S(i,M,3,!0)]];return s.uv&&I.push([d.UV0,new S(g,M,2,!0)]),s.offset&&(I[0][0]=d.OFFSET,I.push([d.POSITION,new S(Float64Array.from(s.offset),A(M.length),3,!0)])),new j(t,I)}function rt(t,n,e,o){const s=lt(n,e,o);return new j(t,s)}function lt(t,n,e){const o=t;let s,r;if(e)s=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],r=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{const t=o*(1+Math.sqrt(5))/2;s=[-o,t,0,o,t,0,-o,-t,0,o,-t,0,0,-o,t,0,o,t,0,-o,-t,0,o,-t,t,0,-o,t,0,o,-t,0,-o,-t,0,o],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let c=0;c<s.length;c+=3)E.scale(s,c,t/E.length(s,c));let l={};function h(n,e){n>e&&([n,e]=[e,n]);const o=n.toString()+"."+e.toString();if(l[o])return l[o];let r=s.length;return s.length+=3,E.add(s,3*n,s,3*e,s,r),E.scale(s,r,t/E.length(s,r)),r/=3,l[o]=r,r}for(let c=0;c<n;c++){const t=r.length,n=new Array(4*t);for(let e=0;e<t;e+=3){const t=r[e],o=r[e+1],s=r[e+2],l=h(t,o),u=h(o,s),c=h(s,t),a=4*e;n[a]=t,n[a+1]=l,n[a+2]=c,n[a+3]=o,n[a+4]=u,n[a+5]=l,n[a+6]=s,n[a+7]=c,n[a+8]=u,n[a+9]=l,n[a+10]=u,n[a+11]=c}r=n,l={}}const u=M(s);for(let c=0;c<u.length;c+=3)E.normalize(u,c);return[[d.POSITION,new S(M(s),r,3,!0)],[d.NORMAL,new S(u,r,3,!0)]]}function ht(n,e,o,s,r,l,h,u,c=null){const a=o?i(o):g(),f=e?i(e):w(0,0,1);h??=t();const p=s?[255*s[0],255*s[1],255*s[2],s.length>3?255*s[3]:255]:[255,255,255,255],m=null!=r&&2===r.length?r:[1,1],O=A(1),M=[[d.POSITION,new S(a,O,3,!0)],[d.NORMAL,new S(f,O,3,!0)],[d.UV0,new S(h,O,h.length)],[d.COLOR,new S(p,O,4,!0)],[d.SIZE,new S(m,O,2)]];if(null!=l&&(l=[l[0],l[1],l[2],l[3]],M.push([d.CENTEROFFSETANDDISTANCE,new S(l,O,4)])),u){const t=[u[0],u[1],u[2],u[3]];M.push([d.FEATUREATTRIBUTE,new S(t,O,4)])}return new j(n,M,null,R.Point,c)}const ut=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function ct(t,n=ut){const e=new Array(12);for(let c=0;c<4;c++)for(let t=0;t<3;t++)e[3*c+t]=n[c][t];const o=[0,1,2,2,3,0],s=[0,0,1],r=[0,0,0,0,0,0],l=[0,0,1,0,1,1,0,1],h=[255,255,255,255],u=[[d.POSITION,new S(e,o,3,!0)],[d.NORMAL,new S(s,r,3,!0)],[d.UV0,new S(l,o,2,!0)],[d.COLOR,new S(h,r,4,!0)]];return new j(t,u)}function at(t,n,e,o,s,r=!0,l=!0){let h=0;const u=e,c=n;let f=a(0,h,0),p=a(0,h+c,0),i=a(0,-1,0),g=a(0,1,0);s&&(h=c,p=a(0,0,0),f=a(0,h,0),i=a(0,1,0),g=a(0,-1,0));const w=[p,f],m=[i,g],M=o+2,A=Math.sqrt(c*c+u*u);if(s)for(let O=o-1;O>=0;O--){const t=O*(2*Math.PI/o),n=a(Math.cos(t)*u,h,Math.sin(t)*u);w.push(n);const e=a(c*Math.cos(t)/A,-u/A,c*Math.sin(t)/A);m.push(e)}else for(let O=0;O<o;O++){const t=O*(2*Math.PI/o),n=a(Math.cos(t)*u,h,Math.sin(t)*u);w.push(n);const e=a(c*Math.cos(t)/A,u/A,c*Math.sin(t)/A);m.push(e)}const I=new Array,y=new Array;if(r){for(let t=3;t<w.length;t++)I.push(1),I.push(t-1),I.push(t),y.push(0),y.push(0),y.push(0);I.push(w.length-1),I.push(2),I.push(1),y.push(0),y.push(0),y.push(0)}if(l){for(let t=3;t<w.length;t++)I.push(t),I.push(t-1),I.push(0),y.push(t),y.push(t-1),y.push(1);I.push(0),I.push(2),I.push(w.length-1),y.push(1),y.push(2),y.push(m.length-1)}const N=O(3*M);for(let a=0;a<M;a++)N[3*a]=w[a][0],N[3*a+1]=w[a][1],N[3*a+2]=w[a][2];const P=O(3*M);for(let a=0;a<M;a++)P[3*a]=m[a][0],P[3*a+1]=m[a][1],P[3*a+2]=m[a][2];const T=[[d.POSITION,new S(N,I,3,!0)],[d.NORMAL,new S(P,y,3,!0)]];return new j(t,T)}function ft(t,n,u,c,i,g,w){const m=i?p(i):a(1,0,0),M=g?p(g):a(0,0,0);w??=!0;const A=f();o(A,m);const I=f();s(I,A,Math.abs(n));const y=f();s(y,I,-.5),r(y,y,M);const N=a(0,1,0);Math.abs(1-l(A,N))<.2&&h(N,0,0,1);const P=f();e(P,A,N),o(P,P),e(N,P,A);const T=2*c+(w?2:0),b=c+(w?2:0),R=O(3*T),L=O(3*b),E=O(2*T),x=new Array(3*c*(w?4:2)),U=new Array(3*c*(w?4:2));w&&(R[3*(T-2)]=y[0],R[3*(T-2)+1]=y[1],R[3*(T-2)+2]=y[2],E[2*(T-2)]=0,E[2*(T-2)+1]=0,R[3*(T-1)]=R[3*(T-2)]+I[0],R[3*(T-1)+1]=R[3*(T-2)+1]+I[1],R[3*(T-1)+2]=R[3*(T-2)+2]+I[2],E[2*(T-1)]=1,E[2*(T-1)+1]=1,L[3*(b-2)]=-A[0],L[3*(b-2)+1]=-A[1],L[3*(b-2)+2]=-A[2],L[3*(b-1)]=A[0],L[3*(b-1)+1]=A[1],L[3*(b-1)+2]=A[2]);const V=(t,n,e)=>{x[t]=n,U[t]=e};let v=0;const F=f(),C=f();for(let e=0;e<c;e++){const t=e*(2*Math.PI/c);s(F,N,Math.sin(t)),s(C,P,Math.cos(t)),r(F,F,C),L[3*e]=F[0],L[3*e+1]=F[1],L[3*e+2]=F[2],s(F,F,u),r(F,F,y),R[3*e]=F[0],R[3*e+1]=F[1],R[3*e+2]=F[2],E[2*e]=e/c,E[2*e+1]=0,R[3*(e+c)]=R[3*e]+I[0],R[3*(e+c)+1]=R[3*e+1]+I[1],R[3*(e+c)+2]=R[3*e+2]+I[2],E[2*(e+c)]=e/c,E[2*e+1]=1;const n=(e+1)%c;V(v++,e,e),V(v++,e+c,e),V(v++,n,n),V(v++,n,n),V(v++,e+c,e),V(v++,n+c,n)}if(w){for(let t=0;t<c;t++){const n=(t+1)%c;V(v++,T-2,b-2),V(v++,t,b-2),V(v++,n,b-2)}for(let t=0;t<c;t++){const n=(t+1)%c;V(v++,t+c,b-1),V(v++,T-1,b-1),V(v++,n+c,b-1)}}const G=[[d.POSITION,new S(R,x,3,!0)],[d.NORMAL,new S(L,U,3,!0)],[d.UV0,new S(E,x,2,!0)]];return new j(t,G)}function pt(t,n,e,o,s,r){o=o||10,s=null==s||s,L(n.length>1);const l=[[0,0,0]],h=[],u=[];for(let c=0;c<o;c++){h.push([0,-c-1,-(c+1)%o-1]);const t=c/o*2*Math.PI;u.push([Math.cos(t)*e,Math.sin(t)*e])}return it(t,u,n,l,h,s,r)}function it(t,l,c,f,p,i,w=a(0,0,0)){const m=l.length,M=O(c.length*m*3+(6*f.length||0)),A=O(c.length*m*3+(f?6:0)),I=new Array,b=new Array;let R=0,L=0;const E=g(),x=g(),U=g(),V=g(),v=g(),F=g(),C=g(),G=g(),D=g(),q=g(),B=g(),k=g(),z=g(),Z=y();h(D,0,1,0),n(x,c[1],c[0]),o(x,x),i?(r(G,c[0],w),o(U,G)):h(U,0,0,1),At(x,U,D,D,v,U,It),u(V,U),u(k,v);for(let n=0;n<f.length;n++)s(F,v,f[n][0]),s(G,U,f[n][2]),r(F,F,G),r(F,F,c[0]),M[R++]=F[0],M[R++]=F[1],M[R++]=F[2];A[L++]=-x[0],A[L++]=-x[1],A[L++]=-x[2];for(let n=0;n<p.length;n++)I.push(p[n][0]>0?p[n][0]:-p[n][0]-1+f.length),I.push(p[n][1]>0?p[n][1]:-p[n][1]-1+f.length),I.push(p[n][2]>0?p[n][2]:-p[n][2]-1+f.length),b.push(0),b.push(0),b.push(0);let H=f.length;const J=f.length-1;for(let h=0;h<c.length;h++){let t=!1;if(h>0){u(E,x),h<c.length-1?(n(x,c[h+1],c[h]),o(x,x)):t=!0,r(q,E,x),o(q,q),r(B,c[h-1],V),N(c[h],q,Z);P(Z,T(B,E),G)?(n(G,G,c[h]),o(U,G),e(v,q,U),o(v,v)):At(q,V,k,D,v,U,It),u(V,U),u(k,v)}i&&(r(G,c[h],w),o(z,G));for(let n=0;n<m;n++)if(s(F,v,l[n][0]),s(G,U,l[n][1]),r(F,F,G),o(C,F),A[L++]=C[0],A[L++]=C[1],A[L++]=C[2],r(F,F,c[h]),M[R++]=F[0],M[R++]=F[1],M[R++]=F[2],!t){const t=(n+1)%m;I.push(H+n),I.push(H+m+n),I.push(H+t),I.push(H+t),I.push(H+m+n),I.push(H+m+t);for(let n=0;n<6;n++){const t=I.length-6;b.push(I[t+n]-J)}}H+=m}const K=c[c.length-1];for(let n=0;n<f.length;n++)s(F,v,f[n][0]),s(G,U,f[n][1]),r(F,F,G),r(F,F,K),M[R++]=F[0],M[R++]=F[1],M[R++]=F[2];const Q=L/3;A[L++]=x[0],A[L++]=x[1],A[L++]=x[2];const W=H-m;for(let n=0;n<p.length;n++)I.push(p[n][0]>=0?H+p[n][0]:-p[n][0]-1+W),I.push(p[n][2]>=0?H+p[n][2]:-p[n][2]-1+W),I.push(p[n][1]>=0?H+p[n][1]:-p[n][1]-1+W),b.push(Q),b.push(Q),b.push(Q);const X=[[d.POSITION,new S(M,I,3,!0)],[d.NORMAL,new S(A,b,3,!0)]];return new j(t,X)}function gt(t,n,e,o){L(n.length>1,"createPolylineGeometry(): polyline needs at least 2 points"),L(3===n[0].length,"createPolylineGeometry(): malformed vertex"),L(null==e||e.length===n.length,"createPolylineGeometry: need same number of points and normals"),L(null==e||3===e[0].length,"createPolylineGeometry(): malformed normal");const s=m(3*n.length),r=new Array(2*(n.length-1));let l=0,h=0;for(let c=0;c<n.length;c++){for(let t=0;t<3;t++)s[l++]=n[c][t];c>0&&(r[h++]=c-1,r[h++]=c)}const u=[[d.POSITION,new S(s,r,3,!0)]];if(e){const t=O(3*e.length);let o=0;for(let s=0;s<n.length;s++)for(let n=0;n<3;n++)t[o++]=e[s][n];u.push([d.NORMAL,new S(t,r,3,!0)])}return o&&u.push([d.COLOR,new S(o,I(o.length/4),4)]),new j(t,u,null,R.Line)}function wt(t,n,e,o,s,r=0){const l=new Array(18),h=[[-e,r,s/2],[o,r,s/2],[0,n+r,s/2],[-e,r,-s/2],[o,r,-s/2],[0,n+r,-s/2]],u=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let c=0;c<6;c++)l[3*c]=h[c][0],l[3*c+1]=h[c][1],l[3*c+2]=h[c][2];return new j(t,[[d.POSITION,new S(l,u,3,!0)]])}function mt(t,n){const e=t.getMutableAttribute(d.POSITION).data;for(let o=0;o<e.length;o+=3){const t=e[o],s=e[o+1],r=e[o+2];h(yt,t,s,r),c(yt,yt,n),e[o]=yt[0],e[o+1]=yt[1],e[o+2]=yt[2]}}function Ot(t,n=t){const e=t.attributes,o=e.get(d.POSITION).data,s=e.get(d.NORMAL).data;if(s){const t=n.getMutableAttribute(d.NORMAL).data;for(let n=0;n<s.length;n+=3){const e=s[n+1];t[n+1]=-s[n+2],t[n+2]=e}}if(o){const t=n.getMutableAttribute(d.POSITION).data;for(let n=0;n<o.length;n+=3){const e=o[n+1];t[n+1]=-o[n+2],t[n+2]=e}}}function Mt(t,n,s,r,h){return!(Math.abs(l(n,t))>h)&&(e(s,t,n),o(s,s),e(r,s,t),o(r,r),!0)}function At(t,n,e,o,s,r,l){return Mt(t,n,s,r,l)||Mt(t,e,s,r,l)||Mt(t,o,s,r,l)}const It=.99619469809,yt=g();export{Ot as cgToGIS,G as createBoxGeometry,at as createConeGeometry,ft as createCylinderGeometry,z as createDiamondGeometry,wt as createExtrudedTriangle,it as createPathExtrusionGeometry,ht as createPointGeometry,lt as createPolySphereData,rt as createPolySphereGeometry,gt as createPolylineGeometry,st as createSphereGeometry,ct as createSquareGeometry,ot as createTetrahedronGeometry,pt as createTubeGeometry,At as makeOrthoBasisDirUpFallback,mt as transformInPlace};
|
|
5
|
+
import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{f as n,b as e,n as o,h as s,g as r,k as l,s as h,c as u,e as c}from"../../../../chunks/vec32.js";import{fromValues as a,create as f,clone as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{clone as i,create as g,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as m}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as O,floatArrayFrom as M}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as A,getContinuousIndexArray as I}from"../../../../geometry/support/Indices.js";import{create as y,fromPositionAndNormal as N,intersectRay as P}from"../../../../geometry/support/plane.js";import{wrap as T}from"../../../../geometry/support/ray.js";import{Attribute as S}from"./Attribute.js";import{Vec3Compact as b}from"./BufferVectorMath.js";import{ContentObjectType as R}from"./ContentObjectType.js";import{Geometry as L}from"./Geometry.js";import{assert as j}from"./Util.js";import{VertexAttribute as d}from"./VertexAttribute.js";const E=b,x=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],U=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],V=[0,0,1,0,1,1,0,1],v=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],F=new Array(36);for(let Nt=0;Nt<6;Nt++)for(let t=0;t<6;t++)F[6*Nt+t]=Nt;const C=new Array(36);for(let Nt=0;Nt<6;Nt++)C[6*Nt]=0,C[6*Nt+1]=1,C[6*Nt+2]=2,C[6*Nt+3]=2,C[6*Nt+4]=3,C[6*Nt+5]=0;function G(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(24);for(let o=0;o<8;o++)e[3*o]=x[o][0]*n[0],e[3*o+1]=x[o][1]*n[1],e[3*o+2]=x[o][2]*n[2];return new L(t,[[d.POSITION,new S(e,v,3,!0)],[d.NORMAL,new S(U,F,3)],[d.UV0,new S(V,C,2)]])}const D=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],k=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],q=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],B=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function z(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(18);for(let o=0;o<6;o++)e[3*o]=D[o][0]*n[0],e[3*o+1]=D[o][1]*n[1],e[3*o+2]=D[o][2]*n[2];return new L(t,[[d.POSITION,new S(e,q,3,!0)],[d.NORMAL,new S(k,B,3)]])}const Z=a(-.5,0,-.5),H=a(.5,0,-.5),J=a(0,0,.5),K=a(0,.5,0),Q=f(),W=f(),X=f(),Y=f(),$=f();n(Q,Z,K),n(W,Z,H),e(X,Q,W),o(X,X),n(Q,H,K),n(W,H,J),e(Y,Q,W),o(Y,Y),n(Q,J,K),n(W,J,Z),e($,Q,W),o($,$);const _=[Z,H,J,K],tt=[0,-1,0,X[0],X[1],X[2],Y[0],Y[1],Y[2],$[0],$[1],$[2]],nt=[0,1,2,3,1,0,3,2,1,3,0,2],et=[0,0,0,1,1,1,2,2,2,3,3,3];function ot(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(12);for(let o=0;o<4;o++)e[3*o]=_[o][0]*n[0],e[3*o+1]=_[o][1]*n[1],e[3*o+2]=_[o][2]*n[2];return new L(t,[[d.POSITION,new S(e,nt,3,!0)],[d.NORMAL,new S(tt,et,3)]])}function st(t,n,e,o,s={uv:!0}){const r=-Math.PI,l=2*Math.PI,h=-Math.PI/2,u=Math.PI,c=Math.max(3,Math.floor(e)),a=Math.max(2,Math.floor(o)),f=(c+1)*(a+1),p=O(3*f),i=O(3*f),g=O(2*f),w=[];let m=0;for(let O=0;O<=a;O++){const t=[],e=O/a,o=h+e*u,s=Math.cos(o);for(let h=0;h<=c;h++){const u=h/c,a=r+u*l,f=Math.cos(a)*s,w=Math.sin(o),O=-Math.sin(a)*s;p[3*m]=f*n,p[3*m+1]=w*n,p[3*m+2]=O*n,i[3*m]=f,i[3*m+1]=w,i[3*m+2]=O,g[2*m]=u,g[2*m+1]=e,t.push(m),++m}w.push(t)}const M=new Array;for(let O=0;O<a;O++)for(let t=0;t<c;t++){const n=w[O][t],e=w[O][t+1],o=w[O+1][t+1],s=w[O+1][t];0===O?(M.push(n),M.push(o),M.push(s)):O===a-1?(M.push(n),M.push(e),M.push(o)):(M.push(n),M.push(e),M.push(o),M.push(o),M.push(s),M.push(n))}const I=[[d.POSITION,new S(p,M,3,!0)],[d.NORMAL,new S(i,M,3,!0)]];return s.uv&&I.push([d.UV0,new S(g,M,2,!0)]),s.offset&&(I[0][0]=d.OFFSET,I.push([d.POSITION,new S(Float64Array.from(s.offset),A(M.length),3,!0)])),new L(t,I)}function rt(t,n,e,o){const s=lt(n,e,o);return new L(t,s)}function lt(t,n,e){const o=t;let s,r;if(e)s=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],r=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{const t=o*(1+Math.sqrt(5))/2;s=[-o,t,0,o,t,0,-o,-t,0,o,-t,0,0,-o,t,0,o,t,0,-o,-t,0,o,-t,t,0,-o,t,0,o,-t,0,-o,-t,0,o],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let c=0;c<s.length;c+=3)E.scale(s,c,t/E.length(s,c));let l={};function h(n,e){n>e&&([n,e]=[e,n]);const o=n.toString()+"."+e.toString();if(l[o])return l[o];let r=s.length;return s.length+=3,E.add(s,3*n,s,3*e,s,r),E.scale(s,r,t/E.length(s,r)),r/=3,l[o]=r,r}for(let c=0;c<n;c++){const t=r.length,n=new Array(4*t);for(let e=0;e<t;e+=3){const t=r[e],o=r[e+1],s=r[e+2],l=h(t,o),u=h(o,s),c=h(s,t),a=4*e;n[a]=t,n[a+1]=l,n[a+2]=c,n[a+3]=o,n[a+4]=u,n[a+5]=l,n[a+6]=s,n[a+7]=c,n[a+8]=u,n[a+9]=l,n[a+10]=u,n[a+11]=c}r=n,l={}}const u=M(s);for(let c=0;c<u.length;c+=3)E.normalize(u,c);return[[d.POSITION,new S(M(s),r,3,!0)],[d.NORMAL,new S(u,r,3,!0)]]}function ht(n,e,o,s,r,l,h,u,c=null){const a=o?i(o):g(),f=e?i(e):w(0,0,1);h??=t();const p=s?[255*s[0],255*s[1],255*s[2],s.length>3?255*s[3]:255]:[255,255,255,255],m=null!=r&&2===r.length?r:[1,1],O=A(1),M=[[d.POSITION,new S(a,O,3,!0)],[d.NORMAL,new S(f,O,3,!0)],[d.UV0,new S(h,O,h.length)],[d.COLOR,new S(p,O,4,!0)],[d.SIZE,new S(m,O,2)]];if(null!=l&&(l=[l[0],l[1],l[2],l[3]],M.push([d.CENTEROFFSETANDDISTANCE,new S(l,O,4)])),u){const t=[u[0],u[1],u[2],u[3]];M.push([d.FEATUREATTRIBUTE,new S(t,O,4)])}return new L(n,M,null,R.Point,c)}const ut=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function ct(t,n=ut){const e=new Array(12);for(let c=0;c<4;c++)for(let t=0;t<3;t++)e[3*c+t]=n[c][t];const o=[0,1,2,2,3,0],s=[0,0,1],r=[0,0,0,0,0,0],l=[0,0,1,0,1,1,0,1],h=[255,255,255,255],u=[[d.POSITION,new S(e,o,3,!0)],[d.NORMAL,new S(s,r,3,!0)],[d.UV0,new S(l,o,2,!0)],[d.COLOR,new S(h,r,4,!0)]];return new L(t,u)}function at(t,n,e,o,s,r=!0,l=!0){let h=0;const u=e,c=n;let f=a(0,h,0),p=a(0,h+c,0),i=a(0,-1,0),g=a(0,1,0);s&&(h=c,p=a(0,0,0),f=a(0,h,0),i=a(0,1,0),g=a(0,-1,0));const w=[p,f],m=[i,g],M=o+2,A=Math.sqrt(c*c+u*u);if(s)for(let O=o-1;O>=0;O--){const t=O*(2*Math.PI/o),n=a(Math.cos(t)*u,h,Math.sin(t)*u);w.push(n);const e=a(c*Math.cos(t)/A,-u/A,c*Math.sin(t)/A);m.push(e)}else for(let O=0;O<o;O++){const t=O*(2*Math.PI/o),n=a(Math.cos(t)*u,h,Math.sin(t)*u);w.push(n);const e=a(c*Math.cos(t)/A,u/A,c*Math.sin(t)/A);m.push(e)}const I=new Array,y=new Array;if(r){for(let t=3;t<w.length;t++)I.push(1),I.push(t-1),I.push(t),y.push(0),y.push(0),y.push(0);I.push(w.length-1),I.push(2),I.push(1),y.push(0),y.push(0),y.push(0)}if(l){for(let t=3;t<w.length;t++)I.push(t),I.push(t-1),I.push(0),y.push(t),y.push(t-1),y.push(1);I.push(0),I.push(2),I.push(w.length-1),y.push(1),y.push(2),y.push(m.length-1)}const N=O(3*M);for(let a=0;a<M;a++)N[3*a]=w[a][0],N[3*a+1]=w[a][1],N[3*a+2]=w[a][2];const P=O(3*M);for(let a=0;a<M;a++)P[3*a]=m[a][0],P[3*a+1]=m[a][1],P[3*a+2]=m[a][2];const T=[[d.POSITION,new S(N,I,3,!0)],[d.NORMAL,new S(P,y,3,!0)]];return new L(t,T)}function ft(t,n,u,c,i,g,w){const m=i?p(i):a(1,0,0),M=g?p(g):a(0,0,0);w??=!0;const A=f();o(A,m);const I=f();s(I,A,Math.abs(n));const y=f();s(y,I,-.5),r(y,y,M);const N=a(0,1,0);Math.abs(1-l(A,N))<.2&&h(N,0,0,1);const P=f();e(P,A,N),o(P,P),e(N,P,A);const T=2*c+(w?2:0),b=c+(w?2:0),R=O(3*T),j=O(3*b),E=O(2*T),x=new Array(3*c*(w?4:2)),U=new Array(3*c*(w?4:2));w&&(R[3*(T-2)]=y[0],R[3*(T-2)+1]=y[1],R[3*(T-2)+2]=y[2],E[2*(T-2)]=0,E[2*(T-2)+1]=0,R[3*(T-1)]=R[3*(T-2)]+I[0],R[3*(T-1)+1]=R[3*(T-2)+1]+I[1],R[3*(T-1)+2]=R[3*(T-2)+2]+I[2],E[2*(T-1)]=1,E[2*(T-1)+1]=1,j[3*(b-2)]=-A[0],j[3*(b-2)+1]=-A[1],j[3*(b-2)+2]=-A[2],j[3*(b-1)]=A[0],j[3*(b-1)+1]=A[1],j[3*(b-1)+2]=A[2]);const V=(t,n,e)=>{x[t]=n,U[t]=e};let v=0;const F=f(),C=f();for(let e=0;e<c;e++){const t=e*(2*Math.PI/c);s(F,N,Math.sin(t)),s(C,P,Math.cos(t)),r(F,F,C),j[3*e]=F[0],j[3*e+1]=F[1],j[3*e+2]=F[2],s(F,F,u),r(F,F,y),R[3*e]=F[0],R[3*e+1]=F[1],R[3*e+2]=F[2],E[2*e]=e/c,E[2*e+1]=0,R[3*(e+c)]=R[3*e]+I[0],R[3*(e+c)+1]=R[3*e+1]+I[1],R[3*(e+c)+2]=R[3*e+2]+I[2],E[2*(e+c)]=e/c,E[2*e+1]=1;const n=(e+1)%c;V(v++,e,e),V(v++,e+c,e),V(v++,n,n),V(v++,n,n),V(v++,e+c,e),V(v++,n+c,n)}if(w){for(let t=0;t<c;t++){const n=(t+1)%c;V(v++,T-2,b-2),V(v++,t,b-2),V(v++,n,b-2)}for(let t=0;t<c;t++){const n=(t+1)%c;V(v++,t+c,b-1),V(v++,T-1,b-1),V(v++,n+c,b-1)}}const G=[[d.POSITION,new S(R,x,3,!0)],[d.NORMAL,new S(j,U,3,!0)],[d.UV0,new S(E,x,2,!0)]];return new L(t,G)}function pt(t,n,e,o,s,r){o=o||10,s=null==s||s,j(n.length>1);const l=[[0,0,0]],h=[],u=[];for(let c=0;c<o;c++){h.push([0,-c-1,-(c+1)%o-1]);const t=c/o*2*Math.PI;u.push([Math.cos(t)*e,Math.sin(t)*e])}return it(t,u,n,l,h,s,r)}function it(t,l,c,f,p,i,w=a(0,0,0)){const m=l.length,M=O(c.length*m*3+(6*f.length||0)),A=O(c.length*m*3+(f?6:0)),I=new Array,b=new Array;let R=0,j=0;const E=g(),x=g(),U=g(),V=g(),v=g(),F=g(),C=g(),G=g(),D=g(),k=g(),q=g(),B=g(),z=g(),Z=y();h(D,0,1,0),n(x,c[1],c[0]),o(x,x),i?(r(G,c[0],w),o(U,G)):h(U,0,0,1),At(x,U,D,D,v,U,It),u(V,U),u(B,v);for(let n=0;n<f.length;n++)s(F,v,f[n][0]),s(G,U,f[n][2]),r(F,F,G),r(F,F,c[0]),M[R++]=F[0],M[R++]=F[1],M[R++]=F[2];A[j++]=-x[0],A[j++]=-x[1],A[j++]=-x[2];for(let n=0;n<p.length;n++)I.push(p[n][0]>0?p[n][0]:-p[n][0]-1+f.length),I.push(p[n][1]>0?p[n][1]:-p[n][1]-1+f.length),I.push(p[n][2]>0?p[n][2]:-p[n][2]-1+f.length),b.push(0),b.push(0),b.push(0);let H=f.length;const J=f.length-1;for(let h=0;h<c.length;h++){let t=!1;if(h>0){u(E,x),h<c.length-1?(n(x,c[h+1],c[h]),o(x,x)):t=!0,r(k,E,x),o(k,k),r(q,c[h-1],V),N(c[h],k,Z);P(Z,T(q,E),G)?(n(G,G,c[h]),o(U,G),e(v,k,U),o(v,v)):At(k,V,B,D,v,U,It),u(V,U),u(B,v)}i&&(r(G,c[h],w),o(z,G));for(let n=0;n<m;n++)if(s(F,v,l[n][0]),s(G,U,l[n][1]),r(F,F,G),o(C,F),A[j++]=C[0],A[j++]=C[1],A[j++]=C[2],r(F,F,c[h]),M[R++]=F[0],M[R++]=F[1],M[R++]=F[2],!t){const t=(n+1)%m;I.push(H+n),I.push(H+m+n),I.push(H+t),I.push(H+t),I.push(H+m+n),I.push(H+m+t);for(let n=0;n<6;n++){const t=I.length-6;b.push(I[t+n]-J)}}H+=m}const K=c[c.length-1];for(let n=0;n<f.length;n++)s(F,v,f[n][0]),s(G,U,f[n][1]),r(F,F,G),r(F,F,K),M[R++]=F[0],M[R++]=F[1],M[R++]=F[2];const Q=j/3;A[j++]=x[0],A[j++]=x[1],A[j++]=x[2];const W=H-m;for(let n=0;n<p.length;n++)I.push(p[n][0]>=0?H+p[n][0]:-p[n][0]-1+W),I.push(p[n][2]>=0?H+p[n][2]:-p[n][2]-1+W),I.push(p[n][1]>=0?H+p[n][1]:-p[n][1]-1+W),b.push(Q),b.push(Q),b.push(Q);const X=[[d.POSITION,new S(M,I,3,!0)],[d.NORMAL,new S(A,b,3,!0)]];return new L(t,X)}function gt(t,n,e,o){j(n.length>1,"createPolylineGeometry(): polyline needs at least 2 points"),j(3===n[0].length,"createPolylineGeometry(): malformed vertex"),j(null==e||e.length===n.length,"createPolylineGeometry: need same number of points and normals"),j(null==e||3===e[0].length,"createPolylineGeometry(): malformed normal");const s=m(3*n.length),r=new Array(2*(n.length-1));let l=0,h=0;for(let c=0;c<n.length;c++){for(let t=0;t<3;t++)s[l++]=n[c][t];c>0&&(r[h++]=c-1,r[h++]=c)}const u=[[d.POSITION,new S(s,r,3,!0)]];if(e){const t=O(3*e.length);let o=0;for(let s=0;s<n.length;s++)for(let n=0;n<3;n++)t[o++]=e[s][n];u.push([d.NORMAL,new S(t,r,3,!0)])}return o&&u.push([d.COLOR,new S(o,I(o.length/4),4)]),new L(t,u,null,R.Line)}function wt(t,n,e,o,s,r=0){const l=new Array(18),h=[[-e,r,s/2],[o,r,s/2],[0,n+r,s/2],[-e,r,-s/2],[o,r,-s/2],[0,n+r,-s/2]],u=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let c=0;c<6;c++)l[3*c]=h[c][0],l[3*c+1]=h[c][1],l[3*c+2]=h[c][2];return new L(t,[[d.POSITION,new S(l,u,3,!0)]])}function mt(t,n){const e=t.getMutableAttribute(d.POSITION).data;for(let o=0;o<e.length;o+=3){const t=e[o],s=e[o+1],r=e[o+2];h(yt,t,s,r),c(yt,yt,n),e[o]=yt[0],e[o+1]=yt[1],e[o+2]=yt[2]}}function Ot(t,n=t){const e=t.attributes,o=e.get(d.POSITION).data,s=e.get(d.NORMAL).data;if(s){const t=n.getMutableAttribute(d.NORMAL).data;for(let n=0;n<s.length;n+=3){const e=s[n+1];t[n+1]=-s[n+2],t[n+2]=e}}if(o){const t=n.getMutableAttribute(d.POSITION).data;for(let n=0;n<o.length;n+=3){const e=o[n+1];t[n+1]=-o[n+2],t[n+2]=e}}}function Mt(t,n,s,r,h){return!(Math.abs(l(n,t))>h)&&(e(s,t,n),o(s,s),e(r,s,t),o(r,r),!0)}function At(t,n,e,o,s,r,l){return Mt(t,n,s,r,l)||Mt(t,e,s,r,l)||Mt(t,o,s,r,l)}const It=.99619469809,yt=g();export{Ot as cgToGIS,G as createBoxGeometry,at as createConeGeometry,ft as createCylinderGeometry,z as createDiamondGeometry,wt as createExtrudedTriangle,it as createPathExtrusionGeometry,ht as createPointGeometry,lt as createPolySphereData,rt as createPolySphereGeometry,gt as createPolylineGeometry,st as createSphereGeometry,ct as createSquareGeometry,ot as createTetrahedronGeometry,pt as createTubeGeometry,At as makeOrthoBasisDirUpFallback,mt as transformInPlace};
|