@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{isSome as t}from"../../../../../core/arrayUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{isAborted as a,throwIfAborted as s}from"../../../../../core/promiseUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as l,j as c,e as h}from"../../../../../chunks/vec32.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as u,fromValues as m}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as f}from"../../../support/debugFlags.js";import{glLayout as _}from"../../../support/buffer/glUtil.js";import{newLayout as p}from"../../../support/buffer/InterleavedLayout.js";import{ShaderOutput as g}from"../../core/shaderLibrary/ShaderOutput.js";import{ASyncPreparesRenderPlugin as I}from"../../effects/RenderPlugin.js";import{Camera as C}from"../Camera.js";import{Default3D as y}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as v}from"../IntersectorInterfaces.js";import E from"../Octree.js";import{RenderSlot as A}from"../RenderSlot.js";import{assert as D}from"../Util.js";import{VertexAttribute as b}from"../VertexAttribute.js";import{InstanceData as R,StateFlags as T}from"./InstanceData.js";import{InstanceOctree as L}from"./InstanceOctree.js";import{LevelSelector as S}from"./LevelSelector.js";import{LodLevel as O}from"./LodLevel.js";import{RenderInstanceData as j}from"./RenderInstanceData.js";import{colorMixModes as x}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as N}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as M}from"../../shaders/DefaultMaterialTechnique.js";import{TaskPriority as U,noBudget as w}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as F,unbindVertexBufferLayout as H}from"../../../../webgl/Util.js";const V=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new S(t,r)};let B=class extends I{constructor(e,t){super(e),this.type=v.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=[new Array],this._highlightRenderInstanceData=[new Array],this._allRenderInstanceData=[this._defaultRenderInstanceData[0],this._highlightRenderInstanceData[0]],this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new C,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[A.OPAQUE_MATERIAL,e=>this._produces(e)],[A.TRANSPARENT_MATERIAL,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new R({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(U.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=q(this.optionalFields),this._glInstanceBufferLayout=_(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this.metadata.layerUid}get instanceData(){return this._instanceData}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),0)}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const a=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:a,renderedTriangles:a*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,r){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this.symbol.levels.map((t=>(this._defaultRenderInstanceData[0].push(new j(n,this._instanceBufferLayout)),this._highlightRenderInstanceData[0].push(new j(n,this._instanceBufferLayout)),O.create(e,t,r))))),o=i.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(a(r)||o.length!==i.length){o.forEach((e=>e.destroy())),s(r);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=o,this._levelSelector=V(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData[0].forEach((e=>e.destroy())),this._highlightRenderInstanceData[0].forEach((e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>{const t=e.material.produces.get(A.TRANSPARENT_MATERIAL);return t&&t(g.Color)}))))}hasHighlights(){return this._highlightRenderInstanceData[0].some((e=>e.size>0))}_produces(e){return e!==g.Highlight&&e!==g.ShadowHighlight||this.hasHighlights()}prepareRender(e){if(!f.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bindParameters.contentCamera.equals(this._camera);this._camera.copyFrom(e.bindParameters.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(w),this._needFullCycle=!1)}}prepareTechniques(e){if(!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e.output);if(!t)return null;const r=new Array;return t.forEach((t=>this.levels.forEach(((a,s)=>{a.components.forEach((a=>r.push(this._beginComponent(e,t[s],a))))})))),r}renderNode(e,t){const r=this._getInstanceDatas(e.output);if(!r||null==t)return;let a=0;e.rctx.bindVAO(),r.forEach((r=>this.levels.forEach(((s,n)=>{s.components.forEach((s=>this._renderComponent(e,t[a++],r[n],s,n)))}))))}_getInstanceDatas(e){const t=e!==g.Highlight&&e!==g.ShadowHighlight,r=e!==g.ShadowExcludeHighlight;return t&&r?this._allRenderInstanceData:t?this._defaultRenderInstanceData:r?this._highlightRenderInstanceData:null}intersect(e,t,r,a){if(!this.baseMaterial.isVisible()||null==this._octree)return;const s=d();l(s,a,r);const n=s=>{this._instanceData.getCombinedModelTransform(s,W),e.transform.set(W),h(K,r,e.transform.inverse),h(Y,a,e.transform.inverse);const n=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;D(0!=(n&T.ACTIVE),"invalid instance state"),D(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,K,Y,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(n):this._octree.forEachAlongRay(r,s,n)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new L(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&T.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=r(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return{near:1/0,far:-1/0};const t=e.viewForward,r=this._octree.findClosest(t,E.DepthOrder.FRONT_TO_BACK,e.frustum),a=this._octree.findClosest(t,E.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==a)return{near:1/0,far:-1/0};const s=e.eye,n=this._instanceData.view;n.boundingSphere.getVec(r,k),l(k,k,s);const i=c(k,t)-k[3];n.boundingSphere.getVec(a,k),l(k,k,s);const o=c(k,t)+k[3];return{near:Math.max(e.near,i),far:Math.min(e.far,o)}}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:r,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const s=this._instanceData,n=s.view;let i=s.size;const o=s.capacity;let l=this._instanceIndex;const c=Math.ceil(o/500);for(let h=0;h<i&&!e.done;++h){l===this._cycleStartIndex&&this._startUpdateCycle();const h=n.state.get(l);let d=0;if(!(h&T.ALLOCATED)){l=l+1===o?0:l+1,i++;continue}const u=n.lodLevel.get(l);if(h&T.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[0][u].freeTail(),h&T.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[0][u].freeTail(),h&T.REMOVE)s.freeInstance(l);else if(h&T.VISIBLE){let e=0;t&&(n.modelOrigin.getVec(l,z),e=a.selectLevel(z,s.getCombinedMedianScaleFactor(l),r)),d=h&~(T.ACTIVE|T.TRANSFORM_CHANGED),e>=0&&(h&T.HIGHLIGHT?(P(this._highlightRenderInstanceData[0][e],n,l),d|=T.HIGHLIGHT_ACTIVE):(P(this._defaultRenderInstanceData[0][e],n,l),d|=T.DEFAULT_ACTIVE)),n.state.set(l,d),n.lodLevel.set(l,e)}else d=h&~(T.ACTIVE|T.TRANSFORM_CHANGED),n.state.set(l,d);if(null!=this._octreeCached){const e=!!(h&T.ACTIVE),t=!!(d&T.ACTIVE);!e&&t?this._octreeCached.addInstance(l):e&&!t?this._octreeCached.removeInstance(l):e&&t&&h&T.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(l),this._octreeCached.addInstance(l))}l=l+1===o?0:l+1,l%c==0&&e.madeProgress()}this._instanceIndex=l,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const a=r.glMaterials.load(e.rctx,e.bindParameters.slot,e.output);return null!=a?a.beginSlot(e.bindParameters):null}_renderComponent(e,t,r,a,s){if(!t)return;const{bindParameters:n,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,n,a.material.parameters,Q);i.bindVAO(a.vao),t.ensureAttributeLocations(a.vao),f.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===g.Color&&(o.setUniform4fv("externalColor",J[Math.min(s,J.length-1)]),o.setUniform1i("colorMixMode",x.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{F(i,y,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,a.vertexCount,s-e),H(i,y,r.buffer,u)};a.material.parameters.transparent&&null!=d?c>h?(D(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(D(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(D(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function P(e,t,r){const a=e.allocateHead();G(t,r,e.view,a)}function G(e,t,r,a){N(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,a),r.model.copyFrom(a,e.model,t),r.modelNormal.copyFrom(a,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(a,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(a,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(a,e.featureAttribute,t)}function q(e){let t=p().vec3f(b.INSTANCEMODELORIGINHI).vec3f(b.INSTANCEMODELORIGINLO).mat3f(b.INSTANCEMODEL).mat3f(b.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(b.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(b.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(b.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([n({constructOnly:!0})],B.prototype,"symbol",void 0),e([n({constructOnly:!0})],B.prototype,"optionalFields",void 0),e([n({constructOnly:!0})],B.prototype,"metadata",void 0),e([n({constructOnly:!0})],B.prototype,"shaderTransformation",void 0),e([n()],B.prototype,"_instanceData",void 0),e([n()],B.prototype,"_cycleStartIndex",void 0),e([n({readOnly:!0})],B.prototype,"_enableLevelSelection",null),e([n()],B.prototype,"_updateCyclesWithStaticCamera",void 0),e([n({readOnly:!0})],B.prototype,"running",null),B=e([i("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],B);const z=d(),k=u(),W=o(),K=d(),Y=d(),J=[m(1,0,1,1),m(0,0,1,1),m(0,1,0,1),m(1,1,0,1),m(1,0,0,1)],Q=new M;export{B as LodRenderer};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{isAborted as a,throwIfAborted as s}from"../../../../../core/promiseUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as l,k as c,e as h}from"../../../../../chunks/vec32.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as u,fromValues as m}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as f}from"../../../support/debugFlags.js";import{glLayout as _}from"../../../support/buffer/glUtil.js";import{newLayout as p}from"../../../support/buffer/InterleavedLayout.js";import{ShaderOutput as g}from"../../core/shaderLibrary/ShaderOutput.js";import{ASyncPreparesRenderPlugin as I}from"../../effects/RenderPlugin.js";import{Camera as C}from"../Camera.js";import{Default3D as y}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as v}from"../IntersectorInterfaces.js";import E from"../Octree.js";import{RenderSlot as A}from"../RenderSlot.js";import{assert as D}from"../Util.js";import{VertexAttribute as b}from"../VertexAttribute.js";import{InstanceData as R,StateFlags as T}from"./InstanceData.js";import{InstanceOctree as L}from"./InstanceOctree.js";import{LevelSelector as S}from"./LevelSelector.js";import{LodLevel as O}from"./LodLevel.js";import{RenderInstanceData as j}from"./RenderInstanceData.js";import{colorMixModes as x}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as N}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as M}from"../../shaders/DefaultMaterialTechnique.js";import{TaskPriority as U,noBudget as w}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as F,unbindVertexBufferLayout as H}from"../../../../webgl/Util.js";const V=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new S(t,r)};let B=class extends I{constructor(e,t){super(e),this.type=v.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=[new Array],this._highlightRenderInstanceData=[new Array],this._allRenderInstanceData=[this._defaultRenderInstanceData[0],this._highlightRenderInstanceData[0]],this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new C,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[A.OPAQUE_MATERIAL,e=>this._produces(e)],[A.TRANSPARENT_MATERIAL,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new R({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(U.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=q(this.optionalFields),this._glInstanceBufferLayout=_(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this.metadata.layerUid}get instanceData(){return this._instanceData}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),0)}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const a=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:a,renderedTriangles:a*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,r){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this.symbol.levels.map((t=>(this._defaultRenderInstanceData[0].push(new j(n,this._instanceBufferLayout)),this._highlightRenderInstanceData[0].push(new j(n,this._instanceBufferLayout)),O.create(e,t,r))))),o=i.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(a(r)||o.length!==i.length){o.forEach((e=>e.destroy())),s(r);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=o,this._levelSelector=V(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData[0].forEach((e=>e.destroy())),this._highlightRenderInstanceData[0].forEach((e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>{const t=e.material.produces.get(A.TRANSPARENT_MATERIAL);return t&&t(g.Color)}))))}hasHighlights(){return this._highlightRenderInstanceData[0].some((e=>e.size>0))}_produces(e){return e!==g.Highlight&&e!==g.ShadowHighlight||this.hasHighlights()}prepareRender(e){if(!f.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bindParameters.contentCamera.equals(this._camera);this._camera.copyFrom(e.bindParameters.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(w),this._needFullCycle=!1)}}prepareTechniques(e){if(!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e.output);if(!t)return null;const r=new Array;return t.forEach((t=>this.levels.forEach(((a,s)=>{a.components.forEach((a=>r.push(this._beginComponent(e,t[s],a))))})))),r}renderNode(e,t){const r=this._getInstanceDatas(e.output);if(!r||null==t)return;let a=0;e.rctx.bindVAO(),r.forEach((r=>this.levels.forEach(((s,n)=>{s.components.forEach((s=>this._renderComponent(e,t[a++],r[n],s,n)))}))))}_getInstanceDatas(e){const t=e!==g.Highlight&&e!==g.ShadowHighlight,r=e!==g.ShadowExcludeHighlight;return t&&r?this._allRenderInstanceData:t?this._defaultRenderInstanceData:r?this._highlightRenderInstanceData:null}intersect(e,t,r,a){if(!this.baseMaterial.isVisible()||null==this._octree)return;const s=d();l(s,a,r);const n=s=>{this._instanceData.getCombinedModelTransform(s,W),e.transform.set(W),h(K,r,e.transform.inverse),h(Y,a,e.transform.inverse);const n=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;D(0!=(n&T.ACTIVE),"invalid instance state"),D(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,K,Y,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(n):this._octree.forEachAlongRay(r,s,n)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new L(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&T.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=r(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return{near:1/0,far:-1/0};const t=e.viewForward,r=this._octree.findClosest(t,E.DepthOrder.FRONT_TO_BACK,e.frustum),a=this._octree.findClosest(t,E.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==a)return{near:1/0,far:-1/0};const s=e.eye,n=this._instanceData.view;n.boundingSphere.getVec(r,k),l(k,k,s);const i=c(k,t)-k[3];n.boundingSphere.getVec(a,k),l(k,k,s);const o=c(k,t)+k[3];return{near:Math.max(e.near,i),far:Math.min(e.far,o)}}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:r,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const s=this._instanceData,n=s.view;let i=s.size;const o=s.capacity;let l=this._instanceIndex;const c=Math.ceil(o/500);for(let h=0;h<i&&!e.done;++h){l===this._cycleStartIndex&&this._startUpdateCycle();const h=n.state.get(l);let d=0;if(!(h&T.ALLOCATED)){l=l+1===o?0:l+1,i++;continue}const u=n.lodLevel.get(l);if(h&T.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[0][u].freeTail(),h&T.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[0][u].freeTail(),h&T.REMOVE)s.freeInstance(l);else if(h&T.VISIBLE){let e=0;t&&(n.modelOrigin.getVec(l,z),e=a.selectLevel(z,s.getCombinedMedianScaleFactor(l),r)),d=h&~(T.ACTIVE|T.TRANSFORM_CHANGED),e>=0&&(h&T.HIGHLIGHT?(P(this._highlightRenderInstanceData[0][e],n,l),d|=T.HIGHLIGHT_ACTIVE):(P(this._defaultRenderInstanceData[0][e],n,l),d|=T.DEFAULT_ACTIVE)),n.state.set(l,d),n.lodLevel.set(l,e)}else d=h&~(T.ACTIVE|T.TRANSFORM_CHANGED),n.state.set(l,d);if(null!=this._octreeCached){const e=!!(h&T.ACTIVE),t=!!(d&T.ACTIVE);!e&&t?this._octreeCached.addInstance(l):e&&!t?this._octreeCached.removeInstance(l):e&&t&&h&T.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(l),this._octreeCached.addInstance(l))}l=l+1===o?0:l+1,l%c==0&&e.madeProgress()}this._instanceIndex=l,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const a=r.glMaterials.load(e.rctx,e.bindParameters.slot,e.output);return null!=a?a.beginSlot(e.bindParameters):null}_renderComponent(e,t,r,a,s){if(!t)return;const{bindParameters:n,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,n,a.material.parameters,Q);i.bindVAO(a.vao),t.ensureAttributeLocations(a.vao),f.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===g.Color&&(o.setUniform4fv("externalColor",J[Math.min(s,J.length-1)]),o.setUniform1i("colorMixMode",x.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{F(i,y,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,a.vertexCount,s-e),H(i,y,r.buffer,u)};a.material.parameters.transparent&&null!=d?c>h?(D(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(D(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(D(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function P(e,t,r){const a=e.allocateHead();G(t,r,e.view,a)}function G(e,t,r,a){N(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,a),r.model.copyFrom(a,e.model,t),r.modelNormal.copyFrom(a,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(a,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(a,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(a,e.featureAttribute,t)}function q(e){let t=p().vec3f(b.INSTANCEMODELORIGINHI).vec3f(b.INSTANCEMODELORIGINLO).mat3f(b.INSTANCEMODEL).mat3f(b.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(b.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(b.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(b.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([n({constructOnly:!0})],B.prototype,"symbol",void 0),e([n({constructOnly:!0})],B.prototype,"optionalFields",void 0),e([n({constructOnly:!0})],B.prototype,"metadata",void 0),e([n({constructOnly:!0})],B.prototype,"shaderTransformation",void 0),e([n()],B.prototype,"_instanceData",void 0),e([n()],B.prototype,"_cycleStartIndex",void 0),e([n({readOnly:!0})],B.prototype,"_enableLevelSelection",null),e([n()],B.prototype,"_updateCyclesWithStaticCamera",void 0),e([n({readOnly:!0})],B.prototype,"running",null),B=e([i("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],B);const z=d(),k=u(),W=o(),K=d(),Y=d(),J=[m(1,0,1,1),m(0,0,1,1),m(0,1,0,1),m(1,1,0,1),m(1,0,0,1)],Q=new M;export{B as LodRenderer};
|
|
@@ -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{normalFromMat4Legacy as t}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r,transpose as e,copy as i,multiply as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as n,g as h,l as f,
|
|
5
|
+
import{normalFromMat4Legacy as t}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r,transpose as e,copy as i,multiply as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as n,g as h,l as f,r as l,e as m}from"../../../../chunks/vec32.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d as c,g as _}from"../../../../chunks/sphere.js";import{ViewingMode as u}from"../../../ViewingMode.js";import{Obb as g,computeOffsetObb as M}from"../../support/orientedBoundingBox.js";class v{constructor(){this._transform=a(),this._transformInverse=new b({value:this._transform},r,a),this._transformInverseTranspose=new b(this._transformInverse,e,a),this._transformTranspose=new b({value:this._transform},e,a),this._transformInverseRotation=new b({value:this._transform},t,s)}_invalidateLazyTransforms(){this._transformInverse.invalidate(),this._transformInverseTranspose.invalidate(),this._transformTranspose.invalidate(),this._transformInverseRotation.invalidate()}get transform(){return this._transform}get inverse(){return this._transformInverse.value}get inverseTranspose(){return this._transformInverseTranspose.value}get inverseRotation(){return this._transformInverseRotation.value}get transpose(){return this._transformTranspose.value}setTransformMatrix(t){i(this._transform,t)}multiplyTransform(t){o(this._transform,this._transform,t)}set(t){i(this._transform,t),this._invalidateLazyTransforms()}setAndInvalidateLazyTransforms(t,s){this.setTransformMatrix(t),this.multiplyTransform(s),this._invalidateLazyTransforms()}}class b{constructor(t,s,r){this._original=t,this._update=s,this._dirty=!0,this._transform=r()}invalidate(){this._dirty=!0}get value(){return this._dirty&&(this._update(this._transform,this._original.value),this._dirty=!1),this._transform}}class T{constructor(t=0){this.offset=t,this.tmpVertex=p()}applyToVertex(t,s,r){const e=n(q,t,s,r),i=h(z,e,this.localOrigin),o=this.offset/f(i);return l(this.tmpVertex,e,i,o),this.tmpVertex}applyToAabb(t){const s=A,r=R,e=B;for(let n=0;n<3;++n)s[n]=t[0+n]+this.localOrigin[n],r[n]=t[3+n]+this.localOrigin[n],e[n]=s[n];const i=this.applyToVertex(s[0],s[1],s[2]);for(let n=0;n<3;++n)t[n]=i[n],t[n+3]=i[n];const o=s=>{const r=this.applyToVertex(s[0],s[1],s[2]);for(let e=0;e<3;++e)t[e]=Math.min(t[e],r[e]),t[e+3]=Math.max(t[e+3],r[e])};for(let n=1;n<8;++n){for(let t=0;t<3;++t)e[t]=0==(n&1<<t)?s[t]:r[t];o(e)}let a=0;for(let n=0;n<3;++n){s[n]*r[n]<0&&(a|=1<<n)}if(0!==a&&7!==a)for(let n=0;n<8;++n)if(0==(a&n)){for(let t=0;t<3;++t)e[t]=0!=(a&1<<t)?0:0!=(n&1<<t)?s[t]:r[t];o(e)}for(let n=0;n<3;++n)t[n]-=this.localOrigin[n],t[n+3]-=this.localOrigin[n];return t}}class x{constructor(t=0){this.componentLocalOriginLength=0,this._totalOffset=0,this._offset=0,this._tmpVertex=p(),this._tmpMbs=c(),this._tmpObb=new g,this._resetOffset(t)}_resetOffset(t){this._offset=t,this._totalOffset=t}set offset(t){this._resetOffset(t)}get offset(){return this._offset}set componentOffset(t){this._totalOffset=this._offset+t}set localOrigin(t){this.componentLocalOriginLength=f(t)}applyToVertex(t,s,r){const e=n(q,t,s,r),i=n(z,t,s,r+this.componentLocalOriginLength),o=this._totalOffset/f(i);return l(this._tmpVertex,e,i,o),this._tmpVertex}applyToAabb(t){const s=this.componentLocalOriginLength,r=t[0],e=t[1],i=t[2]+s,o=t[3],a=t[4],n=t[5]+s,h=Math.abs(r),f=Math.abs(e),l=Math.abs(i),m=Math.abs(o),p=Math.abs(a),c=Math.abs(n),_=.5*(1+Math.sign(r*o))*Math.min(h,m),u=.5*(1+Math.sign(e*a))*Math.min(f,p),g=.5*(1+Math.sign(i*n))*Math.min(l,c),M=Math.max(h,m),v=Math.max(f,p),b=Math.max(l,c),T=Math.sqrt(_*_+u*u+g*g),x=Math.sign(h+r),O=Math.sign(f+e),y=Math.sign(l+i),d=Math.sign(m+o),V=Math.sign(p+a),L=Math.sign(c+n),j=this._totalOffset;if(T<j)return t[0]-=(1-x)*j,t[1]-=(1-O)*j,t[2]-=(1-y)*j,t[3]+=d*j,t[4]+=V*j,t[5]+=L*j,t;const I=j/Math.sqrt(M*M+v*v+b*b),w=j/T,q=w-I,z=-q;return t[0]+=r*(x*z+w),t[1]+=e*(O*z+w),t[2]+=i*(y*z+w),t[3]+=o*(d*q+I),t[4]+=a*(V*q+I),t[5]+=n*(L*q+I),t}applyToMbs(t){const s=f(_(t)),r=this._totalOffset/s;return l(_(this._tmpMbs),_(t),_(t),r),this._tmpMbs[3]=t[3]+t[3]*this._totalOffset/s,this._tmpMbs}applyToObb(t){return M(t,this._totalOffset,this._totalOffset,u.Global,this._tmpObb),this._tmpObb}}class O{constructor(t=0){this.offset=t,this.sphere=c(),this.tmpVertex=p()}applyToVertex(t,s,r){const e=this.objectTransform.transform,i=n(q,t,s,r),o=m(i,i,e),a=this.offset/f(o);l(o,o,o,a);const h=this.objectTransform.inverse;return m(this.tmpVertex,o,h),this.tmpVertex}applyToMinMax(t,s){const r=this.offset/f(t);l(t,t,t,r);const e=this.offset/f(s);l(s,s,s,e)}applyToAabb(t){const s=this.offset/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]+=t[0]*s,t[1]+=t[1]*s,t[2]+=t[2]*s;const r=this.offset/Math.sqrt(t[3]*t[3]+t[4]*t[4]+t[5]*t[5]);return t[3]+=t[3]*r,t[4]+=t[4]*r,t[5]+=t[5]*r,t}applyToBoundingSphere(t){const s=f(_(t)),r=this.offset/s;return l(_(this.sphere),_(t),_(t),r),this.sphere[3]=t[3]+t[3]*this.offset/s,this.sphere}}const y=new O;function d(t){return null!=t?(y.offset=t,y):null}const V=new x;function L(t){return null!=t?(V.offset=t,V):null}const j=new T;function I(t){return null!=t?(j.offset=t,j):null}const w="terrain",q=p(),z=p(),A=p(),R=p(),B=p();export{x as I3SVerticalOffsetGlobalViewingMode,v as IntersectorTransform,O as Object3DVerticalOffsetGlobalViewingMode,T as TerrainVerticalOffsetGlobalViewingMode,L as getVerticalOffsetI3S,d as getVerticalOffsetObject3D,I as getVerticalOffsetTerrain,w as terrainId};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{lerp as i}from"../../../../core/mathUtils.js";import{c as t,h as s,g as h,
|
|
5
|
+
import{lerp as i}from"../../../../core/mathUtils.js";import{c as t,h as s,g as h,m as r}from"../../../../chunks/vec32.js";import{create as n,fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{SphericalHarmonicsAmbientLight as o,MainLight as e}from"./Lightsources.js";import{combineLights as c}from"./SphericalHarmonics.js";class g{constructor(){this.color=n(),this.intensity=1}}class m{constructor(){this.direction=n(),this.ambient=new g,this.diffuse=new g}}const l=.4;class _{constructor(){this._shOrder=2,this._legacy=new m,this.globalFactor=.5,this.noonFactor=.5,this._sphericalHarmonics=new o,this._mainLight=new e(n(),a(1,0,0),!1)}get legacy(){return this._legacy}get sh(){return this._sphericalHarmonics}get mainLight(){return this._mainLight}set(i){c(i,this._shOrder,this._mainLight,this._sphericalHarmonics),t(this._legacy.direction,this._mainLight.direction);const r=1/Math.PI;this._legacy.ambient.color[0]=.282095*this._sphericalHarmonics.r[0]*r,this._legacy.ambient.color[1]=.282095*this._sphericalHarmonics.g[0]*r,this._legacy.ambient.color[2]=.282095*this._sphericalHarmonics.b[0]*r,s(this._legacy.diffuse.color,this._mainLight.intensity,r),t(L,this._legacy.diffuse.color),s(L,L,l*this.globalFactor),h(this._legacy.ambient.color,this._legacy.ambient.color,L)}copyFrom(i){this._sphericalHarmonics.r=Array.from(i.sh.r),this._sphericalHarmonics.g=Array.from(i.sh.g),this._sphericalHarmonics.b=Array.from(i.sh.b),t(this._mainLight.direction,i.mainLight.direction),t(this._mainLight.intensity,i.mainLight.intensity),this._mainLight.castShadows=i.mainLight.castShadows,this._mainLight.specularStrength=i.mainLight.specularStrength,this._mainLight.environmentStrength=i.mainLight.environmentStrength,this.globalFactor=i.globalFactor,this.noonFactor=i.noonFactor}lerpLighting(s,h,n){if(r(this._mainLight.intensity,s.mainLight.intensity,h.mainLight.intensity,n),this._mainLight.environmentStrength=i(s.mainLight.environmentStrength,h.mainLight.environmentStrength,n),this._mainLight.specularStrength=i(s.mainLight.specularStrength,h.mainLight.specularStrength,n),t(this._mainLight.direction,h.mainLight.direction),this._mainLight.castShadows=h.mainLight.castShadows,this.globalFactor=i(s.globalFactor,h.globalFactor,n),this.noonFactor=i(s.noonFactor,h.noonFactor,n),s.sh.r.length===h.sh.r.length)for(let t=0;t<h.sh.r.length;t++)this._sphericalHarmonics.r[t]=i(s.sh.r[t],h.sh.r[t],n),this._sphericalHarmonics.g[t]=i(s.sh.g[t],h.sh.g[t],n),this._sphericalHarmonics.b[t]=i(s.sh.b[t],h.sh.b[t],n);else for(let i=0;i<h.sh.r.length;i++)this._sphericalHarmonics.r[i]=h.sh.r[i],this._sphericalHarmonics.g[i]=h.sh.g[i],this._sphericalHarmonics.b[i]=h.sh.b[i]}}const L=n();export{_ as SceneLighting,m as SunLight,l as ambientBoost};
|
|
@@ -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 t}from"../../../../core/mathUtils.js";import{
|
|
5
|
+
import{clamp as t}from"../../../../core/mathUtils.js";import{F as n,s as o,c as r}from"../../../../chunks/vec32.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{elementwiseProduct as i,scalarProduct as s,add as c}from"../lib/LongVectorMath.js";import{MainLight as f,FillLight as h,AmbientLight as a,SphericalHarmonicsAmbientLight as g}from"./Lightsources.js";function u(t){return(t+1)*(t+1)}function l(n){return t(Math.floor(Math.sqrt(n)-1),0,2)}function m(t,n,o){const r=t[0],e=t[1],i=t[2],s=o||[];return s.length=u(n),n>=0&&(s[0]=.28209479177),n>=1&&(s[1]=.4886025119*r,s[2]=.4886025119*i,s[3]=.4886025119*e),n>=2&&(s[4]=1.09254843059*r*e,s[5]=1.09254843059*e*i,s[6]=.31539156525*(3*i*i-1),s[7]=1.09254843059*r*i,s[8]=.54627421529*(r*r-e*e)),s}function p(t,n){const o=u(t),r=n||{r:[],g:[],b:[]};r.r.length=r.g.length=r.b.length=o;for(let e=0;e<o;e++)r.r[e]=r.g[e]=r.b[e]=0;return r}function b(t,o){const r=l(o.r.length);for(const e of t)n(P,e.direction),m(P,r,v),i(v,w),s(v,e.intensity[0],I),c(o.r,I),s(v,e.intensity[1],I),c(o.g,I),s(v,e.intensity[2],I),c(o.b,I);return o}function y(t,n){m(P,0,v);for(const o of t)n.r[0]+=v[0]*w[0]*o.intensity[0]*4*Math.PI,n.g[0]+=v[0]*w[0]*o.intensity[1]*4*Math.PI,n.b[0]+=v[0]*w[0]*o.intensity[2]*4*Math.PI;return n}function M(t,n,e,i){p(n,i),o(e.intensity,0,0,0);let s=!1;const u=S,l=d,m=j;u.length=0,l.length=0,m.length=0;for(const o of t)o instanceof f&&!s?(r(e.direction,o.direction),r(e.intensity,o.intensity),e.specularStrength=o.specularStrength,e.environmentStrength=o.environmentStrength,e.castShadows=o.castShadows,s=!0):o instanceof f||o instanceof h?u.push(o):o instanceof a?l.push(o):o instanceof g&&m.push(o);b(u,i),y(l,i);for(const o of m)c(i.r,o.r),c(i.g,o.g),c(i.b,o.b)}const S=[],d=[],j=[],v=[0],I=[0],P=e(),w=[3.141593,2.094395,2.094395,2.094395,.785398,.785398,.785398,.785398,.785398];export{M as combineLights,m as computeCoefficients,p as initSHCoefficients,u as numberOfCoefficients,l as orderFromNumberOfCoefficients,y as projectAmbientLights,b as projectFillLights};
|
|
@@ -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 has from"../../../../core/has.js";import{s as e,c as t,n as r,f as s,l as a,h as i,
|
|
5
|
+
import has from"../../../../core/has.js";import{s as e,c as t,n as r,f as s,l as a,h as i,k as o,t as n}from"../../../../chunks/vec32.js";import{create as h,fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as c}from"../../../ViewingMode.js";import{newLayout as u}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutput as m,isShadowRelatedOutput as p,ShaderOutput as f}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as d}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{NormalsDoubleSidedMode as g}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as T}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{CullFaceOptions as _}from"../lib/basicInterfaces.js";import{GLTextureMaterial as x}from"../lib/GLTextureMaterial.js";import{Material as b}from"../lib/Material.js";import{OITPolygonOffsetLimit as v}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as S}from"../lib/RenderSlot.js";import{VertexAttribute as O}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as w}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as M}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as C,intersectTriangleGeometry as y}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as A,DefaultMaterialPassParameters as R}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as I}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as P}from"../shaders/RealisticTreeTechnique.js";class E extends b{constructor(e){super(e,D),this.supportsEdges=!0,this.produces=new Map([[S.OPAQUE_MATERIAL,e=>(m(e)||p(e))&&!this.parameters.transparent],[S.TRANSPARENT_MATERIAL,e=>(m(e)||p(e))&&this.parameters.transparent&&this.parameters.writeDepth],[S.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>(m(e)||p(e))&&this.parameters.transparent&&!this.parameters.writeDepth]]),this._configuration=new I,this._vertexBufferLayout=N(this.parameters)}isVisibleForOutput(e){return e!==f.Shadow&&e!==f.ShadowExcludeHighlight&&e!==f.ShadowHighlight||this.parameters.castShadows}isVisible(){const e=this.parameters;if(!super.isVisible()||0===e.layerOpacity)return!1;const{hasInstancedColor:t,hasVertexColors:r,hasSymbolColors:s,vvColor:a}=e,i="replace"===e.colorMixMode,o=e.opacity>0,n=e.externalColor&&e.externalColor[3]>0,h=t||a||s;return r&&h?i||o:r?i?n:o:h?i||o:i?n:o}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasNormalTexture=!!this.parameters.normalTextureId,this._configuration.hasColorTexture=!!this.parameters.textureId,this._configuration.hasVertexTangents=this.parameters.hasVertexTangents,this._configuration.instanced=this.parameters.isInstanced,this._configuration.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasSliceHighlight=this.parameters.hasSliceHighlight,this._configuration.alphaDiscardMode=this.parameters.textureAlphaMode,this._configuration.normalType=this.parameters.normalType,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,null!=this.parameters.customDepthTest&&(this._configuration.customDepthTest=this.parameters.customDepthTest),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?_.None:this.parameters.cullFace,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.hasModelTransformation=null!=this.parameters.modelTransformation,e!==f.Color&&e!==f.Alpha||(this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this._configuration.doubleSidedMode=g.WindingOrder:this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?g.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?g.WindingOrder:g.None,this._configuration.instancedColor=this.parameters.hasInstancedColor,this._configuration.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this._configuration.receiveAmbientOcclusion=this.parameters.receiveAmbientOcclusion&&null!=t.ssao,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this._configuration.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?T.Schematic:T.Normal:T.Disabled,this._configuration.hasMetallicRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this._configuration.hasEmissionTexture=!!this.parameters.emissiveTextureId,this._configuration.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<v,this._configuration.snowCover=this.hasSnowCover(t),this._configuration.hasColorTextureTransform=!!this.parameters.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!this.parameters.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!this.parameters.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!this.parameters.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!this.parameters.metallicRoughnessTextureTransformMatrix),this._configuration}hasSnowCover(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}intersect(h,l,u,m,p,f){if(null!=this.parameters.verticalOffset){const h=u.camera;e(H,l[12],l[13],l[14]);let f=null;switch(u.viewingMode){case c.Global:f=r(G,H);break;case c.Local:f=t(G,z)}let d=0;const g=s(W,H,h.eye),T=a(g),_=i(g,g,1/T);let x=null;this.parameters.screenSizePerspective&&(x=o(f,_)),d+=C(h,T,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective),i(f,f,d),n(k,f,u.transform.inverseRotation),m=s(V,m,k),p=s(B,p,k)}y(h,u,m,p,w(u.verticalOffset),f)}createGLMaterial(e){return new j(e)}createBufferWriter(){return new M(this._vertexBufferLayout)}}class j extends x{constructor(e){super({...e,...e.material.parameters})}_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMap.enabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(t){this._output!==f.Color&&this._output!==f.Alpha||(this._updateShadowState(t),this._updateOccludeeState(t));const r=this._material.parameters;this.updateTexture(r.textureId);const s=t.camera.viewInverseTransposeMatrix;return e(r.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(r.treeRendering?P:A,t)}}class L extends R{constructor(){super(...arguments),this.initTextureTransparent=!1,this.treeRendering=!1,this.hasVertexTangents=!1}}const D=new L;function N(e){const t=u().vec3f(O.POSITION);e.normalType===d.Compressed?t.vec2i16(O.NORMALCOMPRESSED,{glNormalized:!0}):t.vec3f(O.NORMAL),e.hasVertexTangents&&t.vec4f(O.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&t.vec2f(O.UV0),e.hasVertexColors&&t.vec4u8(O.COLOR),e.hasSymbolColors&&t.vec4u8(O.SYMBOLCOLOR),has("enable-feature:objectAndLayerId-rendering")&&t.vec4u8(O.OBJECTANDLAYERIDCOLOR),t}const V=h(),B=h(),z=l(0,0,1),G=h(),k=h(),H=h(),W=h();export{j as DefaultGLMaterial,E as DefaultMaterial,L as DefaultMaterialParameters};
|
|
@@ -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 has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{fromMat4 as t}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as n,e as o,n as l,f as c,h as f,c as p,l as u,p as m,t as h,j as d,g}from"../../../../chunks/vec32.js";import{create as S,fromValues as O}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as b,create as A,fromValues as T}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMat4 as v}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as E}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as I}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as _}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as y}from"../../support/debugFlags.js";import{newLayout as R}from"../../support/buffer/InterleavedLayout.js";import{isColorAlphaHighlightOrOID as x,ShaderOutput as P}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as C}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterial as D,GLTextureMaterialBindParameters as j}from"../lib/GLTextureMaterial.js";import{Material as L,RenderOccludedFlag as N}from"../lib/Material.js";import{RenderSlot as U}from"../lib/RenderSlot.js";import{applyScaleFactor as w,applyPrecomputedScaleFactor as F,precomputeScaleFactor as M}from"../lib/screenSizePerspectiveUtils.js";import{assert as z}from"../lib/Util.js";import{VertexAttribute as V}from"../lib/VertexAttribute.js";import{ScaleInfo as B}from"./ScaleInfo.js";import{writePosition as G,writeNormal as W,writeColor as q,writeBufferVec4 as H,writeBufferVec4Zeros as X,writeObjectAndLayerIdColor as Y}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as Z}from"./internal/MaterialUtil.js";import{c as k}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as J}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as K}from"../shaders/HUDMaterialTechniqueConfiguration.js";class Q extends L{constructor(e){super(e,new Ae),this._configuration=new K,this.produces=new Map([[U.HUD_MATERIAL,e=>x(e)&&!this.parameters.drawInSecondSlot],[U.LABEL_MATERIAL,e=>x(e)&&this.parameters.drawInSecondSlot],[U.OCCLUSION_PIXELS,()=>this.parameters.occlusionTest],[U.DRAPED_MATERIAL,e=>x(e)]])}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=this.parameters.draped,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===U.OCCLUSION_PIXELS&&this.parameters.occlusionTest,e===P.Color&&(this._configuration.debugDrawLabelBorder=!!y.LABELS_SHOW_BORDER),this._configuration.depthEnabled=this.parameters.depthEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,r,i,a,h,d){if(!(i.options.selectionMode&&i.options.hud&&e.visible&&i.point))return;const g=this.parameters,O=i.point,b=i.camera;let{scaleX:A,scaleY:T}=this._getScreenScale(e);A*=b.pixelRatio,T*=b.pixelRatio,t(ce,r),e.attributes.has(V.FEATUREATTRIBUTE)&&te(ce);const v=e.attributes.get(V.POSITION),E=e.attributes.get(V.SIZE),I=e.attributes.get(V.NORMAL),_=e.attributes.get(V.CENTEROFFSETANDDISTANCE);z(v.size>=3);const y=k(g),R="screen"===this.parameters.centerOffsetUnits;for(let t=0;t<v.data.length/v.size;t++){const e=t*v.size;n(ie,v.data[e],v.data[e+1],v.data[e+2]),o(ie,ie,r);const a=t*E.size;Oe[0]=E.data[a]*A,Oe[1]=E.data[a+1]*T,o(ie,ie,b.viewMatrix);const h=t*_.size;if(n(ue,_.data[h],_.data[h+1],_.data[h+2]),!R&&(ie[0]+=ue[0],ie[1]+=ue[1],0!==ue[2])){const e=ue[2];l(ue,ie),c(ie,ie,f(ue,ue,e))}const x=t*I.size;if(n(ae,I.data[x],I.data[x+1],I.data[x+2]),this._normalAndViewAngle(ae,ce,b,de),this._applyVerticalOffsetTransformationView(ie,de,b,se),b.applyProjection(ie,ne),ne[0]>-1){R&&(ue[0]||ue[1])&&(ne[0]+=ue[0]*b.pixelRatio,0!==ue[1]&&(ne[1]+=w(ue[1],se.factorAlignment)*b.pixelRatio),b.unapplyProjection(ne,ie)),ne[0]+=this.parameters.screenOffset[0]*b.pixelRatio,ne[1]+=this.parameters.screenOffset[1]*b.pixelRatio,ne[0]=Math.floor(ne[0]),ne[1]=Math.floor(ne[1]),F(Oe,se.factor,Oe);const e=ge*b.pixelRatio;let t=0;if(g.textureIsSignedDistanceField&&(t=g.outlineSize*b.pixelRatio/2),re(O,ne[0],ne[1],Oe,e,t,g,y)){const e=i.ray;if(o(le,ie,s(pe,b.viewMatrix)),ne[0]=O[0],ne[1]=O[1],b.unprojectFromRenderScreen(ne,ie)){const t=S();p(t,e.direction);const r=1/u(t);f(t,t,r);d(m(e.origin,ie)*r,t,-1,!0,1,le)}}}}}intersectDraped(e,t,r,s,i,a){const n=e.attributes.get(V.POSITION),o=e.attributes.get(V.SIZE),l=this.parameters,c=k(l);let{scaleX:f,scaleY:p}=this._getScreenScale(e);f*=e.screenToWorldRatio,p*=e.screenToWorldRatio;const u=Se*e.screenToWorldRatio;for(let m=0;m<n.data.length/n.size;m++){const t=m*n.size,r=n.data[t],h=n.data[t+1],d=m*o.size;Oe[0]=o.data[d]*f,Oe[1]=o.data[d+1]*p;let g=0;l.textureIsSignedDistanceField&&(g=l.outlineSize*e.screenToWorldRatio/2),re(s,r,h,Oe,u,g,l,c)&&i(a.dist,a.normal,-1,!1)}}createBufferWriter(){return new Ee(this)}_normalAndViewAngle(e,r,s,i){return v(r)&&(r=t(fe,r)),h(i.normal,e,r),o(i.normal,i.normal,s.viewInverseTransposeMatrix),i.cosAngle=d(oe,be),i}_updateScaleInfo(e,t,r){const s=this.parameters;null!=s.screenSizePerspective?M(r,t,s.screenSizePerspective,e.factor):(e.factor.scale=1,e.factor.factor=0,e.factor.minScaleFactor=0),null!=s.screenSizePerspectiveAlignment?M(r,t,s.screenSizePerspectiveAlignment,e.factorAlignment):(e.factorAlignment.factor=e.factor.factor,e.factorAlignment.scale=e.factor.scale,e.factorAlignment.minScaleFactor=e.factor.minScaleFactor)}applyShaderOffsetsView(e,t,r,s,i,a,n){const o=this._normalAndViewAngle(t,r,i,de);return this._applyVerticalGroundOffsetView(e,o,i,n),this._applyVerticalOffsetTransformationView(n,o,i,a),this._applyPolygonOffsetView(n,o,s[3],i,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,t,r,s,i){return this._applyCenterOffsetNDC(e,t,r,s),null!=i&&p(i,s),this._applyPolygonOffsetNDC(s,t,r,s),s}_applyPolygonOffsetView(t,r,s,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return p(a,t);const c=e(Math.abs(r.cosAngle),.01,1),u=1-Math.sqrt(1-c*c)/c/i.viewport[2];return f(a,t,l>0?u:1/u),a}_applyVerticalGroundOffsetView(e,t,r,s){const i=u(e),a=r.aboveGround?1:-1,n=r.computeRenderPixelSizeAtDist(i)*C,o=f(ie,t.normal,a*n);return g(s,e,o),s}_applyVerticalOffsetTransformationView(e,t,r,s){const i=this.parameters;if(!i.verticalOffset?.screenLength){if(i.screenSizePerspective||i.screenSizePerspectiveAlignment){const r=u(e);this._updateScaleInfo(s,r,t.cosAngle)}else s.factor.scale=1,s.factorAlignment.scale=1;return e}const a=u(e),n=i.screenSizePerspectiveAlignment??i.screenSizePerspective,o=Z(r,a,i.verticalOffset,t.cosAngle,n);return this._updateScaleInfo(s,a,t.cosAngle),f(t.normal,t.normal,o),g(e,e,t.normal)}_applyCenterOffsetView(e,t,r){const s="screen"!==this.parameters.centerOffsetUnits;return r!==e&&p(r,e),s&&(r[0]+=t[0],r[1]+=t[1],t[2]&&(l(ae,r),g(r,r,f(ae,ae,t[2])))),r}_applyCenterOffsetNDC(e,t,r,s){const i="screen"!==this.parameters.centerOffsetUnits;return s!==e&&p(s,e),i||(s[0]+=t[0]/r.fullWidth*2,s[1]+=t[1]/r.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,r,s){const i=this.parameters.shaderPolygonOffset;if(e!==s&&p(s,e),i){const e=r.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*i}return s}createGLMaterial(e){return new $(e)}calculateRelativeScreenBounds(e,t,r=E()){return ee(this.parameters,e,t,r),r[2]=r[0]+e[0],r[3]=r[1]+e[1],r}_getScreenScale(e){const t=e.attributes.get(V.FEATUREATTRIBUTE);if(null==t)return{scaleX:1,scaleY:1};const r=b(t.data,he),[s,i]=_(me,this.parameters,r);return{scaleX:s,scaleY:i}}}class $ extends D{constructor(e){super({...e,...e.material.parameters})}selectProgram(e){return this.ensureTechnique(J,e)}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.selectProgram(e)}}function ee(e,t,r,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*r,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*r}function te(e){const t=e[0],r=e[1],s=e[2],i=e[3],a=e[4],n=e[5],o=e[6],l=e[7],c=e[8],f=1/Math.sqrt(t*t+r*r+s*s),p=1/Math.sqrt(i*i+a*a+n*n),u=1/Math.sqrt(o*o+l*l+c*c);return e[0]=t*f,e[1]=r*f,e[2]=s*f,e[3]=i*p,e[4]=a*p,e[5]=n*p,e[6]=o*u,e[7]=l*u,e[8]=c*u,e}function re(e,t,r,s,i,a,n,o){let l=t-i-(o[0]>0?s[0]*o[0]:0),c=l+s[0]+2*i,f=r-i-(o[1]>0?s[1]*o[1]:0),p=f+s[1]+2*i;const u=n.distanceFieldBoundingBox;return n.textureIsSignedDistanceField&&null!=u&&(l+=s[0]*u[0],f+=s[1]*u[1],c-=s[0]*(1-u[2]),p-=s[1]*(1-u[3]),l-=a,c+=a,f-=a,p+=a),e[0]>l&&e[0]<c&&e[1]>f&&e[1]<p}const se=new B,ie=S(),ae=S(),ne=A(),oe=S(),le=S(),ce=r(),fe=r(),pe=i(),ue=S(),me=S(),he=A(),de={normal:oe,cosAngle:0},ge=1,Se=2,Oe=[0,0],be=O(0,0,1);class Ae extends j{constructor(){super(...arguments),this.renderOccluded=N.Occlude,this.isDecoration=!1,this.color=T(1,1,1,1),this.texCoordScale=[1,1],this.polygonOffset=!1,this.anchorPosition=a(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=T(1,1,1,1),this.outlineSize=0,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.centerOffsetUnits="world",this.drawInSecondSlot=!1,this.depthEnabled=!0,this.draped=!1}}const Te=R().vec3f(V.POSITION).vec3f(V.NORMAL).vec2f(V.UV0).vec4u8(V.COLOR).vec2f(V.SIZE).vec4f(V.CENTEROFFSETANDDISTANCE).vec4f(V.FEATUREATTRIBUTE),ve=Te.clone().vec4u8(V.OBJECTANDLAYERIDCOLOR);class Ee{constructor(e){this._material=e,this.vertexBufferLayout=has("enable-feature:objectAndLayerId-rendering")?ve:Te}elementCount(e){return 6*e.attributes.get(V.POSITION).indices.length}write(e,t,r,s,i){G(r.attributes.get(V.POSITION),e,s.position,i,6),W(r.attributes.get(V.NORMAL),t,s.normal,i,6);const a=r.attributes.get(V.UV0).data;let n,o,l,c;if(null==a||a.length<4){const e=this._material.parameters;n=0,o=0,l=e.texCoordScale[0],c=e.texCoordScale[1]}else n=a[0],o=a[1],l=a[2],c=a[3];l=Math.min(1.99999,l+1),c=Math.min(1.99999,c+1);let f=r.attributes.get(V.POSITION).indices.length,p=i;const u=s.uv0;for(let g=0;g<f;++g)u.set(p,0,n),u.set(p,1,o),p++,u.set(p,0,l),u.set(p,1,o),p++,u.set(p,0,l),u.set(p,1,c),p++,u.set(p,0,l),u.set(p,1,c),p++,u.set(p,0,n),u.set(p,1,c),p++,u.set(p,0,n),u.set(p,1,o),p++;q(r.attributes.get(V.COLOR),4,s.color,i,6);const{data:m,indices:h}=r.attributes.get(V.SIZE);f=h.length;const d=s.size;p=i;for(let g=0;g<f;++g){const e=m[2*h[g]],t=m[2*h[g]+1];for(let r=0;r<6;++r)d.set(p,0,e),d.set(p,1,t),p++}if(r.attributes.get(V.CENTEROFFSETANDDISTANCE)?H(r.attributes.get(V.CENTEROFFSETANDDISTANCE),s.centerOffsetAndDistance,i,6):X(s.centerOffsetAndDistance,i,6*f),r.attributes.get(V.FEATUREATTRIBUTE)?H(r.attributes.get(V.FEATUREATTRIBUTE),s.featureAttribute,i,6):X(s.featureAttribute,i,6*f),null!=r.objectAndLayerIdColor){const e=r.attributes.get(V.POSITION)?.indices;if(e){const t=e.length,a=s.getField(V.OBJECTANDLAYERIDCOLOR,I);Y(r.objectAndLayerIdColor,a,t,i,6)}}}}export{Q as HUDMaterial,Ae as Parameters};
|
|
5
|
+
import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{fromMat4 as t}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as n,e as o,n as l,f as c,h as f,c as p,l as u,q as m,t as h,k as d,g}from"../../../../chunks/vec32.js";import{create as S,fromValues as O}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as b,create as A,fromValues as T}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMat4 as v}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as E}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as I}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as _}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as y}from"../../support/debugFlags.js";import{newLayout as R}from"../../support/buffer/InterleavedLayout.js";import{isColorAlphaHighlightOrOID as x,ShaderOutput as P}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as C}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterial as D,GLTextureMaterialBindParameters as j}from"../lib/GLTextureMaterial.js";import{Material as L,RenderOccludedFlag as N}from"../lib/Material.js";import{RenderSlot as U}from"../lib/RenderSlot.js";import{applyScaleFactor as w,applyPrecomputedScaleFactor as F,precomputeScaleFactor as M}from"../lib/screenSizePerspectiveUtils.js";import{assert as z}from"../lib/Util.js";import{VertexAttribute as V}from"../lib/VertexAttribute.js";import{ScaleInfo as B}from"./ScaleInfo.js";import{writePosition as G,writeNormal as q,writeColor as W,writeBufferVec4 as H,writeBufferVec4Zeros as X,writeObjectAndLayerIdColor as Y}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as Z}from"./internal/MaterialUtil.js";import{c as k}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as J}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as K}from"../shaders/HUDMaterialTechniqueConfiguration.js";class Q extends L{constructor(e){super(e,new Ae),this._configuration=new K,this.produces=new Map([[U.HUD_MATERIAL,e=>x(e)&&!this.parameters.drawInSecondSlot],[U.LABEL_MATERIAL,e=>x(e)&&this.parameters.drawInSecondSlot],[U.OCCLUSION_PIXELS,()=>this.parameters.occlusionTest],[U.DRAPED_MATERIAL,e=>x(e)]])}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=this.parameters.draped,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===U.OCCLUSION_PIXELS&&this.parameters.occlusionTest,e===P.Color&&(this._configuration.debugDrawLabelBorder=!!y.LABELS_SHOW_BORDER),this._configuration.depthEnabled=this.parameters.depthEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,r,i,a,h,d){if(!(i.options.selectionMode&&i.options.hud&&e.visible&&i.point))return;const g=this.parameters,O=i.point,b=i.camera;let{scaleX:A,scaleY:T}=this._getScreenScale(e);A*=b.pixelRatio,T*=b.pixelRatio,t(ce,r),e.attributes.has(V.FEATUREATTRIBUTE)&&te(ce);const v=e.attributes.get(V.POSITION),E=e.attributes.get(V.SIZE),I=e.attributes.get(V.NORMAL),_=e.attributes.get(V.CENTEROFFSETANDDISTANCE);z(v.size>=3);const y=k(g),R="screen"===this.parameters.centerOffsetUnits;for(let t=0;t<v.data.length/v.size;t++){const e=t*v.size;n(ie,v.data[e],v.data[e+1],v.data[e+2]),o(ie,ie,r);const a=t*E.size;Oe[0]=E.data[a]*A,Oe[1]=E.data[a+1]*T,o(ie,ie,b.viewMatrix);const h=t*_.size;if(n(ue,_.data[h],_.data[h+1],_.data[h+2]),!R&&(ie[0]+=ue[0],ie[1]+=ue[1],0!==ue[2])){const e=ue[2];l(ue,ie),c(ie,ie,f(ue,ue,e))}const x=t*I.size;if(n(ae,I.data[x],I.data[x+1],I.data[x+2]),this._normalAndViewAngle(ae,ce,b,de),this._applyVerticalOffsetTransformationView(ie,de,b,se),b.applyProjection(ie,ne),ne[0]>-1){R&&(ue[0]||ue[1])&&(ne[0]+=ue[0]*b.pixelRatio,0!==ue[1]&&(ne[1]+=w(ue[1],se.factorAlignment)*b.pixelRatio),b.unapplyProjection(ne,ie)),ne[0]+=this.parameters.screenOffset[0]*b.pixelRatio,ne[1]+=this.parameters.screenOffset[1]*b.pixelRatio,ne[0]=Math.floor(ne[0]),ne[1]=Math.floor(ne[1]),F(Oe,se.factor,Oe);const e=ge*b.pixelRatio;let t=0;if(g.textureIsSignedDistanceField&&(t=g.outlineSize*b.pixelRatio/2),re(O,ne[0],ne[1],Oe,e,t,g,y)){const e=i.ray;if(o(le,ie,s(pe,b.viewMatrix)),ne[0]=O[0],ne[1]=O[1],b.unprojectFromRenderScreen(ne,ie)){const t=S();p(t,e.direction);const r=1/u(t);f(t,t,r);d(m(e.origin,ie)*r,t,-1,!0,1,le)}}}}}intersectDraped(e,t,r,s,i,a){const n=e.attributes.get(V.POSITION),o=e.attributes.get(V.SIZE),l=this.parameters,c=k(l);let{scaleX:f,scaleY:p}=this._getScreenScale(e);f*=e.screenToWorldRatio,p*=e.screenToWorldRatio;const u=Se*e.screenToWorldRatio;for(let m=0;m<n.data.length/n.size;m++){const t=m*n.size,r=n.data[t],h=n.data[t+1],d=m*o.size;Oe[0]=o.data[d]*f,Oe[1]=o.data[d+1]*p;let g=0;l.textureIsSignedDistanceField&&(g=l.outlineSize*e.screenToWorldRatio/2),re(s,r,h,Oe,u,g,l,c)&&i(a.dist,a.normal,-1,!1)}}createBufferWriter(){return new Ee(this)}_normalAndViewAngle(e,r,s,i){return v(r)&&(r=t(fe,r)),h(i.normal,e,r),o(i.normal,i.normal,s.viewInverseTransposeMatrix),i.cosAngle=d(oe,be),i}_updateScaleInfo(e,t,r){const s=this.parameters;null!=s.screenSizePerspective?M(r,t,s.screenSizePerspective,e.factor):(e.factor.scale=1,e.factor.factor=0,e.factor.minScaleFactor=0),null!=s.screenSizePerspectiveAlignment?M(r,t,s.screenSizePerspectiveAlignment,e.factorAlignment):(e.factorAlignment.factor=e.factor.factor,e.factorAlignment.scale=e.factor.scale,e.factorAlignment.minScaleFactor=e.factor.minScaleFactor)}applyShaderOffsetsView(e,t,r,s,i,a,n){const o=this._normalAndViewAngle(t,r,i,de);return this._applyVerticalGroundOffsetView(e,o,i,n),this._applyVerticalOffsetTransformationView(n,o,i,a),this._applyPolygonOffsetView(n,o,s[3],i,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,t,r,s,i){return this._applyCenterOffsetNDC(e,t,r,s),null!=i&&p(i,s),this._applyPolygonOffsetNDC(s,t,r,s),s}_applyPolygonOffsetView(t,r,s,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return p(a,t);const c=e(Math.abs(r.cosAngle),.01,1),u=1-Math.sqrt(1-c*c)/c/i.viewport[2];return f(a,t,l>0?u:1/u),a}_applyVerticalGroundOffsetView(e,t,r,s){const i=u(e),a=r.aboveGround?1:-1,n=r.computeRenderPixelSizeAtDist(i)*C,o=f(ie,t.normal,a*n);return g(s,e,o),s}_applyVerticalOffsetTransformationView(e,t,r,s){const i=this.parameters;if(!i.verticalOffset?.screenLength){if(i.screenSizePerspective||i.screenSizePerspectiveAlignment){const r=u(e);this._updateScaleInfo(s,r,t.cosAngle)}else s.factor.scale=1,s.factorAlignment.scale=1;return e}const a=u(e),n=i.screenSizePerspectiveAlignment??i.screenSizePerspective,o=Z(r,a,i.verticalOffset,t.cosAngle,n);return this._updateScaleInfo(s,a,t.cosAngle),f(t.normal,t.normal,o),g(e,e,t.normal)}_applyCenterOffsetView(e,t,r){const s="screen"!==this.parameters.centerOffsetUnits;return r!==e&&p(r,e),s&&(r[0]+=t[0],r[1]+=t[1],t[2]&&(l(ae,r),g(r,r,f(ae,ae,t[2])))),r}_applyCenterOffsetNDC(e,t,r,s){const i="screen"!==this.parameters.centerOffsetUnits;return s!==e&&p(s,e),i||(s[0]+=t[0]/r.fullWidth*2,s[1]+=t[1]/r.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,r,s){const i=this.parameters.shaderPolygonOffset;if(e!==s&&p(s,e),i){const e=r.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*i}return s}createGLMaterial(e){return new $(e)}calculateRelativeScreenBounds(e,t,r=E()){return ee(this.parameters,e,t,r),r[2]=r[0]+e[0],r[3]=r[1]+e[1],r}_getScreenScale(e){const t=e.attributes.get(V.FEATUREATTRIBUTE);if(null==t)return{scaleX:1,scaleY:1};const r=b(t.data,he),[s,i]=_(me,this.parameters,r);return{scaleX:s,scaleY:i}}}class $ extends D{constructor(e){super({...e,...e.material.parameters})}selectProgram(e){return this.ensureTechnique(J,e)}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.selectProgram(e)}}function ee(e,t,r,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*r,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*r}function te(e){const t=e[0],r=e[1],s=e[2],i=e[3],a=e[4],n=e[5],o=e[6],l=e[7],c=e[8],f=1/Math.sqrt(t*t+r*r+s*s),p=1/Math.sqrt(i*i+a*a+n*n),u=1/Math.sqrt(o*o+l*l+c*c);return e[0]=t*f,e[1]=r*f,e[2]=s*f,e[3]=i*p,e[4]=a*p,e[5]=n*p,e[6]=o*u,e[7]=l*u,e[8]=c*u,e}function re(e,t,r,s,i,a,n,o){let l=t-i-(o[0]>0?s[0]*o[0]:0),c=l+s[0]+2*i,f=r-i-(o[1]>0?s[1]*o[1]:0),p=f+s[1]+2*i;const u=n.distanceFieldBoundingBox;return n.textureIsSignedDistanceField&&null!=u&&(l+=s[0]*u[0],f+=s[1]*u[1],c-=s[0]*(1-u[2]),p-=s[1]*(1-u[3]),l-=a,c+=a,f-=a,p+=a),e[0]>l&&e[0]<c&&e[1]>f&&e[1]<p}const se=new B,ie=S(),ae=S(),ne=A(),oe=S(),le=S(),ce=r(),fe=r(),pe=i(),ue=S(),me=S(),he=A(),de={normal:oe,cosAngle:0},ge=1,Se=2,Oe=[0,0],be=O(0,0,1);class Ae extends j{constructor(){super(...arguments),this.renderOccluded=N.Occlude,this.isDecoration=!1,this.color=T(1,1,1,1),this.texCoordScale=[1,1],this.polygonOffset=!1,this.anchorPosition=a(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=T(1,1,1,1),this.outlineSize=0,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.centerOffsetUnits="world",this.drawInSecondSlot=!1,this.depthEnabled=!0,this.draped=!1}}const Te=R().vec3f(V.POSITION).vec3f(V.NORMAL).vec2f(V.UV0).vec4u8(V.COLOR).vec2f(V.SIZE).vec4f(V.CENTEROFFSETANDDISTANCE).vec4f(V.FEATUREATTRIBUTE),ve=Te.clone().vec4u8(V.OBJECTANDLAYERIDCOLOR);class Ee{constructor(e){this._material=e,this.vertexBufferLayout=has("enable-feature:objectAndLayerId-rendering")?ve:Te}elementCount(e){return 6*e.attributes.get(V.POSITION).indices.length}write(e,t,r,s,i){G(r.attributes.get(V.POSITION),e,s.position,i,6),q(r.attributes.get(V.NORMAL),t,s.normal,i,6);const a=r.attributes.get(V.UV0).data;let n,o,l,c;if(null==a||a.length<4){const e=this._material.parameters;n=0,o=0,l=e.texCoordScale[0],c=e.texCoordScale[1]}else n=a[0],o=a[1],l=a[2],c=a[3];l=Math.min(1.99999,l+1),c=Math.min(1.99999,c+1);let f=r.attributes.get(V.POSITION).indices.length,p=i;const u=s.uv0;for(let g=0;g<f;++g)u.set(p,0,n),u.set(p,1,o),p++,u.set(p,0,l),u.set(p,1,o),p++,u.set(p,0,l),u.set(p,1,c),p++,u.set(p,0,l),u.set(p,1,c),p++,u.set(p,0,n),u.set(p,1,c),p++,u.set(p,0,n),u.set(p,1,o),p++;W(r.attributes.get(V.COLOR),4,s.color,i,6);const{data:m,indices:h}=r.attributes.get(V.SIZE);f=h.length;const d=s.size;p=i;for(let g=0;g<f;++g){const e=m[2*h[g]],t=m[2*h[g]+1];for(let r=0;r<6;++r)d.set(p,0,e),d.set(p,1,t),p++}if(r.attributes.get(V.CENTEROFFSETANDDISTANCE)?H(r.attributes.get(V.CENTEROFFSETANDDISTANCE),s.centerOffsetAndDistance,i,6):X(s.centerOffsetAndDistance,i,6*f),r.attributes.get(V.FEATUREATTRIBUTE)?H(r.attributes.get(V.FEATUREATTRIBUTE),s.featureAttribute,i,6):X(s.featureAttribute,i,6*f),null!=r.objectAndLayerIdColor){const e=r.attributes.get(V.POSITION)?.indices;if(e){const t=e.length,a=s.getField(V.OBJECTANDLAYERIDCOLOR,I);Y(r.objectAndLayerIdColor,a,t,i,6)}}}}export{Q as HUDMaterial,Ae as Parameters};
|
|
@@ -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{s as e,
|
|
5
|
+
import{s as e,G as t,e as r}from"../../../../chunks/vec32.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as s,isColorOrAlpha as n,isColorAlphaHighlightOrDepth as o}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as h}from"../lib/GLTextureMaterial.js";import{Material as c,RenderOccludedFlag as u}from"../lib/Material.js";import{RenderSlot as p}from"../lib/RenderSlot.js";import{VertexAttribute as l}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as m}from"./VisualVariablePassParameters.js";import{vertexAttributeLocations as d,LineMarkerTechnique as T}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as _,LineMarkerSpace as f,LineMarkerAnchor as A}from"../shaders/LineMarkerTechniqueConfiguration.js";import{CapType as E}from"../shaders/RibbonLineTechniqueConfiguration.js";class v extends c{constructor(e){super(e,new S),this.produces=new Map([[p.OPAQUE_MATERIAL,e=>e===s.Highlight||n(e)&&this.parameters.renderOccluded===u.OccludeAndTransparentStencil],[p.OPAQUE_NO_SSAO_DEPTH,e=>e===s.LinearDepth],[p.OCCLUDER_MATERIAL,e=>o(e)&&this.parameters.renderOccluded===u.OccludeAndTransparentStencil],[p.TRANSPARENT_OCCLUDER_MATERIAL,e=>o(e)&&this.parameters.renderOccluded===u.OccludeAndTransparentStencil],[p.TRANSPARENT_MATERIAL,e=>n(e)&&this.parameters.writeDepth],[p.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>n(e)&&!this.parameters.writeDepth],[p.DRAPED_MATERIAL,e=>e===s.Color||e===s.Highlight]]),this._vertexAttributeLocations=d,this._configuration=new _,this._layout=this.createLayout()}getConfiguration(e,t){return this._configuration.output=e,this._configuration.space=t.slot===p.DRAPED_MATERIAL?f.Draped:this.parameters.worldSpace?f.World:f.Screen,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==E.BUTT,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.occluder=this.parameters.renderOccluded===u.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(){}createLayout(){const e=i().vec3f(l.POSITION).vec3f(l.PREVPOSITION).vec2f(l.UV0);return this.parameters.worldSpace&&e.vec3f(l.NORMAL),this.parameters.vvSize?e.f32(l.SIZEFEATUREATTRIBUTE):e.f32(l.SIZE),this.parameters.vvColor?e.f32(l.COLORFEATUREATTRIBUTE):e.vec4f(l.COLOR),this.parameters.vvOpacity&&e.f32(l.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new g(this._layout,this.parameters)}createGLMaterial(e){return new O(e)}}class O extends h{constructor(){super(...arguments),this._markerPrimitive=null}dispose(){super.dispose(),this._markerTextureRepository.release(this._markerPrimitive),this._markerPrimitive=null}_updateParameters(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextureRepository.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(T,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==s.Color&&this._output!==s.Alpha||this._updateOccludeeState(e),this._updateParameters(e)}}class S extends m{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=E.BUTT,this.anchor=A.Center,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.hasOccludees=!1,this.markerTexture=null}}class g{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(a,i,s,n,o){const h=s.attributes.get(l.POSITION).data,c=h.length/3;let u=[1,0,0];const p=s.attributes.get(l.NORMAL);this._parameters.worldSpace&&null!=p&&(u=p.data);let m=1,d=0;this._parameters.vvSize?d=s.attributes.get(l.SIZEFEATUREATTRIBUTE).data[0]:s.attributes.has(l.SIZE)&&(m=s.attributes.get(l.SIZE).data[0]);let T=[1,1,1,1],_=0;this._parameters.vvColor?_=s.attributes.get(l.COLORFEATUREATTRIBUTE).data[0]:s.attributes.has(l.COLOR)&&(T=s.attributes.get(l.COLOR).data);let f=0;this._parameters.vvOpacity&&(f=s.attributes.get(l.OPACITYFEATUREATTRIBUTE).data[0]);const A=new Float32Array(n.buffer);let E=o*(this.vertexBufferLayout.stride/4);const v=(e,t,r,a)=>{if(A[E++]=e[0],A[E++]=e[1],A[E++]=e[2],A[E++]=t[0],A[E++]=t[1],A[E++]=t[2],A[E++]=r[0],A[E++]=r[1],this._parameters.worldSpace&&(A[E++]=u[0],A[E++]=u[1],A[E++]=u[2]),this._parameters.vvSize?A[E++]=d:A[E++]=m,this._parameters.vvColor)A[E++]=_;else{const e=Math.min(4*a,T.length-4);A[E++]=T[e],A[E++]=T[e+1],A[E++]=T[e+2],A[E++]=T[e+3]}this._parameters.vvOpacity&&(A[E++]=f)};let O;!function(e){e[e.ASCENDING=1]="ASCENDING",e[e.DESCENDING=-1]="DESCENDING"}(O||(O={}));const S=(i,s)=>{const n=e(R,h[3*i],h[3*i+1],h[3*i+2]),o=P;let u=i+s;do{e(o,h[3*u],h[3*u+1],h[3*u+2]),u+=s}while(t(n,o)&&u>=0&&u<c);a&&(r(n,n,a),r(o,o,a)),v(n,o,[-1,-1],i),v(n,o,[1,-1],i),v(n,o,[1,1],i),v(n,o,[-1,-1],i),v(n,o,[1,1],i),v(n,o,[-1,1],i)},g=this._parameters.placement;"begin"!==g&&"begin-end"!==g||S(0,O.ASCENDING),"end"!==g&&"begin-end"!==g||S(c-1,O.DESCENDING)}}const R=a(),P=a();export{v as LineMarkerMaterial,S as Parameters};
|
|
@@ -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{s as t,n as e,f as r,b as s,
|
|
5
|
+
import{s as t,n as e,f as r,b as s,q as o,e as i}from"../../../../chunks/vec32.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newLayout as c}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as l}from"../core/shaderLibrary/ShaderOutput.js";import u from"../lib/GLMaterial.js";import{Material as p,MaterialParameters as f}from"../lib/Material.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{MeasurementArrowAttributeLocations as g,MeasurementArrowTechniqueConfiguration as d,MeasurementArrowTechnique as b}from"../shaders/MeasurementArrowTechnique.js";class A extends p{constructor(t){super(t,new _),this._vertexAttributeLocations=g,this.produces=new Map([[h.OPAQUE_MATERIAL,t=>!this._transparent&&(t===l.Color||t===l.Alpha)],[h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,t=>this._transparent&&(t===l.Color||t===l.Alpha)]]),this._configuration=new d}getConfiguration(t,e){return this._configuration.polygonOffsetEnabled=this.parameters.polygonOffset,this._configuration.transparent=this._transparent,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration}intersect(){}createGLMaterial(t){return new O(t)}createBufferWriter(){return new j}get _transparent(){const{parameters:t}=this;return t.outlineColor[3]<1||t.stripeEvenColor[3]<1||t.stripeOddColor[3]<1}}class O extends u{beginSlot(t){return this.ensureTechnique(b,t)}}class _ extends f{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=a(1,.5,0,1),this.stripeEvenColor=a(1,1,1,1),this.stripeOddColor=a(1,.5,0,1),this.stripeLength=1,this.polygonOffset=!1}}const T=c().vec3f(m.POSITION).vec3f(m.NORMAL).vec2f(m.UV0).f32(m.LENGTH),L=n(),v=n(),E=n(),I=n(),M=n();class j{constructor(){this.vertexBufferLayout=T}elementCount(t){return 2*(t.attributes.get(m.POSITION).indices.length/2+1)}write(n,a,c,l,u){const{data:p,indices:f}=c.attributes.get(m.POSITION),h=c.attributes.get(m.NORMAL).data,g=p.length/3;f&&f.length!==2*(g-1)&&console.warn("MeasurementArrowMaterial does not support indices");const d=L,b=v,A=E,O=I,_=M,T=l.position,j=l.normal,w=l.uv0;let y=0;for(let m=0;m<g;++m){const c=3*m;if(t(d,p[c],p[c+1],p[c+2]),m<g-1){const o=3*(m+1);t(b,p[o],p[o+1],p[o+2]),t(_,h[o],h[o+1],h[o+2]),e(_,_),r(A,b,d),e(A,A),s(O,_,A),e(O,O)}const l=o(d,b);n&&a&&(i(d,d,n),i(b,b,n),i(O,O,a));const f=u+2*m,L=f+1;T.setVec(f,d),T.setVec(L,d),j.setVec(f,O),j.setVec(L,O),w.set(f,0,y),w.set(f,1,-1),w.set(L,0,y),w.set(L,1,1),m<g-1&&(y+=l)}const C=l.length;for(let t=0;t<2*g;++t)C.set(u+t,y)}}export{A as MeasurementArrowMaterial,_ as Parameters};
|
|
@@ -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{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{s as o,f as i,
|
|
5
|
+
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{s as o,f as i,k as a,h as n,g as c,c as l,l as m,q as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as h}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{PlaneIndex as p}from"../../../../geometry/support/frustum.js";import{create as d,distance2 as g,fromPoints as j,closestLineSegmentPoint as b}from"../../../../geometry/support/lineSegment.js";import{create as S,fromPoints as O,signedDistance as _,getNormal as A}from"../../../../geometry/support/plane.js";import{ShaderOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import x from"../lib/GLMaterial.js";import{Material as y,MaterialParameters as N}from"../lib/Material.js";import{RenderSlot as R}from"../lib/RenderSlot.js";import{isTranslationMatrix as E}from"../lib/Util.js";import{VertexAttribute as M}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as T}from"./DefaultBufferWriter.js";import{PositionColorLayout as v,PositionLayout as w}from"./DefaultLayouts.js";import{NativeLineTechnique as C}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as P}from"../shaders/NativeLineTechniqueConfiguration.js";class V extends y{constructor(e){super(e,new U),this._configuration=new P,this.produces=new Map([[R.OPAQUE_MATERIAL,e=>e===L.Color||e===L.Highlight||e===L.ObjectAndLayerIdColor]])}getConfiguration(e){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration}intersect(t,r,f,h,d,S){if(!f.options.selectionMode||!t.visible)return;if(!E(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const L=t.attributes.get(M.POSITION).data,x=f.camera,y=Z;s(y,f.point);const N=2;o(z[0],y[0]-N,y[1]+N,0),o(z[1],y[0]+N,y[1]+N,0),o(z[2],y[0]+N,y[1]-N,0),o(z[3],y[0]-N,y[1]-N,0);for(let e=0;e<4;e++)if(!x.unprojectFromRenderScreen(z[e],J[e]))return;O(x.eye,J[0],J[1],K),O(x.eye,J[1],J[2],Y),O(x.eye,J[2],J[3],$),O(x.eye,J[3],J[0],ee);let R=Number.MAX_VALUE,T=0;for(let e=0;e<L.length-5;e+=3){if(q[0]=L[e]+r[12],q[1]=L[e+1]+r[13],q[2]=L[e+2]+r[14],B[0]=L[e+3]+r[12],B[1]=L[e+4]+r[13],B[2]=L[e+5]+r[14],_(K,q)<0&&_(K,B)<0||_(Y,q)<0&&_(Y,B)<0||_($,q)<0&&_($,B)<0||_(ee,q)<0&&_(ee,B)<0)continue;if(x.projectToRenderScreen(q,X),x.projectToRenderScreen(B,k),X[2]<0&&k[2]>0){i(D,q,B);const e=x.frustum,t=-_(e[p.NEAR],q)/a(D,A(e[p.NEAR]));n(D,D,t),c(q,q,D),x.projectToRenderScreen(q,X)}else if(X[2]>0&&k[2]<0){i(D,B,q);const e=x.frustum,t=-_(e[p.NEAR],B)/a(D,A(e[p.NEAR]));n(D,D,t),c(B,B,D),x.projectToRenderScreen(B,k)}else if(X[2]<0&&k[2]<0)continue;X[2]=0,k[2]=0;const t=g(j(X,k,H),y);t<R&&(R=t,l(G,q),l(F,B),T=e/3)}const v=f.rayBegin,w=f.rayEnd;if(R<N*N){let e=Number.MAX_VALUE;if(b(j(G,F,H),j(v,w,Q),W)){i(W,W,v);const t=m(W);n(W,W,1/t),e=t/u(v,w)}S(e,W,T,!1)}}intersectDraped(e,r,s,o,i,a){if(!s.options.selectionMode)return;const n=e.attributes.get(M.POSITION).data,c=e.attributes.get(M.SIZE),l=c?c.data[0]:0,m=o[0],u=o[1],f=((l+1)/2+4)*e.screenToWorldRatio;let h=Number.MAX_VALUE,p=0;for(let d=0;d<n.length-5;d+=3){const e=n[d],r=n[d+1],s=m-e,o=u-r,i=n[d+3]-e,a=n[d+4]-r,c=t((i*s+a*o)/(i*i+a*a),0,1),l=i*c-s,f=a*c-o,g=l*l+f*f;g<h&&(h=g,p=d/3)}h<f*f&&i(a.dist,a.normal,p,!1)}createGLMaterial(e){return new I(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?v:w;return new T(e)}}class I extends x{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output===L.Color&&this._updateOccludeeState(e),this.ensureTechnique(C,e)}}class U extends N{constructor(){super(...arguments),this.color=h,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1,this.hasOccludees=!1}}const q=f(),B=f(),D=f(),W=f(),X=r(),k=r(),G=f(),F=f(),H=d(),Q=d(),Z=f(),z=[r(),r(),r(),r()],J=[f(),f(),f(),f()],K=S(),Y=S(),$=S(),ee=S();export{V as NativeLineMaterial,U as Parameters};
|
|
@@ -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 has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{s as i,f as a,j as n,h as o,g as l,c,l as u,p as h,e as p}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as T,distance2 as _,fromPoints as E,closestLineSegmentPoint as A}from"../../../../geometry/support/lineSegment.js";import{create as R,fromPoints as O,signedDistance as I,getNormal as S}from"../../../../geometry/support/plane.js";import{newLayout as g}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as b,isColorAlphaHighlightOIDOrDepth as v,is2DGeometryOutput as P}from"../core/shaderLibrary/ShaderOutput.js";import L from"../lib/GLMaterial.js";import{Material as N,RenderOccludedFlag as C}from"../lib/Material.js";import{RenderSlot as y}from"../lib/RenderSlot.js";import{isTranslationMatrix as j}from"../lib/Util.js";import{VertexAttribute as D}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as U}from"./VisualVariablePassParameters.js";import{LineMarkerAnchor as F}from"../shaders/LineMarkerTechniqueConfiguration.js";import{r as w}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as B,RibbonLineTechnique as x}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as J,CapType as M}from"../shaders/RibbonLineTechniqueConfiguration.js";var G;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(G||(G={}));class H extends N{constructor(e){super(e,new k),this._configuration=new J,this.produces=new Map([[y.OPAQUE_MATERIAL,e=>e===b.Highlight||e===b.ObjectAndLayerIdColor||(e===b.Color||e===b.Alpha)&&this.parameters.renderOccluded===C.OccludeAndTransparentStencil],[y.OPAQUE_NO_SSAO_DEPTH,e=>e===b.LinearDepth],[y.OCCLUDER_MATERIAL,e=>v(e)&&this.parameters.renderOccluded===C.OccludeAndTransparentStencil],[y.TRANSPARENT_OCCLUDER_MATERIAL,e=>v(e)&&this.parameters.renderOccluded===C.OccludeAndTransparentStencil],[y.TRANSPARENT_MATERIAL,e=>(e===b.Color||e===b.Alpha)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==C.OccludeAndTransparentStencil],[y.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>(e===b.Color||e===b.Alpha)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==C.OccludeAndTransparentStencil],[y.DRAPED_MATERIAL,e=>P(e)]]),this._vertexAttributeLocations=B}getConfiguration(e,t){this._configuration.output=e,this._configuration.draped=t.slot===y.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==b.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&Y(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.occluder=this.parameters.renderOccluded===C.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.wireframe=this.parameters.wireframe,this._configuration}intersectDraped(e,r,s,i,a,n){if(!s.options.selectionMode)return;const o=e.attributes.get(D.POSITION).data,l=e.attributes.get(D.SIZE);let c=this.parameters.width;if(this.parameters.vvSize){const r=e.attributes.get(D.SIZEFEATUREATTRIBUTE).data[0];c*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(c*=l.data[0]);const u=i[0],h=i[1],p=(c/2+4)*e.screenToWorldRatio;let m=Number.MAX_VALUE,f=0;for(let d=0;d<o.length-5;d+=3){const e=o[d],r=o[d+1],s=u-e,i=h-r,a=o[d+3]-e,n=o[d+4]-r,l=t((a*s+n*i)/(a*a+n*n),0,1),c=a*l-s,p=n*l-i,T=c*c+p*p;T<m&&(m=T,f=d/3)}m<p*p&&a(n.dist,n.normal,f,!1)}intersect(r,p,m,f,T,R){if(!m.options.selectionMode||!r.visible)return;if(!j(p))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const g=r.attributes,b=g.get(D.POSITION).data;let v=this.parameters.width;if(this.parameters.vvSize){const e=g.get(D.SIZEFEATUREATTRIBUTE).data[0];v*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else g.has(D.SIZE)&&(v*=g.get(D.SIZE).data[0]);const P=m.camera,L=$;s(L,m.point);const N=v*P.pixelRatio/2+4*P.pixelRatio;i(ce[0],L[0]-N,L[1]+N,0),i(ce[1],L[0]+N,L[1]+N,0),i(ce[2],L[0]+N,L[1]-N,0),i(ce[3],L[0]-N,L[1]-N,0);for(let e=0;e<4;e++)if(!P.unprojectFromRenderScreen(ce[e],ue[e]))return;O(P.eye,ue[0],ue[1],he),O(P.eye,ue[1],ue[2],pe),O(P.eye,ue[2],ue[3],me),O(P.eye,ue[3],ue[0],fe);let C=Number.MAX_VALUE,y=0;const U=W(this.parameters,g)?b.length-2:b.length-5;for(let e=0;e<U;e+=3){q[0]=b[e]+p[12],q[1]=b[e+1]+p[13],q[2]=b[e+2]+p[14];const t=(e+3)%b.length;if(X[0]=b[t]+p[12],X[1]=b[t+1]+p[13],X[2]=b[t+2]+p[14],I(he,q)<0&&I(he,X)<0||I(pe,q)<0&&I(pe,X)<0||I(me,q)<0&&I(me,X)<0||I(fe,q)<0&&I(fe,X)<0)continue;if(P.projectToRenderScreen(q,ee),P.projectToRenderScreen(X,te),ee[2]<0&&te[2]>0){a(Q,q,X);const e=P.frustum,t=-I(e[d.NEAR],q)/n(Q,S(e[d.NEAR]));o(Q,Q,t),l(q,q,Q),P.projectToRenderScreen(q,ee)}else if(ee[2]>0&&te[2]<0){a(Q,X,q);const e=P.frustum,t=-I(e[d.NEAR],X)/n(Q,S(e[d.NEAR]));o(Q,Q,t),l(X,X,Q),P.projectToRenderScreen(X,te)}else if(ee[2]<0&&te[2]<0)continue;ee[2]=0,te[2]=0;const r=_(E(ee,te,ie),L);r<C&&(C=r,c(re,q),c(se,X),y=e/3)}const F=m.rayBegin,w=m.rayEnd;if(C<N*N){let e=Number.MAX_VALUE;if(A(E(re,se,ie),E(F,w,ae),K)){a(K,K,F);const t=u(K);o(K,K,1/t),e=t/h(F,w)}R(e,K,y,!1)}}get _layout(){const e=g().vec3f(D.POSITION).vec3f(D.PREVPOSITION).vec3f(D.NEXTPOSITION).f32(D.SUBDIVISIONFACTOR).vec2f(D.UV0);return this.parameters.vvSize?e.f32(D.SIZEFEATUREATTRIBUTE):e.f32(D.SIZE),this.parameters.vvColor?e.f32(D.COLORFEATUREATTRIBUTE):e.vec4f(D.COLOR),this.parameters.vvOpacity&&e.f32(D.OPACITYFEATUREATTRIBUTE),has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(D.OBJECTANDLAYERIDCOLOR),e}createBufferWriter(){return new V(this._layout,this.parameters)}createGLMaterial(e){return new z(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class z extends L{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output!==b.Color&&this._output!==b.Alpha||this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextureRepository.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.ensureTechnique(x,e)}}class k extends U{constructor(){super(...arguments),this.width=0,this.color=f,this.join="miter",this.cap=M.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.hasOccludees=!1,this.wireframe=!1}}class V{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t,this.numJoinSubdivisions=0;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=w+r}}_isClosed(e){return W(this._parameters,e.attributes)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.attributes.get(D.POSITION).indices.length/2+1,s=this._isClosed(e);let i=s?2:2*t;return i+=((s?r:r-1)-(s?0:1))*(2*this.numJoinSubdivisions+4),i+=2,this._parameters.wireframe&&(i=2+4*(i-2)),i}write(e,t,r,s,a){const n=ne,o=oe,l=le,u=r.attributes.get(D.POSITION),m=u.indices,f=u.data.length/3,d=r.attributes.get(D.DISTANCETOSTART)?.data;m&&m.length!==2*(f-1)&&console.warn("RibbonLineMaterial does not support indices");const T=r.attributes.get(D.SIZEFEATUREATTRIBUTE)?.data[0]??r.attributes.get(D.SIZE)?.data[0]??1;let _=[1,1,1,1],E=0;const A=this.vertexBufferLayout.fields.has(D.COLORFEATUREATTRIBUTE);A?E=r.attributes.get(D.COLORFEATUREATTRIBUTE).data[0]:r.attributes.has(D.COLOR)&&(_=r.attributes.get(D.COLOR).data);const R=has("enable-feature:objectAndLayerId-rendering")?r.objectAndLayerIdColor:null,O=this.vertexBufferLayout.fields.has(D.OPACITYFEATUREATTRIBUTE),I=O?r.attributes.get(D.OPACITYFEATUREATTRIBUTE).data[0]:0,S=new Float32Array(s.buffer),g=has("enable-feature:objectAndLayerId-rendering")?new Uint8Array(s.buffer):null,b=this.vertexBufferLayout.stride/4;let v=a*b;const P=v;let L=0;const N=d?(e,t,r)=>L=d[r]:(e,t,r)=>L+=h(e,t),C=has("enable-feature:objectAndLayerId-rendering"),y=(e,t,r,s,i,a,n)=>{if(S[v++]=t[0],S[v++]=t[1],S[v++]=t[2],S[v++]=e[0],S[v++]=e[1],S[v++]=e[2],S[v++]=r[0],S[v++]=r[1],S[v++]=r[2],S[v++]=s,S[v++]=n,S[v++]=i,S[v++]=T,A)S[v++]=E;else{const e=Math.min(4*a,_.length-4);S[v++]=_[e],S[v++]=_[e+1],S[v++]=_[e+2],S[v++]=_[e+3]}O&&(S[v++]=I),C&&(null!=R&&(g[4*v]=R[0],g[4*v+1]=R[1],g[4*v+2]=R[2],g[4*v+3]=R[3]),v++)};v+=b,i(o,u.data[0],u.data[1],u.data[2]),e&&p(o,o,e);const j=this._isClosed(r);if(j){const t=u.data.length-3;i(n,u.data[t],u.data[t+1],u.data[t+2]),e&&p(n,n,e)}else i(l,u.data[3],u.data[4],u.data[5]),e&&p(l,l,e),y(o,o,l,1,G.LEFT_CAP_START,0,0),y(o,o,l,1,G.RIGHT_CAP_START,0,0),c(n,o),c(o,l);const U=j?0:1,F=j?f:f-1;for(let h=U;h<F;h++){const t=(h+1)%f*3;i(l,u.data[t],u.data[t+1],u.data[t+2]),e&&p(l,l,e),N(n,o,h),y(n,o,l,0,G.LEFT_JOIN_END,h,L),y(n,o,l,0,G.RIGHT_JOIN_END,h,L);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);y(n,o,l,t,G.LEFT_JOIN_END,h,L),y(n,o,l,t,G.RIGHT_JOIN_END,h,L)}y(n,o,l,1,G.LEFT_JOIN_START,h,L),y(n,o,l,1,G.RIGHT_JOIN_START,h,L),c(n,o),c(o,l)}j?(i(l,u.data[3],u.data[4],u.data[5]),e&&p(l,l,e),L=N(n,o,F),y(n,o,l,0,G.LEFT_JOIN_END,U,L),y(n,o,l,0,G.RIGHT_JOIN_END,U,L)):(L=N(n,o,F),y(n,o,o,0,G.LEFT_CAP_END,F,L),y(n,o,o,0,G.RIGHT_CAP_END,F,L)),Z(S,P+b,S,P,b);v=Z(S,v-b,S,v,b),this._parameters.wireframe&&this._addWireframeVertices(s,P,v,b)}_addWireframeVertices(e,t,r,s){const i=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=Z(a,e,i,n,s);for(let l=0;l<a.length-1;l+=2*s)o(l),o(l+2*s),o(l+1*s),o(l+2*s),o(l+1*s),o(l+3*s)}}function Z(e,t,r,s,i){for(let a=0;a<i;a++)r[s++]=e[t++];return s}function W(e,t){if(!e.isClosed)return!1;return t.get(D.POSITION).indices.length>2}function Y(e){return e.anchor===F.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const q=m(),X=m(),Q=m(),K=m(),$=m(),ee=r(),te=r(),re=m(),se=m(),ie=T(),ae=T(),ne=m(),oe=m(),le=m(),ce=[r(),r(),r(),r()],ue=[m(),m(),m(),m()],he=R(),pe=R(),me=R(),fe=R();export{k as Parameters,H as RibbonLineMaterial};
|
|
5
|
+
import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{s as i,f as a,k as n,h as o,g as l,c,l as u,q as h,e as p}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as T,distance2 as _,fromPoints as E,closestLineSegmentPoint as A}from"../../../../geometry/support/lineSegment.js";import{create as R,fromPoints as O,signedDistance as I,getNormal as S}from"../../../../geometry/support/plane.js";import{newLayout as g}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as b,isColorAlphaHighlightOIDOrDepth as v,is2DGeometryOutput as P}from"../core/shaderLibrary/ShaderOutput.js";import L from"../lib/GLMaterial.js";import{Material as N,RenderOccludedFlag as C}from"../lib/Material.js";import{RenderSlot as y}from"../lib/RenderSlot.js";import{isTranslationMatrix as j}from"../lib/Util.js";import{VertexAttribute as D}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as U}from"./VisualVariablePassParameters.js";import{LineMarkerAnchor as F}from"../shaders/LineMarkerTechniqueConfiguration.js";import{r as w}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as B,RibbonLineTechnique as x}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as J,CapType as M}from"../shaders/RibbonLineTechniqueConfiguration.js";var G;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(G||(G={}));class H extends N{constructor(e){super(e,new k),this._configuration=new J,this.produces=new Map([[y.OPAQUE_MATERIAL,e=>e===b.Highlight||e===b.ObjectAndLayerIdColor||(e===b.Color||e===b.Alpha)&&this.parameters.renderOccluded===C.OccludeAndTransparentStencil],[y.OPAQUE_NO_SSAO_DEPTH,e=>e===b.LinearDepth],[y.OCCLUDER_MATERIAL,e=>v(e)&&this.parameters.renderOccluded===C.OccludeAndTransparentStencil],[y.TRANSPARENT_OCCLUDER_MATERIAL,e=>v(e)&&this.parameters.renderOccluded===C.OccludeAndTransparentStencil],[y.TRANSPARENT_MATERIAL,e=>(e===b.Color||e===b.Alpha)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==C.OccludeAndTransparentStencil],[y.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>(e===b.Color||e===b.Alpha)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==C.OccludeAndTransparentStencil],[y.DRAPED_MATERIAL,e=>P(e)]]),this._vertexAttributeLocations=B}getConfiguration(e,t){this._configuration.output=e,this._configuration.draped=t.slot===y.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==b.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&Y(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.occluder=this.parameters.renderOccluded===C.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.wireframe=this.parameters.wireframe,this._configuration}intersectDraped(e,r,s,i,a,n){if(!s.options.selectionMode)return;const o=e.attributes.get(D.POSITION).data,l=e.attributes.get(D.SIZE);let c=this.parameters.width;if(this.parameters.vvSize){const r=e.attributes.get(D.SIZEFEATUREATTRIBUTE).data[0];c*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(c*=l.data[0]);const u=i[0],h=i[1],p=(c/2+4)*e.screenToWorldRatio;let m=Number.MAX_VALUE,f=0;for(let d=0;d<o.length-5;d+=3){const e=o[d],r=o[d+1],s=u-e,i=h-r,a=o[d+3]-e,n=o[d+4]-r,l=t((a*s+n*i)/(a*a+n*n),0,1),c=a*l-s,p=n*l-i,T=c*c+p*p;T<m&&(m=T,f=d/3)}m<p*p&&a(n.dist,n.normal,f,!1)}intersect(r,p,m,f,T,R){if(!m.options.selectionMode||!r.visible)return;if(!j(p))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const g=r.attributes,b=g.get(D.POSITION).data;let v=this.parameters.width;if(this.parameters.vvSize){const e=g.get(D.SIZEFEATUREATTRIBUTE).data[0];v*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else g.has(D.SIZE)&&(v*=g.get(D.SIZE).data[0]);const P=m.camera,L=$;s(L,m.point);const N=v*P.pixelRatio/2+4*P.pixelRatio;i(ce[0],L[0]-N,L[1]+N,0),i(ce[1],L[0]+N,L[1]+N,0),i(ce[2],L[0]+N,L[1]-N,0),i(ce[3],L[0]-N,L[1]-N,0);for(let e=0;e<4;e++)if(!P.unprojectFromRenderScreen(ce[e],ue[e]))return;O(P.eye,ue[0],ue[1],he),O(P.eye,ue[1],ue[2],pe),O(P.eye,ue[2],ue[3],me),O(P.eye,ue[3],ue[0],fe);let C=Number.MAX_VALUE,y=0;const U=W(this.parameters,g)?b.length-2:b.length-5;for(let e=0;e<U;e+=3){q[0]=b[e]+p[12],q[1]=b[e+1]+p[13],q[2]=b[e+2]+p[14];const t=(e+3)%b.length;if(X[0]=b[t]+p[12],X[1]=b[t+1]+p[13],X[2]=b[t+2]+p[14],I(he,q)<0&&I(he,X)<0||I(pe,q)<0&&I(pe,X)<0||I(me,q)<0&&I(me,X)<0||I(fe,q)<0&&I(fe,X)<0)continue;if(P.projectToRenderScreen(q,ee),P.projectToRenderScreen(X,te),ee[2]<0&&te[2]>0){a(Q,q,X);const e=P.frustum,t=-I(e[d.NEAR],q)/n(Q,S(e[d.NEAR]));o(Q,Q,t),l(q,q,Q),P.projectToRenderScreen(q,ee)}else if(ee[2]>0&&te[2]<0){a(Q,X,q);const e=P.frustum,t=-I(e[d.NEAR],X)/n(Q,S(e[d.NEAR]));o(Q,Q,t),l(X,X,Q),P.projectToRenderScreen(X,te)}else if(ee[2]<0&&te[2]<0)continue;ee[2]=0,te[2]=0;const r=_(E(ee,te,ie),L);r<C&&(C=r,c(re,q),c(se,X),y=e/3)}const F=m.rayBegin,w=m.rayEnd;if(C<N*N){let e=Number.MAX_VALUE;if(A(E(re,se,ie),E(F,w,ae),K)){a(K,K,F);const t=u(K);o(K,K,1/t),e=t/h(F,w)}R(e,K,y,!1)}}get _layout(){const e=g().vec3f(D.POSITION).vec3f(D.PREVPOSITION).vec3f(D.NEXTPOSITION).f32(D.SUBDIVISIONFACTOR).vec2f(D.UV0);return this.parameters.vvSize?e.f32(D.SIZEFEATUREATTRIBUTE):e.f32(D.SIZE),this.parameters.vvColor?e.f32(D.COLORFEATUREATTRIBUTE):e.vec4f(D.COLOR),this.parameters.vvOpacity&&e.f32(D.OPACITYFEATUREATTRIBUTE),has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(D.OBJECTANDLAYERIDCOLOR),e}createBufferWriter(){return new V(this._layout,this.parameters)}createGLMaterial(e){return new z(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class z extends L{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output!==b.Color&&this._output!==b.Alpha||this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextureRepository.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.ensureTechnique(x,e)}}class k extends U{constructor(){super(...arguments),this.width=0,this.color=f,this.join="miter",this.cap=M.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.hasOccludees=!1,this.wireframe=!1}}class V{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t,this.numJoinSubdivisions=0;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=w+r}}_isClosed(e){return W(this._parameters,e.attributes)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.attributes.get(D.POSITION).indices.length/2+1,s=this._isClosed(e);let i=s?2:2*t;return i+=((s?r:r-1)-(s?0:1))*(2*this.numJoinSubdivisions+4),i+=2,this._parameters.wireframe&&(i=2+4*(i-2)),i}write(e,t,r,s,a){const n=ne,o=oe,l=le,u=r.attributes.get(D.POSITION),m=u.indices,f=u.data.length/3,d=r.attributes.get(D.DISTANCETOSTART)?.data;m&&m.length!==2*(f-1)&&console.warn("RibbonLineMaterial does not support indices");const T=r.attributes.get(D.SIZEFEATUREATTRIBUTE)?.data[0]??r.attributes.get(D.SIZE)?.data[0]??1;let _=[1,1,1,1],E=0;const A=this.vertexBufferLayout.fields.has(D.COLORFEATUREATTRIBUTE);A?E=r.attributes.get(D.COLORFEATUREATTRIBUTE).data[0]:r.attributes.has(D.COLOR)&&(_=r.attributes.get(D.COLOR).data);const R=has("enable-feature:objectAndLayerId-rendering")?r.objectAndLayerIdColor:null,O=this.vertexBufferLayout.fields.has(D.OPACITYFEATUREATTRIBUTE),I=O?r.attributes.get(D.OPACITYFEATUREATTRIBUTE).data[0]:0,S=new Float32Array(s.buffer),g=has("enable-feature:objectAndLayerId-rendering")?new Uint8Array(s.buffer):null,b=this.vertexBufferLayout.stride/4;let v=a*b;const P=v;let L=0;const N=d?(e,t,r)=>L=d[r]:(e,t,r)=>L+=h(e,t),C=has("enable-feature:objectAndLayerId-rendering"),y=(e,t,r,s,i,a,n)=>{if(S[v++]=t[0],S[v++]=t[1],S[v++]=t[2],S[v++]=e[0],S[v++]=e[1],S[v++]=e[2],S[v++]=r[0],S[v++]=r[1],S[v++]=r[2],S[v++]=s,S[v++]=n,S[v++]=i,S[v++]=T,A)S[v++]=E;else{const e=Math.min(4*a,_.length-4);S[v++]=_[e],S[v++]=_[e+1],S[v++]=_[e+2],S[v++]=_[e+3]}O&&(S[v++]=I),C&&(null!=R&&(g[4*v]=R[0],g[4*v+1]=R[1],g[4*v+2]=R[2],g[4*v+3]=R[3]),v++)};v+=b,i(o,u.data[0],u.data[1],u.data[2]),e&&p(o,o,e);const j=this._isClosed(r);if(j){const t=u.data.length-3;i(n,u.data[t],u.data[t+1],u.data[t+2]),e&&p(n,n,e)}else i(l,u.data[3],u.data[4],u.data[5]),e&&p(l,l,e),y(o,o,l,1,G.LEFT_CAP_START,0,0),y(o,o,l,1,G.RIGHT_CAP_START,0,0),c(n,o),c(o,l);const U=j?0:1,F=j?f:f-1;for(let h=U;h<F;h++){const t=(h+1)%f*3;i(l,u.data[t],u.data[t+1],u.data[t+2]),e&&p(l,l,e),N(n,o,h),y(n,o,l,0,G.LEFT_JOIN_END,h,L),y(n,o,l,0,G.RIGHT_JOIN_END,h,L);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);y(n,o,l,t,G.LEFT_JOIN_END,h,L),y(n,o,l,t,G.RIGHT_JOIN_END,h,L)}y(n,o,l,1,G.LEFT_JOIN_START,h,L),y(n,o,l,1,G.RIGHT_JOIN_START,h,L),c(n,o),c(o,l)}j?(i(l,u.data[3],u.data[4],u.data[5]),e&&p(l,l,e),L=N(n,o,F),y(n,o,l,0,G.LEFT_JOIN_END,U,L),y(n,o,l,0,G.RIGHT_JOIN_END,U,L)):(L=N(n,o,F),y(n,o,o,0,G.LEFT_CAP_END,F,L),y(n,o,o,0,G.RIGHT_CAP_END,F,L)),Z(S,P+b,S,P,b);v=Z(S,v-b,S,v,b),this._parameters.wireframe&&this._addWireframeVertices(s,P,v,b)}_addWireframeVertices(e,t,r,s){const i=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=Z(a,e,i,n,s);for(let l=0;l<a.length-1;l+=2*s)o(l),o(l+2*s),o(l+1*s),o(l+2*s),o(l+1*s),o(l+3*s)}}function Z(e,t,r,s,i){for(let a=0;a<i;a++)r[s++]=e[t++];return s}function W(e,t){if(!e.isClosed)return!1;return t.get(D.POSITION).indices.length>2}function Y(e){return e.anchor===F.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const q=m(),X=m(),Q=m(),K=m(),$=m(),ee=r(),te=r(),re=m(),se=m(),ie=T(),ae=T(),ne=m(),oe=m(),le=m(),ce=[r(),r(),r(),r()],ue=[m(),m(),m(),m()],he=R(),pe=R(),me=R(),fe=R();export{k as Parameters,H as RibbonLineMaterial};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{j as l}from"../../../../chunks/vec32.js";import{ZEROS as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";function u({normalTexture:u,metallicRoughnessTexture:n,metallicFactor:r,roughnessFactor:t,emissiveTexture:o,emissiveFactor:s,occlusionTexture:c}){return null==u&&null==n&&null==o&&(null==s||l(s,e))&&null==c&&(null==t||1===t)&&(null==r||1===r)}function n({normalTexture:u,metallicRoughnessTexture:n,metallicFactor:r,roughnessFactor:t,emissiveTexture:o,emissiveFactor:s,occlusionTexture:c}){return null==u&&null==n&&null==o&&(null==s||l(s,e))&&null==c&&(null==t||1===t)&&(null==r||1===r||0===r)}const r=[1,1,.5],t=[0,.6,.2],o=[0,1,.2];export{r as defaultAdvancedMRRFactors,o as defaultEsriSymbologyMRRFactors,t as defaultSchematicMRRFactors,u as useSchematicPBR,n as useSchematicPBRI3S};
|
|
@@ -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{difference as t,isSome as s}from"../core/arrayUtils.js";import
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{difference as t,isSome as s}from"../core/arrayUtils.js";import o from"../core/Collection.js";import i from"../core/Evented.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{removeMaybe as r}from"../core/maybe.js";import l from"../core/ReactiveMap.js";import{watch as c,on as a}from"../core/reactiveUtils.js";import{symmetricDifference as h}from"../core/SetUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeGroupLayer as p,isSubtypeSublayer as f}from"../layers/support/layerUtils.js";import g from"../rest/support/Query.js";let _=class extends i.EventedAccessor{constructor(e){super(e),this._selectionMap=new l,this._trashCan=[],this._layerEditHandles=new o,this._vizTaskId=0,this.showHighlight=!0}initialize(){this.addHandles([c((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),a((()=>this.sources),"change",(e=>{const t=this._selectionMap;for(const s of e.removed)t.delete(s);this._refreshListeners(),this._refreshVisualization()}),{onListenerAdd:()=>this._refreshListeners()})]);const e=new o;this.view.when().then((()=>{this.view.map.allLayers.flatten((e=>"sublayers"in e&&e.sublayers?e.sublayers:null)).forEach((t=>{(y(t)&&!p(t)||f(t))&&e.add(t)})),this._set("sources",e)}))}destroy(){this._layerEditHandles.drain(r)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._get("sources")}set sources(e){this._set("sources",e)}async getSelectedFeatures(e,t={},s="layerView"){const{view:o,selections:i}=this,n=(void 0!==e?i.filter((t=>e.includes(t.layer))):i).filter((e=>e.selection.length>0)).map((async e=>{const{layer:i,selection:n}=e,r=f(i)?i.parent:i;if(null==r||!v(r))return null;if("layer"===s)return S(r,n,t);const l=await o.whenLayerView(r);return S(l,n,t)}));return(await Promise.all(n)).filter((e=>null!==e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let o=!1;const i=e.current.concat(e.added);for(const t of i){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(y(e)||f(e))&&null!==i){const t=n(s,e,(()=>[]));t.includes(i)||(t.push(i),o=!0)}}for(const t of e.removed){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(y(e)||f(e))&&null!==i){const t=s.get(e),n=t?.indexOf(i);void 0!==n&&n>=0&&(t?.splice(n,1),o=!0)}}if(o){const{_selectionMap:e,_trashCan:o}=this,i=[];for(const[n,r]of s){const s=e.get(n);void 0!==s&&o.push(s),e.set(n,{selection:r}),i.push({layer:n,selection:r,...t(void 0!==s?s.selection:[],r)})}this._onSelectionChange(i)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),o=void 0!==s?[...s.selection]:[];for(const i of t)o.includes(i)||o.push(i);this._setSelection(e,o)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const o=[];for(const i of s.selection)t.includes(i)||o.push(i);this._setSelection(e,o)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const o=new Set(s.selection),i=new Set(t),n=h(o,i);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,o]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...o.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){if(null==this.view||null==this.sources)return;for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{sources:e,view:t,_selectionMap:s,showHighlight:o}=this,i=this._vizTaskId;for(const n of e){const e=s.get(n),r=f(n)?n.parent:n;null!=r&&v(r)&&t.whenLayerView(r).then((t=>{e?.highlightHandle?.remove(),void 0!==e&&o&&i===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,"selection"))}))}}_refreshListeners(){this._layerEditHandles.drain(r);for(const e of this.sources){const t=f(e)?e.parent:e;if(null!=t&&y(t)){const s=t.on("edits",(t=>{this._handleEditChanges(t,e)}));this._layerEditHandles.push(s)}}}_handleEditChanges(e,t){if(void 0!==e.deletedFeatures&&e.deletedFeatures.length>0&&this._selectionMap.has(t)){const o=e.deletedFeatures.filter((e=>null==e.error)).map((e=>e.objectId)).filter(s);this.removeFromSelection(t,o)}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const o=this._selectionMap.get(e);if(void 0===o||!w(o,{selection:s})){void 0!==o&&this._trashCan.push(o),this._selectionMap.set(e,{selection:[...s]});const i={layer:e,selection:[...s],...t(void 0!==o?o.selection:[],s)};this._onSelectionChange([i])}}};e([u({readOnly:!0,nonNullable:!0})],_.prototype,"selections",null),e([u({readOnly:!0,nonNullable:!0})],_.prototype,"count",null),e([u({constructOnly:!0,nonNullable:!0})],_.prototype,"view",void 0),e([u({readOnly:!0,nonNullable:!0})],_.prototype,"hasSelection",null),e([u()],_.prototype,"showHighlight",void 0),e([u()],_.prototype,"sources",null),_=e([d("esri.views.SelectionManager")],_);const y=e=>void 0!==e.createQuery&&void 0!==e.on,m=e=>void 0!==e.layer,v=e=>void 0!==e?.when,w=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],o=[...t.selection];if(s.length!==o.length)return!1;s.sort(),o.sort();for(let e=0;e<s.length;e++)if(s[e]!==o[e])return!1}return!0},S=async(e,t,s={})=>{let o;if(m(e)){const i=e;o=void 0===i?null:await i.queryFeatures(new g({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const i=e;o=void 0===i?null:await i.queryFeatures(new g({...s,objectIds:t})).then((e=>({data:e,layer:i})))}return o},M=_;export{M 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"../../../geometry.js";import{equals as t,isSome as e}from"../../../core/arrayUtils.js";import{clone as o}from"../../../core/lang.js";import{getMetersPerUnitForSR as n}from"../../../core/unitUtils.js";import{
|
|
5
|
+
import"../../../geometry.js";import{equals as t,isSome as e}from"../../../core/arrayUtils.js";import{clone as o}from"../../../core/lang.js";import{getMetersPerUnitForSR as n}from"../../../core/unitUtils.js";import{m as r}from"../../../chunks/vec32.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import l from"../../../geometry/Circle.js";import{simplify as s,distance as i}from"../../../geometry/geometryEngine.js";import{unnormalizeGeometryOnDatelineCrossing as c,isClockwise as y,unnormalizeVerticesOnDatelineCrossing as p}from"../../../geometry/support/coordsUtils.js";import{isValid as u}from"../../../geometry/support/spatialReferenceUtils.js";import{makeSurfacePoint as m}from"./surfaceCoordinateSystems.js";import f from"../../../geometry/Point.js";import x from"../../../geometry/Multipoint.js";import h from"../../../geometry/Polyline.js";import M from"../../../geometry/Polygon.js";function g(t,e){const o=new f({x:t[0],y:t[1],spatialReference:e});return t.length>2&&(o.z=t[2]),o}function d(t,e){return new x({points:t,spatialReference:e})}function R(t,e,o){const n=new h({paths:t,spatialReference:e});return o&&c(n),n}function j(e,n,r,a=!0){const l=o(e);l.forEach((e=>{const o=e[0],n=e[e.length-1];t(o,n)&&1!==e.length||e.push(e[0])}));let i=new M({rings:l,spatialReference:n});return i.rings.forEach((t=>{y(t)||t.reverse()})),r&&c(i),a&&i.isSelfIntersecting&&u(n)&&(i=s(i)),i}function T(t,o,n){const r=o.mapToLocalMultiple(t),a=[],l={x:r[0].x,y:r[0].y},s={x:r[1].x,y:r[1].y},i=Math.round(s.x-l.x),c=Math.round(s.y-l.y),y=Math.max(Math.abs(i),Math.abs(c));if(n){const t={x:l.x+y,y:l.y+y},e={x:l.x-y,y:l.y-y};a.push(m(t.x,e.y),m(e.x,e.y),m(e.x,t.y),m(t.x,t.y))}else{const t={x:i>0?l.x+y:l.x-y,y:c>0?l.y+y:l.y-y};a.push(m(l.x,l.y),m(t.x,l.y),m(t.x,t.y),m(l.x,t.y))}return U(j([a.map((t=>o.localToMap(t))).filter(e)],o.spatialReference,o.doUnnormalization,!0),a,o)}function b(t,o,n){let r=o.mapToLocalMultiple(t);if(1===r.length){const t=48,e=r[0];r=[m(e.x-t,e.y+t),m(e.x+t,e.y-t),m(e.x+t,e.y-t),m(e.x-t,e.y+t)]}const a=[],l={x:r[0].x,y:r[0].y},s={x:r[1].x,y:r[1].y};if(n){const t=Math.round(s.x-l.x),e=Math.round(s.y-l.y);a.push(m(l.x-t,l.y-e),m(s.x,l.y-e),m(s.x,s.y),m(l.x-t,s.y))}else a.push(m(l.x,l.y),m(s.x,l.y),m(s.x,s.y),m(l.x,s.y));return U(j([a.map((t=>o.localToMap(t))).filter(e)],o.spatialReference,o.doUnnormalization,!0),a,o)}function U(t,e,o){const n=P(e[3],e[2],o),r=P(e[1],e[2],o),a=P(e[0],e[1],o),l=P(e[0],e[3],o);return{geometry:t,midpoints:null!=n&&null!=r&&null!=a&&null!=l?{top:n,right:r,bottom:a,left:l}:null}}function P(t,e,o){w[0]=t.x,w[1]=t.y,w[2]=0,I[0]=e.x,I[1]=e.y,I[2]=0,r(w,w,I,.5),z.x=w[0],z.y=I[1],z.z=I[2];const n=o.localToMap(z);return null!=n?g(n,o.spatialReference):null}const z=m(0,0,0),w=a(),I=a();function L(t,e,o,r){const a=e.mapToLocalMultiple(t);let s=null,c=null;if(o)s=a[0],c=a[1];else{const t=a[0],e=a[1],o=Math.round(e.x-t.x),n=Math.round(e.y-t.y),r=Math.max(Math.abs(o),Math.abs(n));s=m(o>0?t.x+r/2:t.x-r/2,n>0?t.y+r/2:t.y-r/2),c=m(Math.abs(o)>Math.abs(n)?s.x-r/2:s.x,Math.abs(o)>Math.abs(n)?s.y:s.y-r/2)}const y=e.localToMap(s),f=e.localToMap(c);if(null==y||null==f)return null;e.doUnnormalization&&p([[y,f]],e.spatialReference);const x=g(y,e.spatialReference),h=g(f,e.spatialReference),M=n(e.spatialReference);let d=0;if(u(e.spatialReference))d=M*i(x,h,null);else{const t=s.x-c.x,e=s.y-c.y;d=M*Math.sqrt(t*t+e*e)*(r||1)}const R=new l({center:x,radius:d,radiusUnit:"meters",spatialReference:e.spatialReference});return{geometry:j(R.rings,R.spatialReference,!1),center:x,edge:h}}function v(t,o,n){const r=o.mapToLocalMultiple(t),a=r[0],l=r[1],s=Math.round(l.x-a.x),i=Math.round(l.y-a.y),c=m(n?a.x:a.x+s/2,n?a.y:a.y+i/2),y=n?s:s/2,p=n?i:i/2,u=60,f=[],x=2*Math.PI/u;function h(t){const e=Math.cos(t),o=Math.sin(t);return m(y*e+c.x,p*o+c.y)}for(let e=0;e<u;e++)f.push(h(e*x));f.push(f[0]);const{spatialReference:M,doUnnormalization:d}=o,R=j([f.map((t=>o.localToMap(t))).filter(e)],M,d,!1),T=o.localToMap(h(Math.PI/2)),b=o.localToMap(h(0)),U=o.localToMap(h(-Math.PI/2)),P=o.localToMap(h(Math.PI));return{geometry:R,midpoints:null!=T&&null!=b&&null!=U&&null!=P?{top:g(T,M),right:g(b,M),bottom:g(U,M),left:g(P,M)}:null}}export{L as createCircle,v as createEllipse,d as createMultipoint,g as createPoint,j as createPolygon,R as createPolyline,b as createRectangle,T as createSquare};
|
|
@@ -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"../../../geometry.js";import{isSome as t}from"../../../core/arrayUtils.js";import{invert as r}from"../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as e,clone as s}from"../../../core/libs/gl-matrix-2/factories/mat2df64.js";import{rotationTo as a,invert as o}from"../../../core/libs/gl-matrix-2/math/quat.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{h as n,
|
|
5
|
+
import"../../../geometry.js";import{isSome as t}from"../../../core/arrayUtils.js";import{invert as r}from"../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as e,clone as s}from"../../../core/libs/gl-matrix-2/factories/mat2df64.js";import{rotationTo as a,invert as o}from"../../../core/libs/gl-matrix-2/math/quat.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{h as n,k as l,f as h,n as m,b as c,u as f}from"../../../chunks/vec32.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Axis as d}from"../../../geometry/support/Axis.js";import u from"../../../geometry/Point.js";function g(t,r,e=null){return null!=e?[t,r,e]:[t,r]}function w(t,r,e=null){return null!=e?{x:t,y:r,z:e}:{x:t,y:r}}class R{constructor(t){this.spatialReference=t}mapToLocalMultiple(r){return r.map((t=>this.mapToLocal(t))).filter(t)}get doUnnormalization(){return!1}}class W extends R{constructor(t,a,o=null){super(a),this._defaultZ=o,this.transform=e(),this.transformInv=e(),this.transform=s(t),r(this.transformInv,this.transform)}makeMapPoint(t,r){return g(t,r,this._defaultZ)}mapToLocal(t){return w(this.transform[0]*t[0]+this.transform[2]*t[1]+this.transform[4],this.transform[1]*t[0]+this.transform[3]*t[1]+this.transform[5])}localToMap(t){return g(this.transformInv[0]*t.x+this.transformInv[2]*t.y+this.transformInv[4],this.transformInv[1]*t.x+this.transformInv[3]*t.y+this.transformInv[5],this._defaultZ)}}class v extends R{constructor(t,r){super(t.spatialReference),this.view=t,this.defaultZ=null,this.pWS=p(),this.tangentFrameUpWS=p(),this.tangentFrameRightWS=p(),this.tangentFrameForwardWS=p(),this.localFrameRightWS=p(),this.localFrameUpWS=p(),this.worldToLocalTransform=i(),this.localToWorldTransform=i(),this.scale=1,this.scale=t.resolution,this.referenceMapPoint=r,this.defaultZ=r.hasZ?r.z:null;const e=t.state.camera.viewRight;this.view.renderCoordsHelper.toRenderCoords(this.referenceMapPoint,this.pWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,d.X,this.tangentFrameRightWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,d.Y,this.tangentFrameUpWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,d.Z,this.tangentFrameForwardWS);const s=p();n(s,this.tangentFrameForwardWS,l(e,this.tangentFrameForwardWS)),h(this.localFrameRightWS,e,s),m(this.localFrameRightWS,this.localFrameRightWS),c(this.localFrameUpWS,this.tangentFrameForwardWS,this.localFrameRightWS),a(this.worldToLocalTransform,this.localFrameRightWS,this.tangentFrameRightWS),o(this.localToWorldTransform,this.worldToLocalTransform)}get doUnnormalization(){return"global"===this.view.viewingMode}makeMapPoint(t,r){return g(t,r,this.defaultZ)}mapToLocal(t){const r=p();this.view.renderCoordsHelper.toRenderCoords(new u({x:t[0],y:t[1],spatialReference:this.spatialReference}),r),f(r,r,this.worldToLocalTransform);const e=this.view.renderCoordsHelper.fromRenderCoords(r,new u({spatialReference:this.view.spatialReference}));return null!=e?w(e.x/this.scale,e.y/this.scale):null}localToMap(t){const r=p();this.view.renderCoordsHelper.toRenderCoords(new u({x:t.x*this.scale,y:t.y*this.scale,spatialReference:this.spatialReference}),r),f(r,r,this.localToWorldTransform);const e=this.view.renderCoordsHelper.fromRenderCoords(r,new u({spatialReference:this.view.spatialReference}));return null!=e?g(e.x,e.y,this.defaultZ):null}}function F(t,r){if("2d"===t.type)return new W(t.state.transform,t.spatialReference,r.length>2?r[2]:null);if("3d"===t.type){const e=r.length>2?new u({x:r[0],y:r[1],z:r[2],spatialReference:t.spatialReference}):new u({x:r[0],y:r[1],spatialReference:t.spatialReference});return new v(t,e)}return null}export{W as AffineCoordinateSystem,v as SceneViewCoordinateSystem,R as SurfaceCoordinateSystem,F as createViewAlignedCoordinateSystem,g as makeMapPoint,w as makeSurfacePoint};
|
|
@@ -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 e from"../../core/Accessor.js";import o from"../../core/Evented.js";import{watch as i,sync as s}from"../../core/reactiveUtils.js";import{screenPointObjectToArray as r,pt2px as l,createScreenPointArray as n}from"../../core/screenUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{squaredDistance as h}from"../../core/libs/gl-matrix-2/math/vec2.js";import{p}from"../../chunks/vec32.js";import{create as m}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as u,project as y}from"../../geometry/projection.js";import{projectPointToVector as g}from"../../geometry/projection/projectPointToVector.js";import{getGraphicEffectiveElevationMode as b}from"../../support/elevationInfoUtils.js";import{getDefaultSymbol2D as d}from"../../symbols/support/defaults.js";import f from"../../symbols/support/ElevationInfo.js";import{getSymbolInfo as _}from"./support/utils.js";import{intersectsDrapedGeometry as v}from"../support/drapedUtils.js";let S=class extends e{set graphic(t){this._circleCollisionCache=null,this._originalSymbol=t.symbol,this._set("graphic",t),this.attachSymbolChanged()}get elevationInfo(){const{layer:t}=this.graphic,e=t&&"elevationInfo"in t?t.elevationInfo:null,o=b(this.graphic),i=e?e.offset:0;return new f({mode:o,offset:i})}set focusedSymbol(t){t!==this._get("focusedSymbol")&&(this._set("focusedSymbol",t),this._updateGraphicSymbol(),this._circleCollisionCache=null)}grabbableForEvent(){return!0}set grabbing(t){t!==this._get("grabbing")&&(this._set("grabbing",t),this._updateGraphicSymbol())}set hovering(t){t!==this._get("hovering")&&(this._set("hovering",t),this._updateGraphicSymbol())}set selected(t){t!==this._get("selected")&&(this._set("selected",t),this._updateGraphicSymbol(),this.events.emit("select-changed",{action:t?"select":"deselect"}))}get _focused(){return this._get("hovering")||this._get("grabbing")}constructor(t){super(t),this.layer=null,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.dragging=!1,this.cursor=null,this.consumesClicks=!0,this.events=new o.EventEmitter,this._circleCollisionCache=null,this._graphicSymbolChangedHandle=null,this._originalSymbol=null}destroy(){this.detachSymbolChanged(),this._resetGraphicSymbol(),this._set("view",null)}intersectionDistance(t){const e=this.graphic;if(!1===e.visible)return null;const o=e.geometry;if(null==o)return null;const i=this._get("focusedSymbol"),s=null!=i?i:e.symbol;return"2d"===this.view.type?this._intersectDistance2D(this.view,t,o,s):this._intersectDistance3D(this.view,t,e)}attach(){this.attachSymbolChanged(),null!=this.layer&&this.layer.add(this.graphic)}detach(){this.detachSymbolChanged(),this._resetGraphicSymbol(),null!=this.layer&&this.layer.remove(this.graphic)}attachSymbolChanged(){this.detachSymbolChanged(),this._graphicSymbolChangedHandle=i((()=>this.graphic?.symbol),(t=>{null!=t&&t!==this.focusedSymbol&&t!==this._originalSymbol&&(this._originalSymbol=t,this._focused&&null!=this.focusedSymbol&&(this.graphic.symbol=this.focusedSymbol))}),s)}detachSymbolChanged(){null!=this._graphicSymbolChangedHandle&&(this._graphicSymbolChangedHandle.remove(),this._graphicSymbolChangedHandle=null)}onElevationChange(){}onViewChange(){}_updateGraphicSymbol(){this.graphic.symbol=this._focused&&null!=this.focusedSymbol?this.focusedSymbol:this._originalSymbol}_resetGraphicSymbol(){this.graphic.symbol=this._originalSymbol}_intersectDistance2D(t,e,o,i){if(null==(i=i||d(o)))return null;const s=1;let n=this._circleCollisionCache;if("point"===o.type&&"cim"===i.type&&"CIMPointSymbol"===i.data.symbol?.type&&i.data.symbol.symbolLayers){const{offsetX:l,offsetY:n,size:a}=_(i),c=r(e,j),p=a/2,m=t.toScreen(o),u=m.x+l,y=m.y+n;return h(c,[u,y])<p*p?s:null}if("point"!==o.type||"simple-marker"!==i.type)return v(e,o,t)?s:null;if(null==n||!n.originalPoint.equals(o)){const e=o,s=t.spatialReference;if(u(e.spatialReference,s)){const t=y(e,s);n={originalPoint:e.clone(),mapPoint:t,radiusPx:l(i.size)},this._circleCollisionCache=n}}if(null!=n){const o=r(e,j),a=t.toScreen?.(n.mapPoint);if(!a)return null;const c=n.radiusPx,p=a.x+l(i.xoffset),m=a.y-l(i.yoffset);return h(o,[p,m])<c*c?s:null}return null}_intersectDistance3D(t,e,o){const i=t.toMap(e,{include:[o]});return i&&g(i,C,t.renderSpatialReference)?p(C,t.state.camera.eye):null}};t([a({constructOnly:!0,nonNullable:!0})],S.prototype,"graphic",null),t([a()],S.prototype,"elevationInfo",null),t([a({constructOnly:!0,nonNullable:!0})],S.prototype,"view",void 0),t([a({value:null})],S.prototype,"focusedSymbol",null),t([a({constructOnly:!0})],S.prototype,"layer",void 0),t([a()],S.prototype,"interactive",void 0),t([a()],S.prototype,"selectable",void 0),t([a()],S.prototype,"grabbable",void 0),t([a({value:!1})],S.prototype,"grabbing",null),t([a()],S.prototype,"dragging",void 0),t([a()],S.prototype,"hovering",null),t([a({value:!1})],S.prototype,"selected",null),t([a()],S.prototype,"cursor",void 0),S=t([c("esri.views.interactive.GraphicManipulator")],S);const C=m(),j=n();export{S as GraphicManipulator};
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import o from"../../core/Evented.js";import{watch as i,sync as s}from"../../core/reactiveUtils.js";import{screenPointObjectToArray as r,pt2px as l,createScreenPointArray as n}from"../../core/screenUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{squaredDistance as h}from"../../core/libs/gl-matrix-2/math/vec2.js";import{q as p}from"../../chunks/vec32.js";import{create as m}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as u,project as y}from"../../geometry/projection.js";import{projectPointToVector as g}from"../../geometry/projection/projectPointToVector.js";import{getGraphicEffectiveElevationMode as b}from"../../support/elevationInfoUtils.js";import{getDefaultSymbol2D as d}from"../../symbols/support/defaults.js";import f from"../../symbols/support/ElevationInfo.js";import{getSymbolInfo as _}from"./support/utils.js";import{intersectsDrapedGeometry as v}from"../support/drapedUtils.js";let S=class extends e{set graphic(t){this._circleCollisionCache=null,this._originalSymbol=t.symbol,this._set("graphic",t),this.attachSymbolChanged()}get elevationInfo(){const{layer:t}=this.graphic,e=t&&"elevationInfo"in t?t.elevationInfo:null,o=b(this.graphic),i=e?e.offset:0;return new f({mode:o,offset:i})}set focusedSymbol(t){t!==this._get("focusedSymbol")&&(this._set("focusedSymbol",t),this._updateGraphicSymbol(),this._circleCollisionCache=null)}grabbableForEvent(){return!0}set grabbing(t){t!==this._get("grabbing")&&(this._set("grabbing",t),this._updateGraphicSymbol())}set hovering(t){t!==this._get("hovering")&&(this._set("hovering",t),this._updateGraphicSymbol())}set selected(t){t!==this._get("selected")&&(this._set("selected",t),this._updateGraphicSymbol(),this.events.emit("select-changed",{action:t?"select":"deselect"}))}get _focused(){return this._get("hovering")||this._get("grabbing")}constructor(t){super(t),this.layer=null,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.dragging=!1,this.cursor=null,this.consumesClicks=!0,this.events=new o.EventEmitter,this._circleCollisionCache=null,this._graphicSymbolChangedHandle=null,this._originalSymbol=null}destroy(){this.detachSymbolChanged(),this._resetGraphicSymbol(),this._set("view",null)}intersectionDistance(t){const e=this.graphic;if(!1===e.visible)return null;const o=e.geometry;if(null==o)return null;const i=this._get("focusedSymbol"),s=null!=i?i:e.symbol;return"2d"===this.view.type?this._intersectDistance2D(this.view,t,o,s):this._intersectDistance3D(this.view,t,e)}attach(){this.attachSymbolChanged(),null!=this.layer&&this.layer.add(this.graphic)}detach(){this.detachSymbolChanged(),this._resetGraphicSymbol(),null!=this.layer&&this.layer.remove(this.graphic)}attachSymbolChanged(){this.detachSymbolChanged(),this._graphicSymbolChangedHandle=i((()=>this.graphic?.symbol),(t=>{null!=t&&t!==this.focusedSymbol&&t!==this._originalSymbol&&(this._originalSymbol=t,this._focused&&null!=this.focusedSymbol&&(this.graphic.symbol=this.focusedSymbol))}),s)}detachSymbolChanged(){null!=this._graphicSymbolChangedHandle&&(this._graphicSymbolChangedHandle.remove(),this._graphicSymbolChangedHandle=null)}onElevationChange(){}onViewChange(){}_updateGraphicSymbol(){this.graphic.symbol=this._focused&&null!=this.focusedSymbol?this.focusedSymbol:this._originalSymbol}_resetGraphicSymbol(){this.graphic.symbol=this._originalSymbol}_intersectDistance2D(t,e,o,i){if(null==(i=i||d(o)))return null;const s=1;let n=this._circleCollisionCache;if("point"===o.type&&"cim"===i.type&&"CIMPointSymbol"===i.data.symbol?.type&&i.data.symbol.symbolLayers){const{offsetX:l,offsetY:n,size:a}=_(i),c=r(e,j),p=a/2,m=t.toScreen(o),u=m.x+l,y=m.y+n;return h(c,[u,y])<p*p?s:null}if("point"!==o.type||"simple-marker"!==i.type)return v(e,o,t)?s:null;if(null==n||!n.originalPoint.equals(o)){const e=o,s=t.spatialReference;if(u(e.spatialReference,s)){const t=y(e,s);n={originalPoint:e.clone(),mapPoint:t,radiusPx:l(i.size)},this._circleCollisionCache=n}}if(null!=n){const o=r(e,j),a=t.toScreen?.(n.mapPoint);if(!a)return null;const c=n.radiusPx,p=a.x+l(i.xoffset),m=a.y-l(i.yoffset);return h(o,[p,m])<c*c?s:null}return null}_intersectDistance3D(t,e,o){const i=t.toMap(e,{include:[o]});return i&&g(i,C,t.renderSpatialReference)?p(C,t.state.camera.eye):null}};t([a({constructOnly:!0,nonNullable:!0})],S.prototype,"graphic",null),t([a()],S.prototype,"elevationInfo",null),t([a({constructOnly:!0,nonNullable:!0})],S.prototype,"view",void 0),t([a({value:null})],S.prototype,"focusedSymbol",null),t([a({constructOnly:!0})],S.prototype,"layer",void 0),t([a()],S.prototype,"interactive",void 0),t([a()],S.prototype,"selectable",void 0),t([a()],S.prototype,"grabbable",void 0),t([a({value:!1})],S.prototype,"grabbing",null),t([a()],S.prototype,"dragging",void 0),t([a()],S.prototype,"hovering",null),t([a({value:!1})],S.prototype,"selected",null),t([a()],S.prototype,"cursor",void 0),S=t([c("esri.views.interactive.GraphicManipulator")],S);const C=m(),j=n();export{S as GraphicManipulator};
|