@arcgis/core 6.0.0-next.48 → 6.0.0-next.49
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/Ground.js +1 -1
- package/analysis/AreaMeasurementAnalysis.d.ts +12 -10
- package/analysis/AreaMeasurementAnalysis.js +1 -1
- package/applications/Components/formatUtils.d.ts +3 -2
- package/applications/MapViewer/templateUtils.d.ts +4 -1
- package/applications/SceneViewer/sceneViewerUtils.d.ts +12 -1
- package/applications/SceneViewer/sceneViewerUtils.js +1 -1
- package/arcade/featureset/actions/SpatialFilter.js +1 -1
- package/arcade/functions/featuresetgeom.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/geometry/operatorsWorker.js +1 -1
- package/arcade/geometry/operatorsWorkerConnection.js +1 -1
- package/arcgisGlobal.d.ts +4 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/063cc462524646cd45e8.js +1 -0
- package/assets/esri/core/workers/chunks/119c62e9c9c7440a6129.js +1 -0
- package/assets/esri/core/workers/chunks/14c04fde8d33b739b415.js +1 -0
- package/assets/esri/core/workers/chunks/27a91b52d1bee92b6f20.js +1 -0
- package/assets/esri/core/workers/chunks/31eb09e96f31bced71ad.js +1 -0
- package/assets/esri/core/workers/chunks/{056a815273653271bf75.js → 3236e18921955450fc0d.js} +5 -5
- package/assets/esri/core/workers/chunks/3ce7120056040af3bab1.js +1 -0
- package/assets/esri/core/workers/chunks/435dacf493aec07ff6e3.js +1 -0
- package/assets/esri/core/workers/chunks/4c26d6408ee7a3b9d163.js +1 -0
- package/assets/esri/core/workers/chunks/{73bf76a3a0418edb26a5.js → 506954fb374ea528d020.js} +1 -1
- package/assets/esri/core/workers/chunks/55db28616f810ca063b7.js +1 -0
- package/assets/esri/core/workers/chunks/59ae5bd0ee1bae7a9fb3.js +1 -0
- package/assets/esri/core/workers/chunks/630a36c4817f33f4cad2.js +1 -0
- package/assets/esri/core/workers/chunks/6779afc2d6ee46c301b5.js +1 -0
- package/assets/esri/core/workers/chunks/6a509ffb4852d694a097.js +1 -0
- package/assets/esri/core/workers/chunks/6d25a7071fceb707858a.js +1 -0
- package/assets/esri/core/workers/chunks/7a97eec9823941fd210f.js +29 -0
- package/assets/esri/core/workers/chunks/82bbf0c5e18fc1c795f4.js +1 -0
- package/assets/esri/core/workers/chunks/91019e9dff63107f8cb4.js +1 -0
- package/assets/esri/core/workers/chunks/{1345413ec0b4128849b1.js → 954f9854a9bf4a852b81.js} +1 -1
- package/assets/esri/core/workers/chunks/9846abf2d3991a15b2b5.js +1 -0
- package/assets/esri/core/workers/chunks/9f74b3f0f453bc957e3a.js +1 -0
- package/assets/esri/core/workers/chunks/a0e2a1c6f37454547193.js +1 -0
- package/assets/esri/core/workers/chunks/a1c45e8f5bba471b3905.js +1 -0
- package/assets/esri/core/workers/chunks/a2825285d46f8cd5d814.js +1 -0
- package/assets/esri/core/workers/chunks/{d4f6be8290ad0243e1b8.js → b511b5c68defefccde0b.js} +1 -1
- package/assets/esri/core/workers/chunks/bf81b3670b5323621e2d.js +1 -0
- package/assets/esri/core/workers/chunks/c4794d692934098988e7.js +1 -0
- package/assets/esri/core/workers/chunks/d0900a901197948bd7df.js +1 -0
- package/assets/esri/core/workers/chunks/d2ed93bbfa98395bbed7.js +1 -0
- package/assets/esri/core/workers/chunks/d486a8a61ff993f8202a.js +1 -0
- package/assets/esri/core/workers/chunks/e06036392a982dbf3ae3.js +1 -0
- package/assets/esri/core/workers/chunks/{773ba0909ccd3a034c31.js → ed1db6571b0c61fe4f91.js} +1 -1
- package/chunks/BlendWeights.glsl.js +4 -5
- package/chunks/Blur.glsl.js +10 -7
- package/chunks/BlurEmission.glsl.js +27 -7
- package/chunks/Clouds.glsl.js +2 -2
- package/chunks/Component.glsl.js +1 -1
- package/chunks/EdgeDetect.glsl.js +1 -1
- package/chunks/EdgeShader.glsl.js +1 -1
- package/chunks/EmissionComposite.glsl.js +2 -2
- package/chunks/Fog.glsl.js +4 -4
- package/chunks/GlobalIlluminationBlur.glsl.js +1 -1
- package/chunks/HighlightSharpApply.glsl.js +4 -1
- package/chunks/LineMarker.glsl.js +4 -4
- package/chunks/Magnifier.glsl.js +1 -1
- package/chunks/NoiseTextureAtlas.glsl.js +3 -3
- package/chunks/Pattern.glsl.js +35 -32
- package/chunks/{ChapmanAtmosphere.glsl.js → RealisticAtmosphere.glsl.js} +18 -9
- package/chunks/RealisticAtmosphereCompositing.glsl.js +35 -0
- package/chunks/SSAO.glsl.js +2 -2
- package/chunks/SimpleAtmosphere.glsl.js +1 -1
- package/config.js +1 -1
- package/core/accessorSupport/ObservableBase.js +1 -1
- package/core/accessorSupport/tracking/ObservationHandle.js +1 -1
- package/core/accessorSupport/tracking/SimpleObservable.js +1 -1
- package/core/accessorSupport/tracking/SimpleTrackingTarget.js +1 -1
- package/core/accessorSupport/tracking/TrackingTarget.js +1 -1
- package/core/quantity.js +1 -1
- package/core/timeUtils.js +1 -1
- package/geometry/coordinateConversion/CoordinateConversionModel.d.ts +258 -0
- package/geometry/coordinateConversion/CoordinateConversionModel.js +2 -0
- package/geometry/coordinateConversion/support/Conversion.d.ts +73 -0
- package/geometry/coordinateConversion/support/Conversion.js +2 -0
- package/geometry/coordinateConversion/support/Format.d.ts +131 -0
- package/geometry/coordinateConversion/support/Format.js +2 -0
- package/geometry/coordinateConversion/support/coordinateConversionUtils.js +2 -0
- package/geometry/coordinateConversion/support/formatUtils.js +2 -0
- package/geometry/coordinateConversion/types.d.ts +116 -0
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/IntegratedMeshLayer.js +1 -1
- package/layers/catalog/CatalogFootprintLayer.d.ts +2 -2
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/knowledgeGraph/cypherUtils.js +1 -1
- package/layers/mixins/FeatureLayerBase.d.ts +2 -2
- package/layers/raster/formats/Lzw.js +1 -1
- package/layers/raster/formats/TiffDecoder.js +1 -1
- package/layers/raster/formats/tiffParser.js +1 -1
- package/layers/raster/formats/tiffTag.js +1 -1
- package/layers/support/IntegratedMeshSemantics.js +2 -0
- package/layers/support/VideoElement.js +1 -1
- package/legend/ActiveLayerInfo.js +1 -1
- package/package.json +2 -2
- package/symbols/FillSymbol3DLayer.d.ts +1 -4
- package/time/daylightUtils.d.ts +29 -0
- package/time/daylightUtils.js +2 -0
- package/time/timeZoneUtils.js +1 -1
- package/time/types.d.ts +57 -1
- package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
- package/views/2d/analysis/AreaMeasurementAnalysisView2D.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/layers/GeospatialPDFLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
- package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementController.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/Manipulator3DBase.js +2 -0
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
- package/views/3d/layers/graphics/SymbolComplexity.js +1 -1
- package/views/3d/layers/graphics/webStyleUtils.js +1 -1
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
- package/views/3d/layers/support/patternUtils.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/support/GroundAndIMSurface.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/PatchRenderDataWaterproofness.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialInitParameters.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterColor.glsl.js +6 -4
- package/views/3d/webgl-engine/core/shaderLibrary/util/BlendModes.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +10 -9
- package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/cameraUniforms.js +1 -1
- package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanApproximation.glsl.js +3 -3
- package/views/3d/webgl-engine/effects/atmosphere/{ChapmanAtmosphere.glsl.js → RealisticAtmosphere.glsl.js} +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/RealisticAtmosphere.js +2 -0
- package/views/3d/webgl-engine/effects/atmosphere/RealisticAtmosphereCompositing.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/atmosphere/RealisticAtmosphereCompositingTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/atmosphere/RealisticAtmosphereTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/glow/BlurEmission.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/applyEmissiveGlow.glsl.js +87 -41
- package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/EmissionComposite.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/EmissionComposite.js +1 -1
- package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceOctree.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternLayouts.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechniqueConfiguration.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/interactive/Tooltip.js +1 -1
- package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
- package/views/interactive/snapping/SnappingAlgorithm.js +1 -1
- package/views/interactive/tooltip/content/TooltipContent.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.d.ts +3 -0
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/022565ef98a702ab952f.js +0 -1
- package/assets/esri/core/workers/chunks/163e97987e1f75610009.js +0 -1
- package/assets/esri/core/workers/chunks/1d57b1445afec89a7941.js +0 -1
- package/assets/esri/core/workers/chunks/3654672d772d11484883.js +0 -1
- package/assets/esri/core/workers/chunks/3af0ff5a0b82872aac38.js +0 -1
- package/assets/esri/core/workers/chunks/3b9415dfd7546aeec261.js +0 -1
- package/assets/esri/core/workers/chunks/5109b48666138df14038.js +0 -1
- package/assets/esri/core/workers/chunks/6b73dfc9252b32f1eae2.js +0 -1
- package/assets/esri/core/workers/chunks/6e4698879e7d8fbc4d12.js +0 -1
- package/assets/esri/core/workers/chunks/71295afd21fc5bc5ddbc.js +0 -1
- package/assets/esri/core/workers/chunks/794a9f116c4700bb1210.js +0 -1
- package/assets/esri/core/workers/chunks/8e0ecc7f55dd8bf2cf16.js +0 -1
- package/assets/esri/core/workers/chunks/9dece842ada6278c33ef.js +0 -1
- package/assets/esri/core/workers/chunks/a12e29f2cb78fdaa0753.js +0 -1
- package/assets/esri/core/workers/chunks/b70af9fb974ef9836efd.js +0 -1
- package/assets/esri/core/workers/chunks/c0f2b6a10bcc766318f5.js +0 -1
- package/assets/esri/core/workers/chunks/c248db5e4d92cfb3c4d1.js +0 -1
- package/assets/esri/core/workers/chunks/ce02adb527389b90223d.js +0 -1
- package/assets/esri/core/workers/chunks/d8eea5ffe05c620fac9e.js +0 -1
- package/assets/esri/core/workers/chunks/d997d81d0965c05447d4.js +0 -1
- package/assets/esri/core/workers/chunks/e1645882f54818c4036a.js +0 -1
- package/assets/esri/core/workers/chunks/e44679a0d271c1efb60d.js +0 -1
- package/assets/esri/core/workers/chunks/f11f40017ec97a2a6b5f.js +0 -29
- package/assets/esri/core/workers/chunks/f7f5d8256e63d303cbcb.js +0 -1
- package/assets/esri/core/workers/chunks/f87d5450190896e61ff8.js +0 -1
- package/assets/esri/core/workers/chunks/fdee2255f49b43056e9d.js +0 -1
- package/assets/esri/core/workers/chunks/ff1e614fde01781360fa.js +0 -1
- package/chunks/AtmosphereCompositing.glsl.js +0 -25
- package/views/3d/analysis/ShadowCast/sunlightUtils.js +0 -2
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +0 -2
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphereTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/AtmosphereCompositing.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/AtmosphereCompositingTechnique.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{clamp as t,acosClamped as n,deg2rad as r}from"../../../../core/mathUtils.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{translate as o,rotate as s,identity as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{subtract as u,transformMat4 as d,add as f,scale as p,copy as m,negate as h,length as g,set as _,normalize as v,cross as y,distance as b,direction as ee,dot as x}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as C}from"../../../../geometry/ellipsoidUtils.js";import{wrap as w}from"../../../../geometry/support/ray.js";import{Sphere as T}from"../../../../geometry/support/sphere.js";import{angle as te}from"../../../../geometry/support/vector.js";import{sv3d as E}from"../../../../geometry/support/vectorStacks.js";import{applyAll as D}from"../../camera/constraintUtils.js";import{ConstraintOptions as O}from"../../camera/constraintUtils/ConstraintOptions.js";import{TiltRange as k}from"../Constraints.js";import{InteractiveController as A}from"./InteractiveController.js";import{panMotionToRotationMatrix as j,onSurfaceTiltToEyeTiltGlobal as M,offSurfaceTiltToEyeTiltGlobal as N}from"../utils/navigationUtils.js";import{viewAngle as P}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as F}from"../../support/cameraUtils.js";import{createDirectionUp as I}from"../../support/cameraUtilsInternal.js";import L from"../../webgl/RenderCamera.js";import{extractTransformation as R,isZeroTransformation as z,extractTransformationKeyboard as B}from"../../../navigation/gamepadAndKeyboardUtils.js";let V=class extends A{constructor(e){super(e),this._filteredSurfaceElevation=0,this._precisionPanEnabled=!1,this._coarsePanEnabled=!1,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new L,this._headingStart=0,this._constraintOptions=new O(15,0,0,new L,null,1)}handleEventGamepad(e){let t=R(e,this.view.navigation.gamepad,this._transformation);(e.action===`end`||z(t))&&this.finishController()}activateDirection(e){this._keysButtonState[e]=1,B(this._keysButtonState,this._transformation)}directionActive(e){return this._keysButtonState[e]===1}countActiveDirections(){return this._keysButtonState.reduce((e,t)=>t>0?e+1:e,0)}deactivateDirection(e){this._keysButtonState[e]=0;let t=B(this._keysButtonState,this._transformation);z(t)&&(this._precisionPanEnabled=!1,this._coarsePanEnabled=!1,this.finishController())}setPrecisionPanEnabled(e){this._precisionPanEnabled=e}setCoarsePanEnabled(e){this._coarsePanEnabled=e}onControllerStart(e){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(e)}_updateFilteredSurfaceElevation(e){let t=this.view.pointsOfInterest.cameraOnSurface.location.z;this._filteredSurfaceElevation+=1*(t-this._filteredSurfaceElevation)*e}stepController(e,t){this._updateStartHeading(),this._updateFilteredSurfaceElevation(e),this.currentCamera.copyViewFrom(t),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(e,this.currentCamera,X),this._applyDisabledMovementTypes(X),this._applyPan(X.pan),this._applyRotate(X.rotate),this._applyZoom(X.zoom),this._applyAscend(X.ascend),this._constraintOptions.interactionType=0,this._constraintOptions.selection=8,D(this.view,this.currentCamera,this._constraintOptions),super.stepController(e,t)}_updateStartHeading(){this._transformation.heading!==0&&(this._headingStart=this.view.camera.heading)}_applyRotate(e){if(!e.enabled)return;let t=this.currentCamera;u(Z,t.center,t.eye),d(Z,Z,e.matrix),t.center=f(Z,Z,t.eye),t.up=d(Z,t.up,e.matrix),this._constraintOptions.interactionType=3,this._constraintOptions.selection=7,D(this.view,t,this._constraintOptions)}_applyPan(e,t=this.currentCamera){e.enabled&&(t.eye=d(Z,t.eye,e.matrix),t.center=d(Z,t.center,e.matrix),this.view.state.isGlobal&&(t.up=d(Z,t.up,e.matrix)),this._constraintOptions.interactionType=4,this._constraintOptions.selection=15,D(this.view,t,this._constraintOptions))}_applyZoom(e){if(!e)return;let t=this.currentCamera.viewForward;this.currentCamera.eye=f(Z,this.currentCamera.eye,p(E.get(),t,e)),m(Q,t),h(Q,Q),this._constraintOptions.interactionDirection=Q,this._constraintOptions.interactionType=1,this._constraintOptions.selection=7,D(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(e){if(!e)return;let t=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,E.get());if(this._constraintOptions.interactionDirection=m(Q,t),this.view.state.isGlobal){let t=g(this.currentCamera.eye),n=(t+e)/t;this.currentCamera.eye=p(Z,this.currentCamera.eye,n),this.currentCamera.center=p(Z,this.currentCamera.center,n)}else{let n=p(E.get(),t,e);this.currentCamera.eye=f(Z,this.currentCamera.eye,n),this.currentCamera.center=f(Z,this.currentCamera.center,n)}this._updateCameraCenter(),this._constraintOptions.interactionType=5,this._constraintOptions.selection=8,D(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=7,D(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(e,t,n){ie(n);let r=this._computeVelocities(e);this.view.state.isLocal?this._calculateControlTransformationLocal(r,t,n):this._calculateControlTransformationGlobal(r,t,n)}_updateCameraCenter(){let e=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,t=this.view.renderCoordsHelper,n=this.currentCamera.ray;this.currentCamera.center=t.intersectManifoldClosestSilhouette(n,e,Z)}_calculateControlTransformationLocal(e,n,r){let{viewRight:i,viewForward:a}=n,c=this._transformation,l=this.view.navigation.gamepad,u=_(E.get(),a[0],a[1],0);v(u,u);let d=c.translation[0]*e.pan;if(d!==0){let e=p(E.get(),i,d);o(r.pan.matrix,r.pan.matrix,e),r.pan.enabled=!0}switch(l.mode){case`pan`:{let t=-c.translation[1]*e.pan;if(t!==0){let e=p(E.get(),u,t);o(r.pan.matrix,r.pan.matrix,e),r.pan.enabled=!0}r.zoom=c.zoom*e.zoom;break}case`zoom`:r.zoom=(-c.translation[1]+c.zoom)*e.zoom;break;default:l.mode}r.ascend=c.translation[2]*e.ascend;let f=-c.heading*e.rotate;f!==0&&(s(r.rotate.matrix,r.rotate.matrix,f,this.view.renderCoordsHelper.worldUpAtPosition(n.eye,E.get())),r.rotate.enabled=!0);let m=c.tilt*e.rotate,h=P(this.view.renderCoordsHelper,n.center,n.eye),g=t(h+m,k.min,k.max)-h;g&&(s(r.rotate.matrix,r.rotate.matrix,g,i),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(e,t,n){let{eye:r,viewRight:i}=t,a=this._transformation,o=this.view.navigation.gamepad,c=y(E.get(),i,r);v(c,c),h(c,c),j(this.startCamera,t,a,e,this.view.camera.heading,this._headingStart,this.view.camera.tilt,n,o),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(X.pan,this._tmpCamera);let l=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude;n.ascend=a.translation[2]*e.ascend;let u=-a.heading*e.rotate;u!==0&&(s(n.rotate.matrix,n.rotate.matrix,u,this._tmpCamera.eye),n.rotate.enabled=!0);let d=a.tilt*e.rotate,f=this._clampTiltDeltaGlobalToValidRange(d,t.ray,l);f!==0&&(s(n.rotate.matrix,n.rotate.matrix,f,this._tmpCamera.viewRight),n.rotate.enabled=!0),n.zoom+=a.zoom*e.zoom}_clampTiltDeltaGlobalToValidRange(e,n,r){let i=C(this.view.spatialReference),a=M(k.min,n.origin,r,i),o=0,s=0,c=E.get();if(this.view.renderCoordsHelper.intersectManifold(n,r,c)){let e=P(this.view.renderCoordsHelper,c,n.origin);o=M(e,n.origin,r,i),s=M(k.max,n.origin,r,i)}else{$.radius=r+i.radius,$.closestPointOnSilhouette(n,c);let e=Math.PI+te(n.direction,c);o=N(e,n.origin,r,i),s=N(k.max,n.origin,r,i)}return t(o+e,a,s)-o}_getPointAbsoluteSurfaceElevation(e,t,n){let{renderCoordsHelper:r}=this.view,i=r.getAltitude(e),a=t+Math.abs(i-t);return r.setAltitude(n,a,e),a}_clampedDistanceToSurface(e,t){let{renderCoordsHelper:n}=this.view,{camera:r}=this.view.state,{direction:i}=F(this.view,t,0,U,re),a=n.intersectManifoldClosestSilhouette(w(t,i),e,E.get()),o=b(t,a),s=n.intersectManifoldClosestSilhouette(w(t,ee(E.get(),t,r.center)),e,E.get()),c=b(t,s);return Math.min(o,c)}_computeHeadingRotateRadius(e){let{renderCoordsHelper:t,state:r}=this.view,{camera:i,isGlobal:a}=r,o=t.intersectManifoldClosestSilhouette(i.ray,this._filteredSurfaceElevation,E.get());if(a){let t=u(E.get(),e,o),r=g(t);p(t,t,1/r);let i=v(E.get(),e),a=n(x(i,t));return r*Math.sin(Math.min(W,a))}{let n=m(E.get(),e);return t.setAltitude(n,this._filteredSurfaceElevation),b(o,n)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:J}_computeVelocities(e){let n=this._filteredSurfaceElevation,r=n+C(this.view.spatialReference).radius,{camera:i,isGlobal:a}=this.view.state,o=E.get(),s=this._getPointAbsoluteSurfaceElevation(i.eye,n,o),c=this._clampedDistanceToSurface(n,o),l=i.width/2,u=G*i.width,d=G*i.width,f=i.computeRenderPixelSizeAtDistance(c),p=f/r,m=f/this._computeHeadingRotateRadius(o),h=a?p:f,g=this._precisionPanEnabled===this._coarsePanEnabled?1:this._precisionPanEnabled?K:q,_=h*u*e*g,v=s-n;return{pan:_,ascend:Math.max(this._minimumAscendVelocity()*e,2**(u*e/l)*v-v),zoom:2**(u*e/l)*c-c,rotate:t(m*d,Y,ne)*e}}_applyDisabledMovementTypes(e){this.disableMovements!=null&&(this.disableMovements.mode===void 0||this.view.state.viewingMode===this.disableMovements.mode)&&(e.zoom=this.disableMovements.zoom?0:e.zoom,e.ascend=this.disableMovements.ascend?0:e.ascend,e.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&c(e.pan.matrix),e.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&c(e.rotate.matrix))}static activatesFor(e,t){let n=R(t,e.navigation.gamepad,H);return!(t.action===`end`||z(n))}};e([i({constructOnly:!0})],V.prototype,`gamepadDevice`,void 0),e([i({constructOnly:!0})],V.prototype,`disableMovements`,void 0),V=e([a(`esri.views.3d.state.controllers.GamepadKeyboardController`)],V);const H={translation:[0,0,0],heading:0,tilt:0,zoom:0},U=80,W=r(80),G=.75,K=.25,q=4,J=5,Y=r(30),ne=r(80),X={zoom:0,ascend:0,pan:{enabled:!1,matrix:l()},rotate:{enabled:!1,matrix:l()}},Z=S(),Q=S(),re=I(),$=new T;function ie(e){e.zoom=0,e.ascend=0,e.pan.enabled=!1,c(e.pan.matrix),e.rotate.enabled=!1,c(e.rotate.matrix)}export{V as GamepadKeyboardController};
|
|
2
|
+
import{__decorate as e}from"tslib";import{clamp as t,acosClamped as n,deg2rad as r}from"../../../../core/mathUtils.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{translate as o,rotate as s,identity as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{subtract as u,transformMat4 as d,add as f,scale as p,copy as m,negate as h,length as g,set as _,normalize as v,cross as y,distance as b,direction as ee,dot as x}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as C}from"../../../../geometry/ellipsoidUtils.js";import{wrap as w}from"../../../../geometry/support/ray.js";import{Sphere as T}from"../../../../geometry/support/sphere.js";import{angle as te}from"../../../../geometry/support/vector.js";import{sv3d as E}from"../../../../geometry/support/vectorStacks.js";import{applyAll as D}from"../../camera/constraintUtils.js";import{ConstraintOptions as O}from"../../camera/constraintUtils/ConstraintOptions.js";import{TiltRange as k}from"../Constraints.js";import{InteractiveController as A}from"./InteractiveController.js";import{panMotionToRotationMatrix as j,onSurfaceTiltToEyeTiltGlobal as M,offSurfaceTiltToEyeTiltGlobal as N}from"../utils/navigationUtils.js";import{viewAngle as P}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as F}from"../../support/cameraUtils.js";import{createDirectionUp as I}from"../../support/cameraUtilsInternal.js";import L from"../../webgl/RenderCamera.js";import{extractTransformation as R,isZeroTransformation as z,extractTransformationKeyboard as B}from"../../../navigation/gamepadAndKeyboardUtils.js";let V=class extends A{constructor(e){super(e),this._filteredSurfaceElevation=0,this._precisionPanEnabled=!1,this._coarsePanEnabled=!1,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new L,this._headingStart=0,this._constraintOptions=new O(15,0,0,new L,null,1)}handleEventGamepad(e){let t=R(e,this.view.navigation.gamepad,this._transformation);(e.action===`end`||z(t))&&this.finishController()}activateDirection(e){this._keysButtonState[e]=1,B(this._keysButtonState,this._transformation)}directionActive(e){return this._keysButtonState[e]===1}countActiveDirections(){return this._keysButtonState.reduce((e,t)=>t>0?e+1:e,0)}deactivateDirection(e){this._keysButtonState[e]=0;let t=B(this._keysButtonState,this._transformation);z(t)&&(this._precisionPanEnabled=!1,this._coarsePanEnabled=!1,this.finishController())}setPrecisionPanEnabled(e){this._precisionPanEnabled=e}setCoarsePanEnabled(e){this._coarsePanEnabled=e}onControllerStart(e){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(e)}_updateFilteredSurfaceElevation(e){let t=this.view.pointsOfInterest.cameraOnSurface.location.z;this._filteredSurfaceElevation+=1*(t-this._filteredSurfaceElevation)*e}stepController(e,t){this._updateStartHeading(),this._updateFilteredSurfaceElevation(e),this.currentCamera.copyViewFrom(t),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(e,this.currentCamera,X),this._applyPan(X.pan),this._applyRotate(X.rotate),this._applyZoom(X.zoom),this._applyAscend(X.ascend),this._constraintOptions.interactionType=0,this._constraintOptions.selection=8,D(this.view,this.currentCamera,this._constraintOptions),super.stepController(e,t)}_updateStartHeading(){this._transformation.heading!==0&&(this._headingStart=this.view.camera.heading)}_applyRotate(e){if(!e.enabled)return;let t=this.currentCamera;u(Z,t.center,t.eye),d(Z,Z,e.matrix),t.center=f(Z,Z,t.eye),t.up=d(Z,t.up,e.matrix),this._constraintOptions.interactionType=3,this._constraintOptions.selection=7,D(this.view,t,this._constraintOptions)}_applyPan(e,t=this.currentCamera){e.enabled&&(t.eye=d(Z,t.eye,e.matrix),t.center=d(Z,t.center,e.matrix),this.view.state.isGlobal&&(t.up=d(Z,t.up,e.matrix)),this._constraintOptions.interactionType=4,this._constraintOptions.selection=15,D(this.view,t,this._constraintOptions))}_applyZoom(e){if(!e)return;let t=this.currentCamera.viewForward;this.currentCamera.eye=f(Z,this.currentCamera.eye,p(E.get(),t,e)),m(Q,t),h(Q,Q),this._constraintOptions.interactionDirection=Q,this._constraintOptions.interactionType=1,this._constraintOptions.selection=7,D(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(e){if(!e)return;let t=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,E.get());if(this._constraintOptions.interactionDirection=m(Q,t),this.view.state.isGlobal){let t=g(this.currentCamera.eye),n=(t+e)/t;this.currentCamera.eye=p(Z,this.currentCamera.eye,n),this.currentCamera.center=p(Z,this.currentCamera.center,n)}else{let n=p(E.get(),t,e);this.currentCamera.eye=f(Z,this.currentCamera.eye,n),this.currentCamera.center=f(Z,this.currentCamera.center,n)}this._updateCameraCenter(),this._constraintOptions.interactionType=5,this._constraintOptions.selection=8,D(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=7,D(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(e,t,n){ie(n);let r=this._computeVelocities(e);this.view.state.isLocal?this._calculateControlTransformationLocal(r,t,n):this._calculateControlTransformationGlobal(r,t,n)}_updateCameraCenter(){let e=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,t=this.view.renderCoordsHelper,n=this.currentCamera.ray;this.currentCamera.center=t.intersectManifoldClosestSilhouette(n,e,Z)}_calculateControlTransformationLocal(e,n,r){let{viewRight:i,viewForward:a}=n,c=this._transformation,l=this.view.navigation.gamepad,u=_(E.get(),a[0],a[1],0);v(u,u);let d=c.translation[0]*e.pan;if(d!==0){let e=p(E.get(),i,d);o(r.pan.matrix,r.pan.matrix,e),r.pan.enabled=!0}switch(l.mode){case`pan`:{let t=-c.translation[1]*e.pan;if(t!==0){let e=p(E.get(),u,t);o(r.pan.matrix,r.pan.matrix,e),r.pan.enabled=!0}r.zoom=c.zoom*e.zoom;break}case`zoom`:r.zoom=(-c.translation[1]+c.zoom)*e.zoom;break;default:l.mode}r.ascend=c.translation[2]*e.ascend;let f=-c.heading*e.rotate;f!==0&&(s(r.rotate.matrix,r.rotate.matrix,f,this.view.renderCoordsHelper.worldUpAtPosition(n.eye,E.get())),r.rotate.enabled=!0);let m=c.tilt*e.rotate,h=P(this.view.renderCoordsHelper,n.center,n.eye),g=t(h+m,k.min,k.max)-h;g&&(s(r.rotate.matrix,r.rotate.matrix,g,i),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(e,t,n){let{eye:r,viewRight:i}=t,a=this._transformation,o=this.view.navigation.gamepad,c=y(E.get(),i,r);v(c,c),h(c,c),j(this.startCamera,t,a,e,this.view.camera.heading,this._headingStart,this.view.camera.tilt,n,o),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(X.pan,this._tmpCamera);let l=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude;n.ascend=a.translation[2]*e.ascend;let u=-a.heading*e.rotate;u!==0&&(s(n.rotate.matrix,n.rotate.matrix,u,this._tmpCamera.eye),n.rotate.enabled=!0);let d=a.tilt*e.rotate,f=this._clampTiltDeltaGlobalToValidRange(d,t.ray,l);f!==0&&(s(n.rotate.matrix,n.rotate.matrix,f,this._tmpCamera.viewRight),n.rotate.enabled=!0),n.zoom+=a.zoom*e.zoom}_clampTiltDeltaGlobalToValidRange(e,n,r){let i=C(this.view.spatialReference),a=M(k.min,n.origin,r,i),o=0,s=0,c=E.get();if(this.view.renderCoordsHelper.intersectManifold(n,r,c)){let e=P(this.view.renderCoordsHelper,c,n.origin);o=M(e,n.origin,r,i),s=M(k.max,n.origin,r,i)}else{$.radius=r+i.radius,$.closestPointOnSilhouette(n,c);let e=Math.PI+te(n.direction,c);o=N(e,n.origin,r,i),s=N(k.max,n.origin,r,i)}return t(o+e,a,s)-o}_getPointAbsoluteSurfaceElevation(e,t,n){let{renderCoordsHelper:r}=this.view,i=r.getAltitude(e),a=t+Math.abs(i-t);return r.setAltitude(n,a,e),a}_clampedDistanceToSurface(e,t){let{renderCoordsHelper:n}=this.view,{camera:r}=this.view.state,{direction:i}=F(this.view,t,0,U,re),a=n.intersectManifoldClosestSilhouette(w(t,i),e,E.get()),o=b(t,a),s=n.intersectManifoldClosestSilhouette(w(t,ee(E.get(),t,r.center)),e,E.get()),c=b(t,s);return Math.min(o,c)}_computeHeadingRotateRadius(e){let{renderCoordsHelper:t,state:r}=this.view,{camera:i,isGlobal:a}=r,o=t.intersectManifoldClosestSilhouette(i.ray,this._filteredSurfaceElevation,E.get());if(a){let t=u(E.get(),e,o),r=g(t);p(t,t,1/r);let i=v(E.get(),e),a=n(x(i,t));return r*Math.sin(Math.min(W,a))}{let n=m(E.get(),e);return t.setAltitude(n,this._filteredSurfaceElevation),b(o,n)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:J}_computeVelocities(e){let n=this._filteredSurfaceElevation,r=n+C(this.view.spatialReference).radius,{camera:i,isGlobal:a}=this.view.state,o=E.get(),s=this._getPointAbsoluteSurfaceElevation(i.eye,n,o),c=this._clampedDistanceToSurface(n,o),l=i.width/2,u=G*i.width,d=G*i.width,f=i.computeRenderPixelSizeAtDistance(c),p=f/r,m=f/this._computeHeadingRotateRadius(o),h=a?p:f,g=this._precisionPanEnabled===this._coarsePanEnabled?1:this._precisionPanEnabled?K:q,_=h*u*e*g,v=s-n;return{pan:_,ascend:Math.max(this._minimumAscendVelocity()*e,2**(u*e/l)*v-v),zoom:2**(u*e/l)*c-c,rotate:t(m*d,Y,ne)*e}}static activatesFor(e,t){let n=R(t,e.navigation.gamepad,H);return!(t.action===`end`||z(n))}};e([i({constructOnly:!0})],V.prototype,`gamepadDevice`,void 0),V=e([a(`esri.views.3d.state.controllers.GamepadKeyboardController`)],V);const H={translation:[0,0,0],heading:0,tilt:0,zoom:0},U=80,W=r(80),G=.75,K=.25,q=4,J=5,Y=r(30),ne=r(80),X={zoom:0,ascend:0,pan:{enabled:!1,matrix:l()},rotate:{enabled:!1,matrix:l()}},Z=S(),Q=S(),re=I(),$=new T;function ie(e){e.zoom=0,e.ascend=0,e.pan.enabled=!1,c(e.pan.matrix),e.rotate.enabled=!1,c(e.rotate.matrix)}export{V as GamepadKeyboardController};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../core/Evented.js";import
|
|
2
|
+
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../core/Evented.js";import{on as n}from"../../../core/reactiveUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{IntegratedMeshSemantics as a}from"../../../layers/support/IntegratedMeshSemantics.js";import{isIntegratedMeshLayerView as o}from"../../support/layerViewUtils.js";let s=class extends t{constructor(e){super(e),this._integratedMeshElevationUpdateHandles=new Map}initialize(){let e=this._integratedMeshElevationUpdateHandles;this.addHandles([n(()=>this.view.groundView,`elevation-change`,e=>this._elevationChange(e)),this.view.allLayerViews.on(`change`,t=>{t.added.forEach(t=>{if(!o(t)||a.contributesToGroundElevation(t.layer,t.replacesTerrain))return;let n=t.elevationProvider.on(`elevation-change`,e=>this._elevationChange(e));e.set(t,n),this.addHandles(n,t)}),t.removed.forEach(t=>{o(t)&&(this.removeHandles(t),e.delete(t))})})])}intersect(e,t,n,r){this.view.groundView.intersect(e,t,n,r);for(let i of this._integratedMeshElevationUpdateHandles.keys())i.intersect(e,t,n,r)}_elevationChange(e){this.emit(`elevation-change`,e)}};e([r({constructOnly:!0})],s.prototype,`view`,void 0),s=e([i(`esri.views.3d.support.GroundAndIMSurface`)],s);export{s as GroundAndIMSurface};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{translateAffine as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as t,create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as r,dist as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{negate as o,set as s,transformMat4 as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as d}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as f}from"../../../../geometry/projection/projectors.js";import{center as p,fromBuffer as m,setEmpty as h,expandWithVec3 as g,create as _}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as v}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as
|
|
2
|
+
import{translateAffine as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as t,create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as r,dist as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{negate as o,set as s,transformMat4 as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as d}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as f}from"../../../../geometry/projection/projectors.js";import{center as p,fromBuffer as m,setEmpty as h,expandWithVec3 as g,create as _}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as v}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as y}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as b}from"../../../../geometry/support/HalfFloatArray.js";import{getZeroIndexArray as x}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as ee}from"../../layers/graphics/olidUtils.js";import{getPlanarDistanceToGroundRatio as te}from"../planarDistanceToGroundRatio.js";import{Attribute as S}from"../../webgl-engine/lib/Attribute.js";import{BufferGeometry as ne}from"../../webgl-engine/lib/BufferGeometry.js";import{Buffers as C}from"../../webgl-engine/lib/Buffers.js";import{Geometry as w}from"../../webgl-engine/lib/Geometry.js";import{createVerticesView as T}from"../../webgl-engine/lib/VerticesView.js";import{isImagePattern as re}from"../../webgl-engine/materials/lineStippleUtils.js";import{isClosed as E,ribbonLineVertexCount as D,writeRibbonLineTextureBuffer as O,writeRibbonLineVertices as ie}from"../../webgl-engine/materials/internal/ribbonLineBufferUtils.js";import{getLayout as ae,getTextureBufferLayout as oe}from"../../webgl-engine/shaders/RibbonLineLayouts.js";function k(e,t,n=null){let r=[],i=t.mapPositions,a=P(t,r),o=a.data,s=a.indices.length,c=x(s);return F(t,r,c),R(t,r,c),I(t,r,c),L(t,r,a.indices,c),z(t,r,a.indices,c),B(t,r),V(t,r,a.indices,c),H(e,t,r,o),n!=null&&ee(r,n,c),new w(e,r,i)}function A(n,r,i,a,s=null){let{attributeData:c,removeDuplicateStartEnd:l}=r,u=G(c.position,l),d=T({data:u,size:3,stride:3},3),f=E(n.parameters,d.count),p=ae(n.parameters).createBuffer(D(d.count,f,n.parameters)),m=oe(n.parameters).createBuffer(d.count+(f?3:2)),h=m.layout.fields.has(`u0`)?U(n.parameters,r.overlayInfo,u):null;return o(Q,i.vec3),e($,s??t,Q),O({...c,position:d,distancesToStart:h,olidColor:a},f,{buffer:m,offset:0},$),ie(d.count,f,n.parameters,{buffer:p,offset:0},0),new ne(n,new C(p,m),i,r.mapPositions)}function j(n,r,i,a=null){let s=T({data:r,size:3,stride:3},3),c=E(n.material.parameters,s.count);o(Q,n.localOrigin.vec3),e($,a??t,Q),O({position:s,color:i},c,{buffer:n.getMutableBuffers().storage,offset:0},$)}function M(e,t,n=null){let r=Y(X,e,n);return p(r,Z),t.getOrigin(Z)}function N(e,t,n,r=null){let i=Y(X,n,r);return p(i,Z),t.needsOriginUpdate(e,Z,0)}function P(e,t){let{attributeData:{position:n},removeDuplicateStartEnd:r}=e,i=G(n,r),a=i.length/3,o=Array(2*(a-1)),s=0;for(let e=0;e<a-1;e++)o[s++]=e,o[s++]=e+1;let c=new S(i,o,3,i!==n);return t.push([`position`,c]),c}function F(e,t,n){if(e.attributeData.colorFeature!=null)return;let r=e.attributeData.color;t.push([`color`,new S(r??u,n,4)])}function I(e,t,n){e.attributeData.normal&&t.push([`normal`,new S(e.attributeData.normal,n,3)])}function L(e,t,n,r){let i=e.attributeData.colorFeature;i!=null&&(typeof i==`number`?t.push([`colorFeatureAttribute`,new S([i],r,1,!0)]):t.push([`colorFeatureAttribute`,new S(i,n,1,!0)]))}function R(e,t,n){e.attributeData.sizeFeature??t.push([`size`,new S([e.attributeData.size??1],n,1,!0)])}function z(e,t,n,r){let i=e.attributeData.sizeFeature;i!=null&&(typeof i==`number`?t.push([`sizeFeatureAttribute`,new S([i],r,1,!0)]):t.push([`sizeFeatureAttribute`,new S(i,n,1,!0)]))}function B(e,t){let{attributeData:{position:n,timeStamps:r}}=e;if(!r)return;let i=n.length/3,a=Array(2*(i-1)),o=0;for(let e=0;e<i-1;e++)a[o++]=e,a[o++]=e+1;t.push([`timeStamps`,new S(r,a,q,!0)])}function V(e,t,n,r){let i=e.attributeData.opacityFeature;i!=null&&(typeof i==`number`?t.push([`opacityFeatureAttribute`,new S([i],r,1,!0)]):t.push([`opacityFeatureAttribute`,new S(i,n,1,!0)]))}function H(e,{overlayInfo:t},n,r){let i=U(e.parameters,t,r);i!=null&&n.push([`distanceToStart`,new S(i,n[0][1].indices,1,!0)])}function U(e,t,n){if(t==null||!K(e)||e.stipplePattern==null)return null;let{renderCoordsHelper:a,spatialReference:o}=t,s=o.isGeographic&&a.viewingMode===1,c=e.worldSized||re(e.stipplePattern);if(!c&&!s)return null;let l=n;if(s){let e=v(n.length),t=d(o);for(let r=0;r<e.length;r+=3)f(n,r,e,r,t);l=e}let u=n.length/3,p=y(u+1),m=a.viewingMode===1,h=se,g=ce,_=0,b=0,x=0;r(h,l[b++],l[b++]),b++,p[0]=0;for(let e=1;e<u+1;++e){e===u&&(b=0);let t=b;r(g,l[b++],l[b++]),b++;let a=(n[x+1]+n[t+1])/2,s=c?te(o,m,a):1;_+=i(h,g)*s,p[e]=_,[h,g]=[g,h],x=t}return p}function W(e){let t=e.length;return e[0]===e[t-3]&&e[1]===e[t-2]&&e[2]===e[t-1]}function G(e,t){return t&&e.length>6&&W(e)?e.slice(0,-3):e}function K(e){return`stipplePattern`in e}const se=a(),ce=a(),q=4;function le(e,t,n,r,i,a){if(e==null||e.length===0)return[];let o=[];for(let s=0;s<e.length;s++){let c=e[s];if(c.length<2)continue;let l=c.length,u=v(l*3);for(let e=0;e<l;e++){let t=c[e];u[e*3]=t[0],u[e*3+1]=t[1],u[e*3+2]=t[2]}let d=a?.[s];o.push({attributeData:{position:u,normal:t,colorFeature:n?.[s],opacityFeature:r?.[s],sizeFeature:i?.[s],timeStamps:d==null?void 0:J(d.timeStamps,d.stage)},removeDuplicateStartEnd:!1})}return o}function ue(e,t=0,n=.01){let r=b(e.length);r[0]=0;for(let t=1;t<e.length;t++){let n=e[t-1],i=e[t],a=Math.sqrt((i[0]-n[0])**2+(i[1]-n[1])**2+(i[2]-n[2])**2);r[t]=r[t-1]+a}let i=r.map(e=>e*n);if(t!==0&&t<i.length){let e=i[t];for(let t=0;t<i.length;t++)i[t]-=e}return i}function J(e,t){let n=b(e.length*4),r=e[0],i=e[e.length-1];for(let a=0;a<e.length;a++)n[a*4]=e[a],n[a*4+1]=r,n[a*4+2]=i,n[a*4+3]=t+.5;return n}function Y(e,t,n){if(n==null)return m(t,e);h(e);for(let r=0;r<t.length;r+=3)s(Z,t[r],t[r+1],t[r+2]),c(Z,Z,n),g(e,Z);return e}const X=_(),Z=l(),Q=l(),$=n();export{U as computeLineDistances,A as createBufferGeometry,k as createGeometry,ue as getLinearTimeStamps,le as lineStripsToParameters,N as needsBufferGeometryOriginUpdate,q as numTimeStampValuesPerVertex,M as selectLocalOrigin,J as timeStampsToAttribute,j as updateBufferGeometry};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../Graphic.js";import
|
|
2
|
+
import e from"../../../Graphic.js";import{isIterable as t}from"../../../core/iteratorUtils.js";import{screenPointObjectToArray as n,isScreenPolygon as r,isScreenRect as i,createScreenPointArray as a,createScreenPoint as o}from"../../../core/screenUtils.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../../geometry/Point.js";import l from"../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../geometry/projection/projectVectorToVector.js";import{Sphere as d}from"../../../geometry/support/sphere.js";import{fallbackObjectIDAttribute as f}from"../../../layers/LayerConstants.js";import{IntegratedMeshSemantics as p}from"../../../layers/support/IntegratedMeshSemantics.js";import{isIntegratedMeshLayer as m}from"../../../layers/support/layerUtils.js";import{debugFlags as h}from"./debugFlags.js";import{getElevationAtPoint as g}from"./ElevationProvider.js";import{getGraphicHitDedupeKey as _,resolveOrderedIntersectionHits as v}from"./intersectionHitUtils.js";import{Intersector as y}from"../webgl-engine/lib/Intersector.js";import{isValidIntersectorResultRay as b}from"../webgl-engine/lib/IntersectorResult.js";import{toHit as x,toOwner as S}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as C}from"../webgl-engine/lib/verticalOffsetUtils.js";async function w(e,t,n,o){let s=n?I(e,n):o;if(r(t))return T(e,t,s,n?.excludeLabels);if(i(t))return T(e,O(t),s,n?.excludeLabels);let c=t,l=a(c.x,c.y);s.requiresGroundFeedback=!0,s.enableDraped=!0;let u=new y(e.state.viewingMode);u.options.selectionMode=!0,u.options.store=2,u.options.excludeLabels=n?.excludeLabels??!1,e.sceneIntersectionHelper.intersectIntersectorScreen(l,u,s);let d=await Array.fromAsync(A(e,u.results.all,s.graphics,{getDistance:e=>e.distanceInRenderSpace,getMapPoint:t=>j(e,t),stopAtSupportSurface:!0})),f=u.results.ground,g=S(f,e),_=g!=null&&`type`in g&&m(g)&&p.shouldIntersectAsGround(g)?g:null,v={screenPoint:c,results:d,ground:{mapPoint:j(e,f),distance:b(f)?f.distanceInRenderSpace:0,layer:_}};return h.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(v.intersector=u),v}async function T(e,t,r,i){r.enableDraped=!0;let a=new y(e.state.viewingMode);a.options.selectionMode=!0,a.options.store=2,a.options.excludeLabels=i??!1,await e.sceneIntersectionHelper.intersectIntersectorScreenPolygon(t.map(e=>n(e)),a,r);let o=[];await e.sceneIntersectionHelper.screenPolygonIntersectionTask.scheduleGenerator(async function*(t){for await(let n of A(e,E(e,a.polygonResults.all),r.graphics,{getDistance:e=>e.distance,getMapPoint:()=>null}))o.push(n),t.madeProgress()&&(t=yield)});let s={screenPoint:null,results:o,ground:{mapPoint:null,distance:0,layer:null}};return h.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(s.intersector=a),s}function*E(e,t){let n=D(e);if(n==null)yield*t;else for(let e of t)e.distance!=null&&e.distance<=n&&(yield e)}function D(e){let t=e.basemapTerrain,n=e.state.camera;return e.state.viewingMode!==1||!n.aboveGround||!t?.opaque?null:(G.radius=t.getLowerBoundRadius(),G.distanceToSilhouette(n.eye)*K)}function O(e){return[o(e.x,e.y),o(e.x+e.width,e.y),o(e.x+e.width,e.y+e.height),o(e.x,e.y+e.height)]}function k(e,t,r,i){let a=r?I(e,r):i,o=!!(a.graphics?.include||a.graphics?.exclude),s=!!(a.mediaElements?.include||a.mediaElements?.exclude),c=n(t);a.enableDraped=a.include&&!a.include.has(C)||a.exclude?.has(C);let l=e.sceneIntersectionHelper,u=new y(e.state.viewingMode);if(u.options.selectionMode=!0,u.options.store=o||s?2:0,u.options.excludeLabels=r?.excludeLabels??!1,l.intersectIntersectorScreen(c,u,a),o||s){for(let t of u.results.all){let n=x(t,e);if(n==null||o&&(n.type!==`graphic`||N(a.graphics,n.graphic))||s&&(n.type!==`media`||P(a.mediaElements,n.element)))return j(e,t)}return null}return j(e,u.results.min)}async function*A(e,t,n,r){let i=v(e,r.stopAtSupportSurface?(function*(){for(let n of t){yield n;let t=S(n,e);if(t!=null&&(t===e.map.ground||`type`in t&&m(t)&&p.shouldIntersectAsGround(t)))break}})():t,{getDedupeKey:e=>e.type===`graphic`?M(e.graphic):null,filterHit:e=>e.type!==`graphic`||N(n,e.graphic)});for await(let{input:e,hit:t}of i){let n=r.getMapPoint(e),i=r.getDistance(e);if(t.type===`media`){let e=n?t.element.toSource(n):null;yield{...t,mapPoint:n,distance:i,sourcePoint:e}}else yield{...t,mapPoint:n,distance:i}}}function j(e,t,n){return t.getIntersectionPoint(W)?(n=F(e,W,n),t.intersector===7&&e.basemapTerrain&&(n.z=g(e.basemapTerrain,n)??0),n):null}function M(e){let t=e.getObjectId()??e.attributes?.[f];return e.origin&&t!=null?`o-${e.origin.id}-${t}`:`u-${_(e)}`}function N(e,t){return P(e,M(t))}function P(e,t){return e==null||(e.include==null||e.include.has(t))&&(e.exclude==null||!e.exclude.has(t))}function F(e,t,n){let r=e.spatialReference||l.WGS84;return u(t,e.renderSpatialReference,W,r)?t=W:(r=l.WGS84,u(t,e.renderSpatialReference,W,r)&&(t=W)),n?(n.x=t[0],n.y=t[1],n.z=t[2],n.spatialReference=r):n=new c({x:t[0],y:t[1],z:t[2],m:t[3],spatialReference:r}),n}function I(e,t){let n=L(e,t.include,0),r=L(e,t.exclude,1);return{include:n.layerViewUids,exclude:r.layerViewUids,graphics:{include:n.graphicUids,exclude:r.graphicUids},mediaElements:{include:n.mediaElements,exclude:r.mediaElements}}}function L(n,r,i,a=new R){if(!r)return a;if(r instanceof e)H(a,M(r)),i===0&&(n.graphicsView!=null&&r.layer===n?B(a,n.graphicsView.uid):r.layer&&z(a,n,r.layer.uid));else if(`layer`in r&&`element`in r)U(a,r.element),i===0&&z(a,n,r.layer.uid);else if(!t(r))`layer`in r&&V(a,n,r),`uid`in r&&z(a,n,r.uid);else for(let e of r)if(e===n.graphics&&n.graphicsView!=null)B(a,n.graphicsView.uid);else if(e===n.map.ground){B(a,C);for(let e of n.map.ground.allIntegratedMeshGround)z(a,n,e.uid)}else L(n,e,i,a);return a}class R{constructor(){this.layerViewUids=null,this.graphicUids=null,this.mediaElements=null}}function z(e,t,n){let r=t.allLayerViews.find(e=>e.layer.uid===n);r&&B(e,r.uid)}function B(e,t){e.layerViewUids??=new Map,e.layerViewUids.set(t,!0)}function V(e,t,n){let r=t.allLayerViews.find(e=>e.layer.uid===n.layer.uid);if(!r)return;e.layerViewUids??=new Map;let i=e.layerViewUids.get(r.uid);i!==!0&&(i?i.add(n.id):e.layerViewUids.set(r.uid,new Set([n.id])))}function H(e,t){e.graphicUids??=new Set,e.graphicUids.add(t)}function U(e,t){e.mediaElements??=new Set,e.mediaElements.add(t)}const W=s(),G=new d,K=1.2;export{F as computeMapPointFromVec3d,I as externalToInternalIntersectOptions,w as hitTest,j as intersectResultToMapPoint,N as testGraphicUidFilter,k as toMap};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{createTask as n}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{abortMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as i,isAbortError as a}from"../../../../core/promiseUtils.js";import{on as o,watch as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import d from"../../../../geometry/Point.js";import{center as f}from"../../../../geometry/support/aaBoundingRect.js";import"../../../../core/RandomLCG.js";import"../../../../core/Logger.js";import"../../../../core/units.js";import"../../../../geometry/ellipsoidUtils.js";import"../../../../geometry/Extent.js";import"../../../../geometry/Geometry.js";import"../../../../geometry/Multipoint.js";import"../../../../geometry/Polygon.js";import"../../../../geometry/Polyline.js";import"../../../../geometry/SpatialReference.js";import"../../../../geometry/spatialReferenceEllipsoidUtils.js";import"../../../../geometry/operators/support/GeographicTransformation.js";import"../../../../geometry/projection/projectors.js";import"../../../../geometry/support/spatialReferenceUtils.js";import"../../../../layers/support/ElevationTileData.js";import"../../../../layers/support/TileElevationSampler.js";let p=class extends t{constructor(e){super(e),this._updateTask=null,this.location=null}initialize(){this.view.state.isLocal&&(this.addHandles([o(()=>this._groundView,`elevation-query-change`,()=>{this._invalidateGroundQuery()}),s(()=>[this.view.clippingArea,this._groundView?.spatialReference,this._groundView?.groundExtent],()=>this._update())]),this._update())}destroy(){this._cancelPendingUpdate()}get renderLocation(){if(!this.location)return null;let e=u();return this.view.renderCoordsHelper.toRenderCoords(this.location,e),e}get _ground(){return this.view.map?.ground}get _groundView(){return this.view.groundView}_cancelPendingUpdate(){this._updateTask=r(this._updateTask)}_update(){this._cancelPendingUpdate();let e=this._groundView;if(!e?.elevationQueryReady||e.groundExtent==null||e.spatialReference==null){this._set(`location`,null);return}let t=f(e.groundExtent),r=new d({x:t[0],y:t[1],z:0,spatialReference:e.spatialReference}),o=this._ground;if(o&&o.allLayers.length>0){this._set(`location`,null);let e=null;e=n(async e=>{let t=await o.queryElevation(r,{noDataValue:0,signal:e,cache:this.cache,view:this.view});i(e),this._updateTask=null,this._set(`location`,t.geometry)}),this._updateTask=e,e.promise.catch(t=>{this._updateTask===e&&(this._updateTask=null,a(t))})}else this._set(`location`,r)}_invalidateGroundQuery(){this._cancelPendingUpdate(),this.cache?.clear(),this._set(`location`,null),this._update()}};e([c({constructOnly:!0})],p.prototype,`view`,void 0),e([c({constructOnly:!0})],p.prototype,`cache`,void 0),e([c()],p.prototype,`_updateTask`,void 0),e([c({readOnly:!0})],p.prototype,`location`,void 0),e([c({readOnly:!0})],p.prototype,`renderLocation`,null),e([c()],p.prototype,`_ground`,null),e([c()],p.prototype,`_groundView`,null),p=e([l(`esri.views.3d.support.pointsOfInterest.StableSurfaceCenter`)],p);export{p as StableSurfaceCenter};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{createTask as n}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{abortMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as i,isAbortError as a}from"../../../../core/promiseUtils.js";import{on as o,watch as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import d from"../../../../geometry/Point.js";import{center as f}from"../../../../geometry/support/aaBoundingRect.js";import"../../../../core/RandomLCG.js";import"../../../../core/Logger.js";import"../../../../core/units.js";import"../../../../core/accessorSupport/ObservableBase.js";import"../../../../geometry/ellipsoidUtils.js";import"../../../../geometry/Extent.js";import"../../../../geometry/Geometry.js";import"../../../../geometry/Multipoint.js";import"../../../../geometry/Polygon.js";import"../../../../geometry/Polyline.js";import"../../../../geometry/SpatialReference.js";import"../../../../geometry/spatialReferenceEllipsoidUtils.js";import"../../../../geometry/operators/support/GeographicTransformation.js";import"../../../../geometry/projection/projectors.js";import"../../../../geometry/support/spatialReferenceUtils.js";import"../../../../layers/support/ElevationTileData.js";import"../../../../layers/support/TileElevationSampler.js";let p=class extends t{constructor(e){super(e),this._updateTask=null,this.location=null}initialize(){this.view.state.isLocal&&(this.addHandles([o(()=>this._groundView,`elevation-query-change`,()=>{this._invalidateGroundQuery()}),s(()=>[this.view.clippingArea,this._groundView?.spatialReference,this._groundView?.groundExtent],()=>this._update())]),this._update())}destroy(){this._cancelPendingUpdate()}get renderLocation(){if(!this.location)return null;let e=u();return this.view.renderCoordsHelper.toRenderCoords(this.location,e),e}get _ground(){return this.view.map?.ground}get _groundView(){return this.view.groundView}_cancelPendingUpdate(){this._updateTask=r(this._updateTask)}_update(){this._cancelPendingUpdate();let e=this._groundView;if(!e?.elevationQueryReady||e.groundExtent==null||e.spatialReference==null){this._set(`location`,null);return}let t=f(e.groundExtent),r=new d({x:t[0],y:t[1],z:0,spatialReference:e.spatialReference}),o=this._ground;if(o&&o.allLayers.length>0){this._set(`location`,null);let e=null;e=n(async e=>{let t=await o.queryElevation(r,{noDataValue:0,signal:e,cache:this.cache,view:this.view});i(e),this._updateTask=null,this._set(`location`,t.geometry)}),this._updateTask=e,e.promise.catch(t=>{this._updateTask===e&&(this._updateTask=null,a(t))})}else this._set(`location`,r)}_invalidateGroundQuery(){this._cancelPendingUpdate(),this.cache?.clear(),this._set(`location`,null),this._update()}};e([c({constructOnly:!0})],p.prototype,`view`,void 0),e([c({constructOnly:!0})],p.prototype,`cache`,void 0),e([c()],p.prototype,`_updateTask`,void 0),e([c({readOnly:!0})],p.prototype,`location`,void 0),e([c({readOnly:!0})],p.prototype,`renderLocation`,null),e([c()],p.prototype,`_ground`,null),e([c()],p.prototype,`_groundView`,null),p=e([l(`esri.views.3d.support.pointsOfInterest.StableSurfaceCenter`)],p);export{p as StableSurfaceCenter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{unique as t}from"../../../core/arrayUtils.js";import{EventEmitter as n}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as r,everyMap as i}from"../../../core/MapUtils.js";import{disposeMaybe as a}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as s,syncAndInitial as c,on as l,initial as u}from"../../../core/reactiveUtils.js";import{someSet as d}from"../../../core/SetUtils.js";import{property as f,subclass as p}from"../../../core/accessorSupport/decorators.js";import{ortho as m,fromTranslation as h}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{set as g}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ones as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as v}from"../support/debugFlags.js";import{Overlay as y}from"./Overlay.js";import{OverlayRenderTargets as b}from"./OverlayRenderTargets.js";import x from"../webgl/RenderCamera.js";import{SyncRenderPlugin as S}from"../webgl-engine/effects/RenderPlugin.js";import{renderHighlightBuffer as C}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as w}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as T}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as E,defaultRenderOccludedMask as D}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as O}from"../webgl-engine/lib/ShadowMap.js";import{T as k}from"../../../chunks/Texture.glsl.js";import{TextureTechnique as A}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as j}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as M}from"../webgl-engine/lighting/Lightsources.js";import{O as N}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as P}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as F}from"../../support/Scheduler.js";import{Texture as I}from"../../webgl/Texture.js";import{TextureDescriptor as L}from"../../webgl/TextureDescriptor.js";let R=class extends S{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new N,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new k,this._screenToMapUnitsRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new x,this.events=new n,this.longitudeCyclical=null,this.produces=new Map([[18,e=>e!==10||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1;let{state:t,stage:r}=e.parent.view,i=r.renderer.fboCache,a=r.renderView.renderingContext,s=r.renderView.techniques;this._renderContext=new E(a,new O(i,t.viewingMode),s)}initialize(){let e=this._view,t=e.stage.renderView.waterTextures;this.addHandles([s(()=>t.updating,()=>this.events.emit(`content-changed`),c),s(()=>this._spatialReference,e=>this._localOriginFactory=new T(e),c),l(()=>e.allLayerViews,`after-changes`,()=>this._sortedDrapeSourceRenderersDirty=!0),s(()=>this._highlightsString,()=>this._sortedDrapeSourceRenderersDirty=!0,u),s(()=>e.state.highlights,e=>this._bindParameters.highlights=e,u),e.resourceController.scheduler.registerTask(F.OVERLAY_RENDERER,this)]);let n=this._camera;n.near=1,n.far=1e4,n.relativeElevation=null,this._bindParameters.slot=18,this._bindParameters.camera=n,this._bindParameters.updateLighting(new M(_()),0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=a(this._passParameters.texture),this.disposeOverlays(),this._renderContext.destroy(),this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get _spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToMapUnitsRatio(){return this._screenToMapUnitsRatio}get mapUnitsToGroundRatio(){return this.parent.mapUnitsToPlanarDistanceRatio*this._bindParameters.planarDistanceToGroundRatio}get localOriginFactory(){return this._localOriginFactory}set overlayStretch(e){this._bindParameters.overlayStretch=e}get overlayStretch(){return this._bindParameters.overlayStretch}get _highlightsString(){return JSON.stringify(this._view.state.highlights.reduce((e,t)=>e+`:`+JSON.stringify(t.toJSON()),``))}set time(e){this._renderContext.time=e}get pluginContext(){return this._pluginContext}initializeRenderContext(e){let t=new w(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit(`content-changed`),this.notifyChange(`updating`),this.notifyChange(`isEmpty`)},()=>this.events.emit(`content-changed`));this._pluginContext={...e,materials:t},this._techniques.precompile(P)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||r(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return this._overlays!=null&&this._renderTargets!=null}getMaterialRenderer(e){for(let t of this._renderers.values()){let n=t.getMaterialRenderer(e);if(n)return n}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),t(this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e))}registerDrapeSource(e,t){this._renderers.get(e)?.destroy(),this._renderers.set(e,t),this._sortedDrapeSourceRenderersDirty=!0,`fullOpacity`in e&&this.addHandles(s(()=>e.fullOpacity,()=>this.events.emit(`content-changed`)),e)}removeDrapeSourceRenderer(e){if(e==null)return;let t=this._renderers.get(e);t!=null&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),t.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=this._overlays?d(e,e=>e.drapeTargetType===1):!1}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=d(e,e=>e.drapeSourceType===1),this._hasDrapedRasterSource=d(e,e=>e.drapeSourceType===0),this._hasDrapedFlowSource=d(e,e=>e.drapeSourceType===2)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,t){this._overlays??=(this._renderTargets=new b(this._stage.renderer.fboCache),[new y,new y]),this.ensureDrapeTargets(e),this.ensureDrapeSources(t)}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit(`textures-disposed`)}_useOverlayColorInsteadOfColorNoRasterImage(e){return e===1&&!this._needsColorWithoutRasterImage&&(this._hasDrapedFeatureSource||this._hasDrapedRasterSource)}getTexture(e){let t=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(t?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(()=>!0,e)}_onMaterialOrContentChanged(){this.renderOccludedFlags=r(this._renderers,e=>e.hasOccluders)?V:1}_processDrapeSources(e,t){let n=!1;for(let[r,i]of this._renderers){if(t?.done)break;(r.destroyed||e(r))&&i.commitChanges()&&(n=!0,t?.madeProgress())}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,n=!0,this._updateSortedDrapeSourceRenderers(),t?.madeProgress()),t&&this.compact(t),n&&(this._overlays!=null&&this._renderers.size===0&&this.disposeOverlays(),this.notifyChange(`updating`),this.notifyChange(`isEmpty`),this._onMaterialOrContentChanged(),this.hasHighlights=r(this._renderers,e=>e.hasHighlights),this.events.emit(`content-changed`))}compact(e){let t=!1;for(let n of this._renderers.values()){if(e.done)break;t=n.compact(e)||t}return t&&this.notifyChange(`updating`),t}hasHighlight(e){return r(this._renderers,t=>t.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(e=>e.updatePolicy===1)}get isEmpty(){return!v.OVERLAY_DRAW_DEBUG_TEXTURE&&i(this._renderers,e=>e.isEmpty)}get hasWater(){let e=r(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit(`has-water`)),this._hasWater}renders(e){if(v.OVERLAY_DRAW_DEBUG_TEXTURE&&e!==4&&e!==2)return!0;if(!this._overlays)return!1;let t=this._overlays[0];for(let e of this._overlays)e.setupGeometryViews(this.longitudeCyclical);if(!t.hasSomeSizedView())return!1;let n=this._setOutput(this._renderTargets?.targets.find(t=>t.content===e)?.output??0),r=this._bindParameters,i=r.highlightMixTexture;r.output===10&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null),++this._techniques.precompiling;let a=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,r.highlightMixTexture=i,this._setOutput(n),a}_setOutput(e){let t=this._bindParameters.output;return this._bindParameters.output=e,this._bindParameters.slot=e===4?19:18,t}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:+!!this._renderTargets?.getTexture(0)}updateAnimation(e){let t=!1;return this._renderers.forEach(n=>t=n.updateAnimation(e)||t),t&&this.parent.requestRender(0),t}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;let t=this._bindParameters;t.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(let e of this._renderTargets.targets){if(e.content===1&&!this._needsColorWithoutRasterImage)continue;let{output:n}=e;this._setOutput(n),n===10&&(t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null);let r=this._renderContext.renderOccludedMask;e.content===4&&(this._renderContext.renderOccludedMask=V),this._sortedRenderers.forAll(({drapeSource:t,renderer:n})=>{e.content===1&&t.drapeSourceType===0||e.content===4&&n.hasOnlyOccluders||n.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=r,t.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,t){if(!this._overlays||!this._renderTargets)return;for(let e of this._overlays)e.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;let n=this.allSourcesOccluders;for(let e of this._renderTargets.targets){if(!(e.content===0&&this._hasDrapedFlowSource)&&!e.handleRenderRequest(t)||e.content===1&&!this._needsColorWithoutRasterImage||e.content===4&&n)continue;let r=this._drawTarget(0,e),i=this._drawTarget(1,e);(r||i)&&e.fbo.generateMipMap()}}_drawTarget(e,t){let n=this._overlays[e],r=n.canvasGeometries;if(r.numViews===0)return!1;let i=this._view.state.contentPixelRatio;this._screenToMapUnitsRatio=i*n.mapUnitsPerPixel/this._bindParameters.overlayStretch;let{output:a,content:o}=t;if(this.isEmpty||a===4&&!this.hasWater||!n.hasSomeSizedView())return!1;let{_rctx:s,_camera:c,_renderContext:l,_bindParameters:u}=this;if(c.pixelRatio=n.pixelRatio*i,this._setOutput(a),u.screenToMapUnitsRatio=this._screenToMapUnitsRatio,u.screenToPlanarDistanceRatio=this._screenToMapUnitsRatio*this.parent.mapUnitsToPlanarDistanceRatio,o===4&&(l.renderOccludedMask=V),!this.renders(o))return l.renderOccludedMask=D,!1;let{resolution:d}=n,f=e===0,p=f?0:d;if(s.setViewport(p,0,d,d),this._bindTargetFBO(t),f&&(a===10?s.gl.clearBufferuiv(s.gl.COLOR,0,[0,0,0,0]):(s.setClearColor(0,0,0,0),s.clear(16384))),v.OVERLAY_DRAW_DEBUG_TEXTURE&&o!==4&&o!==2){this._techniques.precompile(A,H);let t=this._techniques.get(A,H);for(let i=0;i<r.numViews;i++)this._setViewParameters(r.extents[i],n),this._ensureDebugPatternResources(n.resolution,B[e]),s.bindTechnique(t,u,this._passParameters),s.screen.draw()}if(a===10){let{fboCache:n}=this._stage.renderer,r=this._resolution;this._bindTargetFBO(t),C(s,n,r,r,u,()=>this._renderAllGeometry(e,t),p)}else this._renderAllGeometry(e,t);return s.bindFramebuffer(null),l.renderOccludedMask=D,!0}get allSourcesOccluders(){return i(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,t){let n=this._overlays[e],r=n.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:a})=>{if(t.content===1&&i.drapeSourceType===0)return;let{fullOpacity:o}=i,s=o!=null&&o<1&&t.output===0&&this._bindTemporaryFBO();for(let e=0;e<r.numViews;e++)this._setViewParameters(r.extents[e],n),a.render(this._renderContext);if(s){this._bindTargetFBO(t),this._overlayParameters.texture=s.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;let n=this._techniques.get(P);this._rctx.bindTechnique(n,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),s.release()}})}_bindTargetFBO(e){let t=this._resolution,n=2*t;e.fbo.ensureFramebuffer(n,t),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){let e=this._resolution,t=2*e,n=this._stage.renderer.fboCache,r=n.acquire(t,e,`overlay tmp`);return n.rctx.bindFramebuffer(r.fbo),n.rctx.clear(16384),r}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit(`content-changed`)}intersectRay(e,t,n,r){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(let{renderer:a}of this._sortedRenderers)i=a.intersectRay?.(e,t,n,r,i)??i}*intersectScreenPolygon(e,t,n){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let r=0;for(let{renderer:i}of this._sortedRenderers)r=yield*i.intersectScreenPolygon(e,t,n,r)}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),this._renderers.size===0)return;let e=this._view.map.allLayers.map(e=>e.uid),t=e.length;this._renderers.forEach((n,r)=>{let i=e.indexOf(r.layer?.uid),a=i>=0,o=r.renderGroup??+!a,s=r.drapeSourcePriorityOffset??0,c=t*o+(a?i:0)+s;this._sortedRenderers.push(new z(r,n,c))}),this._sortedRenderers.sort((e,t)=>e.index-t.index)}_setViewParameters(e,t){let n=this._camera;n.viewport=[0,0,t.resolution,t.resolution],this._bindParameters.planarDistanceToGroundRatio=this.parent.getPlanarDistanceToGroundRatio((e[1]+e[3])*.5),m(n.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],n.near,n.far),h(n.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,t){if(g(this._passParameters.color,t[0],t[1],t[2]),this._passParameters.texture)return;let n=new Uint8Array(e*e*4),r=0;for(let t=0;t<e;t++)for(let i=0;i<e;i++){let a=Math.floor(i/10),o=Math.floor(t/10);a<2||o<2||a*10>e-20||o*10>e-20?(n[r++]=255,n[r++]=255,n[r++]=255,n[r++]=255):(n[r++]=255,n[r++]=255,n[r++]=255,a&1&&o&1?n[r++]=i&1^t&1?0:255:n[r++]=a&1^o&1?0:128)}let i=new L(e);i.samplingMode=9728,this._passParameters.texture=new I(this._rctx,i,n)}get test(){}};e([f()],R.prototype,`hasHighlights`,void 0),e([f()],R.prototype,`renderOccludedFlags`,void 0),e([f()],R.prototype,`_sortedDrapeSourceRenderersDirty`,void 0),e([f({constructOnly:!0})],R.prototype,`parent`,void 0),e([f({readOnly:!0})],R.prototype,`_techniques`,null),e([f()],R.prototype,`_highlightsString`,null),e([f({type:Boolean,readOnly:!0})],R.prototype,`updating`,null),e([f()],R.prototype,`isEmpty`,null),R=e([p(`esri.views.3d.terrain.OverlayRenderer`)],R);class z{constructor(e,t,n){this.drapeSource=e,this.renderer=t,this.index=n}}const B=[[1,.5,.5],[.5,.5,1]],V=4,H=new j;H.hasAlpha=!0;export{R as OverlayRenderer,V as overlayRenderOccludedFlag};
|
|
2
|
+
import{__decorate as e}from"tslib";import{unique as t}from"../../../core/arrayUtils.js";import{EventEmitter as n}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as r,everyMap as i}from"../../../core/MapUtils.js";import{disposeMaybe as a}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as s,syncAndInitial as c,on as l,initial as u}from"../../../core/reactiveUtils.js";import{someSet as d}from"../../../core/SetUtils.js";import{property as f,subclass as p}from"../../../core/accessorSupport/decorators.js";import{ortho as m,fromTranslation as h}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{set as g}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ones as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as v}from"../support/debugFlags.js";import{Overlay as y}from"./Overlay.js";import{OverlayRenderTargets as b}from"./OverlayRenderTargets.js";import x from"../webgl/RenderCamera.js";import{SyncRenderPlugin as S}from"../webgl-engine/effects/RenderPlugin.js";import{renderHighlightBuffer as C}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as w}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as T}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as E,defaultRenderOccludedMask as D}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as O}from"../webgl-engine/lib/ShadowMap.js";import{T as k}from"../../../chunks/Texture.glsl.js";import{TextureTechnique as A}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as j}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as M}from"../webgl-engine/lighting/Lightsources.js";import{O as N}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as P}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as F}from"../../support/Scheduler.js";import{Texture as I}from"../../webgl/Texture.js";import{TextureDescriptor as L}from"../../webgl/TextureDescriptor.js";let R=class extends S{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new N,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new k,this._screenToMapUnitsRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new x,this.events=new n,this.longitudeCyclical=null,this.produces=new Map([[18,e=>e!==10||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1;let{state:t,stage:r}=e.parent.view,i=r.renderer.fboCache,a=r.renderView.renderingContext,s=r.renderView.techniques;this._renderContext=new E(a,new O(i,t.viewingMode),s)}initialize(){let e=this._view,t=e.stage.renderView.waterTextures;this.addHandles([s(()=>t.updating,()=>this.events.emit(`content-changed`),c),s(()=>this._spatialReference,e=>this._localOriginFactory=new T(e),c),l(()=>e.allLayerViews,`after-changes`,()=>this._sortedDrapeSourceRenderersDirty=!0),s(()=>this._highlightsString,()=>this._sortedDrapeSourceRenderersDirty=!0,u),s(()=>e.state.highlights,e=>this._bindParameters.highlights=e,u),e.resourceController.scheduler.registerTask(F.OVERLAY_RENDERER,this)]);let n=this._camera;n.near=1,n.far=1e4,n.relativeElevation=null,this._bindParameters.slot=18,this._bindParameters.camera=n,this._bindParameters.updateLighting(new M(_()),0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=a(this._passParameters.texture),this.disposeOverlays(),this._renderContext.destroy(),this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get _spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToMapUnitsRatio(){return this._screenToMapUnitsRatio}get mapUnitsToGroundRatio(){return this.parent.mapUnitsToPlanarDistanceRatio*this._bindParameters.planarDistanceToGroundRatio}get localOriginFactory(){return this._localOriginFactory}set overlayStretch(e){this._bindParameters.overlayStretch=e}get overlayStretch(){return this._bindParameters.overlayStretch}get _highlightsString(){return JSON.stringify(this._view.state.highlights.reduce((e,t)=>e+`:`+JSON.stringify(t.toJSON()),``))}set time(e){this._renderContext.time=e}get pluginContext(){return this._pluginContext}initializeRenderContext(e){let t=new w(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit(`content-changed`),this.notifyChange(`updating`),this.notifyChange(`isEmpty`)},()=>this.events.emit(`content-changed`));this._pluginContext={...e,materials:t},this._techniques.precompile(P)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||r(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return this._overlays!=null&&this._renderTargets!=null}getMaterialRenderer(e){for(let t of this._renderers.values()){let n=t.getMaterialRenderer(e);if(n)return n}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),t(this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e))}registerDrapeSource(e,t){this._renderers.get(e)?.destroy(),this._renderers.set(e,t),this._sortedDrapeSourceRenderersDirty=!0,`fullOpacity`in e&&this.addHandles(s(()=>e.fullOpacity,()=>this.events.emit(`content-changed`)),e)}removeDrapeSourceRenderer(e){if(e==null)return;let t=this._renderers.get(e);t!=null&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),t.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=this._overlays?d(e,e=>e.drapeTargetType===1):!1}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=d(e,e=>e.drapeSourceType===1),this._hasDrapedRasterSource=d(e,e=>e.drapeSourceType===0),this._hasDrapedFlowSource=d(e,e=>e.drapeSourceType===2)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,t){this._overlays??=(this._renderTargets=new b(this._stage.renderer.fboCache),[new y,new y]),this.ensureDrapeTargets(e),this.ensureDrapeSources(t)}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit(`textures-disposed`)}_useOverlayColorInsteadOfColorNoRasterImage(e){return e===1&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource}getTexture(e){let t=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(t?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(()=>!0,e)}_onMaterialOrContentChanged(){this.renderOccludedFlags=r(this._renderers,e=>e.hasOccluders)?V:1}_processDrapeSources(e,t){let n=!1;for(let[r,i]of this._renderers){if(t?.done)break;(r.destroyed||e(r))&&i.commitChanges()&&(n=!0,t?.madeProgress())}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,n=!0,this._updateSortedDrapeSourceRenderers(),t?.madeProgress()),t&&this.compact(t),n&&(this._overlays!=null&&this._renderers.size===0&&this.disposeOverlays(),this.notifyChange(`updating`),this.notifyChange(`isEmpty`),this._onMaterialOrContentChanged(),this.hasHighlights=r(this._renderers,e=>e.hasHighlights),this.events.emit(`content-changed`))}compact(e){let t=!1;for(let n of this._renderers.values()){if(e.done)break;t=n.compact(e)||t}return t&&this.notifyChange(`updating`),t}hasHighlight(e){return r(this._renderers,t=>t.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(e=>e.updatePolicy===1)}get isEmpty(){return!v.OVERLAY_DRAW_DEBUG_TEXTURE&&i(this._renderers,e=>e.isEmpty)}get hasWater(){let e=r(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit(`has-water`)),this._hasWater}renders(e){if(v.OVERLAY_DRAW_DEBUG_TEXTURE&&e!==4&&e!==2)return!0;if(!this._overlays)return!1;let t=this._overlays[0];for(let e of this._overlays)e.setupGeometryViews(this.longitudeCyclical);if(!t.hasSomeSizedView())return!1;let n=this._setOutput(this._renderTargets?.targets.find(t=>t.content===e)?.output??0),r=this._bindParameters,i=r.highlightMixTexture;r.output===10&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null),++this._techniques.precompiling;let a=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,r.highlightMixTexture=i,this._setOutput(n),a}_setOutput(e){let t=this._bindParameters.output;return this._bindParameters.output=e,this._bindParameters.slot=e===4?19:18,t}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:+!!this._renderTargets?.getTexture(0)}updateAnimation(e){let t=!1;return this._renderers.forEach(n=>t=n.updateAnimation(e)||t),t&&this.parent.requestRender(0),t}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;let t=this._bindParameters;t.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(let e of this._renderTargets.targets){if(e.content===1&&!this._needsColorWithoutRasterImage)continue;let{output:n}=e;this._setOutput(n),n===10&&(t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null);let r=this._renderContext.renderOccludedMask;e.content===4&&(this._renderContext.renderOccludedMask=V),this._sortedRenderers.forAll(({drapeSource:t,renderer:n})=>{e.content===1&&t.drapeSourceType===0||e.content===4&&n.hasOnlyOccluders||n.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=r,t.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,t){if(!this._overlays||!this._renderTargets)return;for(let e of this._overlays)e.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;let n=this.allSourcesOccluders;for(let e of this._renderTargets.targets){if(!(e.content===0&&this._hasDrapedFlowSource)&&!e.handleRenderRequest(t)||e.content===1&&!this._needsColorWithoutRasterImage||e.content===4&&n)continue;let r=this._drawTarget(0,e),i=this._drawTarget(1,e);(r||i)&&e.fbo.generateMipMap()}}_drawTarget(e,t){let n=this._overlays[e],r=n.canvasGeometries;if(r.numViews===0)return!1;let i=this._view.state.contentPixelRatio;this._screenToMapUnitsRatio=i*n.mapUnitsPerPixel/this._bindParameters.overlayStretch;let{output:a,content:o}=t;if(this.isEmpty||a===4&&!this.hasWater||!n.hasSomeSizedView())return!1;let{_rctx:s,_camera:c,_renderContext:l,_bindParameters:u}=this;if(c.pixelRatio=n.pixelRatio*i,this._setOutput(a),u.screenToMapUnitsRatio=this._screenToMapUnitsRatio,u.screenToPlanarDistanceRatio=this._screenToMapUnitsRatio*this.parent.mapUnitsToPlanarDistanceRatio,o===4&&(l.renderOccludedMask=V),!this.renders(o))return l.renderOccludedMask=D,!1;let{resolution:d}=n,f=e===0,p=f?0:d;if(s.setViewport(p,0,d,d),this._bindTargetFBO(t),f&&(a===10?s.gl.clearBufferuiv(s.gl.COLOR,0,[0,0,0,0]):(s.setClearColor(0,0,0,0),s.clear(16384))),v.OVERLAY_DRAW_DEBUG_TEXTURE&&o!==4&&o!==2){this._techniques.precompile(A,H);let t=this._techniques.get(A,H);for(let i=0;i<r.numViews;i++)this._setViewParameters(r.extents[i],n),this._ensureDebugPatternResources(n.resolution,B[e]),s.bindTechnique(t,u,this._passParameters),s.screen.draw()}if(a===10){let{fboCache:n}=this._stage.renderer,r=this._resolution;this._bindTargetFBO(t),C(s,n,r,r,u,()=>this._renderAllGeometry(e,t),p)}else this._renderAllGeometry(e,t);return s.bindFramebuffer(null),l.renderOccludedMask=D,!0}get allSourcesOccluders(){return i(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,t){let n=this._overlays[e],r=n.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:a})=>{if(t.content===1&&i.drapeSourceType===0)return;let{fullOpacity:o}=i,s=o!=null&&o<1&&t.output===0&&this._bindTemporaryFBO();for(let e=0;e<r.numViews;e++)this._setViewParameters(r.extents[e],n),a.render(this._renderContext);if(s){this._bindTargetFBO(t),this._overlayParameters.texture=s.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;let n=this._techniques.get(P);this._rctx.bindTechnique(n,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),s.release()}})}_bindTargetFBO(e){let t=this._resolution,n=2*t;e.fbo.ensureFramebuffer(n,t),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){let e=this._resolution,t=2*e,n=this._stage.renderer.fboCache,r=n.acquire(t,e,`overlay tmp`);return n.rctx.bindFramebuffer(r.fbo),n.rctx.clear(16384),r}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit(`content-changed`)}intersectRay(e,t,n,r){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(let{renderer:a}of this._sortedRenderers)i=a.intersectRay?.(e,t,n,r,i)??i}*intersectScreenPolygon(e,t,n){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let r=0;for(let{renderer:i}of this._sortedRenderers)r=yield*i.intersectScreenPolygon(e,t,n,r)}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),this._renderers.size===0)return;let e=this._view.map.allLayers.map(e=>e.uid),t=e.length;this._renderers.forEach((n,r)=>{let i=e.indexOf(r.layer?.uid),a=i>=0,o=r.renderGroup??+!a,s=r.drapeSourcePriorityOffset??0,c=t*o+(a?i:0)+s;this._sortedRenderers.push(new z(r,n,c))}),this._sortedRenderers.sort((e,t)=>e.index-t.index)}_setViewParameters(e,t){let n=this._camera;n.viewport=[0,0,t.resolution,t.resolution],this._bindParameters.planarDistanceToGroundRatio=this.parent.getPlanarDistanceToGroundRatio((e[1]+e[3])*.5),m(n.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],n.near,n.far),h(n.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,t){if(g(this._passParameters.color,t[0],t[1],t[2]),this._passParameters.texture)return;let n=new Uint8Array(e*e*4),r=0;for(let t=0;t<e;t++)for(let i=0;i<e;i++){let a=Math.floor(i/10),o=Math.floor(t/10);a<2||o<2||a*10>e-20||o*10>e-20?(n[r++]=255,n[r++]=255,n[r++]=255,n[r++]=255):(n[r++]=255,n[r++]=255,n[r++]=255,a&1&&o&1?n[r++]=i&1^t&1?0:255:n[r++]=a&1^o&1?0:128)}let i=new L(e);i.samplingMode=9728,this._passParameters.texture=new I(this._rctx,i,n)}get test(){}};e([f()],R.prototype,`hasHighlights`,void 0),e([f()],R.prototype,`renderOccludedFlags`,void 0),e([f()],R.prototype,`_sortedDrapeSourceRenderersDirty`,void 0),e([f({constructOnly:!0})],R.prototype,`parent`,void 0),e([f({readOnly:!0})],R.prototype,`_techniques`,null),e([f()],R.prototype,`_highlightsString`,null),e([f({type:Boolean,readOnly:!0})],R.prototype,`updating`,null),e([f()],R.prototype,`isEmpty`,null),R=e([p(`esri.views.3d.terrain.OverlayRenderer`)],R);class z{constructor(e,t,n){this.drapeSource=e,this.renderer=t,this.index=n}}const B=[[1,.5,.5],[.5,.5,1]],V=4,H=new j;H.hasAlpha=!0;export{R as OverlayRenderer,V as overlayRenderOccludedFlag};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{clamp as e,isPowerOfTwo as t}from"../../../core/mathUtils.js";import{maxUint16 as n}from"../../../core/typedArrayUtil.js";import{empty as r}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as i}from"../../../geometry/support/aaBoundingRect.js";import{sampleElevation as a,sampleSingleElevation as o}from"./ElevationData.js";import{PatchGeometryLUT as s}from"./PatchGeometryLUT.js";import{zeroToFour as c,neighborTileIfLoadedOrSelf as l}from"./PatchRenderData.js";import{maxPatchTesselation as u,elevationNoDataValue as d}from"./TerrainConst.js";import{internalAssert as f,enableTerrainInternalChecks as p,neighborEdgeIndices as m,almostEquals as h}from"./terrainUtils.js";import{isCornerNeighbor as g}from"./Tile.js";import{compareTilesByLij as _}from"./tileUtils.js";import{compressNormal as v}from"../webgl-engine/lib/Normals.js";function y(e,t){let{tile:n,geometry:i,geometryState:a}=e,{extentInRadians:o,surface:s}=n,{isWebMercator:c,renderer:l}=s,{numVerticesPerSide:u,wireframe:d}=a,f=u-1,p=(u-2)**2,m=c&&(t===2||t===3),h=c&&(t===1||t===3),g=(+!!m+ +!!h)*Ee*u,_=xe(a),v=4*_,y=p+g+v,S=l.tileGeometryCache.acquire(y);i.numVerticesPerSide=u,i.vertexAttributes=S,i.maxEdgeVertexCount=_;let{boundingBox:C}=i;r(C);let w=P(e);$.update(f,o,w),x(e),i.poleVerticesStartIndex=p;let T=b(e,m,h);i.edgeVerticesStartIndex=p+g,te(e),O(e,we,Te),W(i,T,d),e.intersectionData=null}function b(e,t,r){let{tile:i,localOrigin:a,geometry:o}=e,{extent:s,ellipsoid:c}=i,{boundingBox:l,numVerticesPerSide:u,vertexAttributes:d,poleVerticesStartIndex:f}=o,p=u-1,m=a[0],h=a[1],g=a[2],_=c.radius,y=s[1],b=s[3],x=[],S=f,C=(e,t)=>{let r=t*u;be(-m,-h,-g+e*_,l),x.push(new oe(e===1,r,e===1?0:2,S,Ee));let i=j(e===-1?y:b,_),a=e*Math.PI/2-i,o=(e===1?1:-1)*.99,s=_+0,{position:c,uv0:f}=d,{typedBuffer:C,typedBufferStride:w}=d.normalCompressed;for(let e=1;e<=Ee;++e){let t=i+e/Ee*a,r=Math.cos(t),u=Math.sin(t);for(let e=0;e<=p;e++){let t=e/p,i=$.sinLonLUT[e],a=$.cosLonLUT[e]*r,d=i*r,_=u,y=a*s-m,b=d*s-h,x=_*s-g;be(y,b,x,l),c.setValues(S,y,b,x),f.setValues(S,Math.round(t*n),Math.round(o*n)),v(C,S,a,d,_,w),++S}}};return t&&C(-1,0),r&&C(1,p),x}function x(e){let t=e.geometryState.samplerData,n=t?.length===1?t[0]:null;n?S(e,n):C(e)}function S(e,t){let{tile:n}=e;if(!n.intersectsClippingArea)return;let{geometry:r,geometryState:i,localOrigin:a}=e,{numVerticesPerSide:o}=i,s=o-2,c=o-1,{vertexAttributes:l,boundingBox:u}=r,{position:d,uv0:f}=l,{typedBuffer:p,typedBufferStride:m}=l.normalCompressed,{extent:h}=n,g=n.ellipsoid.radius,_=a[0],y=a[1],b=a[2],x=d.typedBuffer,S=d.typedBufferStride,C=f.typedBuffer,E=f.typedBufferStride;w(c,h,t);let D=0,O=t.data.values;if(1<=s){let e=le[1],t=$.sinLatLUT[1],n=$.cosLatLUT[1];for(let r=1;r<=s;r++){let i=$.sinLonLUT[r],a=$.cosLonLUT[r],o=g+T(r,1,O),s=-_+o*a*n,c=-y+o*i*n,l=-b+o*t;be(s,c,l,u);let d=(r-1)*S;x[d]=s,x[d+1]=c,x[d+2]=l;let f=(r-1)*E;C[f]=le[r],C[f+1]=e}}for(let e=1;e<=s;e++){let t=$.sinLatLUT[e],n=$.cosLatLUT[e],r=e+1,i=le[r],a=$.sinLatLUT[r],o=$.cosLatLUT[r],l=$.sinLonLUT[0],d=$.cosLonLUT[0],f=g+T(0,e,O),h=d*n*f-_,w=l*n*f-y,k=t*f-b,A=D*S,j=x[A],M=x[A+1],N=x[A+2];for(let l=1;l<=s;l++){let d=$.sinLonLUT[l],f=$.cosLonLUT[l],A=0,P=0,F=0;if(l<s){let e=(D+1)*S;A=x[e],P=x[e+1],F=x[e+2]}else{let r=$.sinLonLUT[c],i=$.cosLonLUT[c],a=g+T(c,e,O);A=i*n*a-_,P=r*n*a-y,F=t*a-b}let I=h,L=w,R=k;h=j,w=M,k=N,j=A,M=P,N=F;let z=A-I,B=P-L,V=F-R,H=0,U=0,ee=0;if(e>1){let e=(D-s)*S;H=x[e],U=x[e+1],ee=x[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=g+T(l,0,O);H=f*t*n-_,U=d*t*n-y,ee=e*n-b}let W=g+T(l,r,O),G=f*o*W-_,K=d*o*W-y,q=a*W-b;if(e<s){let e=D+s,t=e*S;x[t]=G,x[t+1]=K,x[t+2]=q,be(G,K,q,u);let n=e*E;C[n]=le[l],C[n+1]=i}let J=H-G,Y=U-K,X=ee-q,te=f*n,Z=d*n,ne=t;ne*ne<.999&&(te=V*Y-B*X,Z=z*X-V*J,ne=B*J-z*Y),v(p,D,te,Z,ne,m),++D}}}function C(e){let{tile:t}=e;if(!t.intersectsClippingArea)return;let{geometry:r,geometryState:i,localOrigin:o}=e,{numVerticesPerSide:s,samplerData:c}=i,l=s-2,u=s-1,{vertexAttributes:d,boundingBox:f}=r,{position:p,uv0:m}=d,{typedBuffer:h,typedBufferStride:g}=d.normalCompressed,{extent:_}=t,y=_[0],b=_[2],x=_[1],S=_[3],C=t.ellipsoid.radius,w=o[0],T=o[1],E=o[2],D=p.typedBuffer,O=p.typedBufferStride,k=1/u,A=0;if(1<=l){let e=k,t=x*(1-e)+S*e,r=$.sinLatLUT[1],i=$.cosLatLUT[1];for(let o=1;o<=l;o++){let s=o*k,l=y*(1-s)+b*s,u=$.sinLonLUT[o],d=$.cosLonLUT[o],p=C+a(l,t,c),h=-w+p*d*i,g=-T+p*u*i,_=-E+p*r;be(h,g,_,f);let v=(o-1)*O;D[v]=h,D[v+1]=g,D[v+2]=_,m.setValues(o-1,Math.round(s*n),Math.round(e*n))}}for(let e=1;e<=l;e++){let t=e*k,r=x*(1-t)+S*t,i=$.sinLatLUT[e],o=$.cosLatLUT[e],s=e+1,d=s*k,p=x*(1-d)+S*d,_=$.sinLatLUT[s],j=$.cosLatLUT[s],M=$.sinLonLUT[0],N=$.cosLonLUT[0],P=C+a(y,r,c),F=N*o*P-w,I=M*o*P-T,L=i*P-E,R=A*O,z=D[R],B=D[R+1],V=D[R+2];for(let t=1;t<=l;t++){let s=t*k,S=y*(1-s)+b*s,M=$.sinLonLUT[t],N=$.cosLonLUT[t],P=0,R=0,H=0;if(t<l){let e=(A+1)*O;P=D[e],R=D[e+1],H=D[e+2]}else{let e=$.sinLonLUT[u],t=$.cosLonLUT[u],n=C+a(b,r,c);P=t*o*n-w,R=e*o*n-T,H=i*n-E}let U=F,ee=I,W=L;F=z,I=B,L=V,z=P,B=R,V=H;let G=P-U,K=R-ee,q=H-W,J=0,Y=0,X=0;if(e>1){let e=(A-l)*O;J=D[e],Y=D[e+1],X=D[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=C+a(S,x,c);J=N*t*n-w,Y=M*t*n-T,X=e*n-E}let te=C+a(S,p,c),Z=N*j*te-w,ne=M*j*te-T,re=_*te-E;if(e<l){let e=A+l,t=e*O;D[t]=Z,D[t+1]=ne,D[t+2]=re,be(Z,ne,re,f),m.setValues(e,Math.round(s*n),Math.round(d*n))}let ie=J-Z,Q=Y-ne,ae=X-re,oe=N*o,se=M*o,ce=i;ce*ce<.999&&(oe=q*Q-K*ae,se=G*ae-q*ie,ce=K*ie-G*Q);let le=1/Math.sqrt(oe*oe+se*se+ce*ce);v(h,A,oe*le,se*le,ce*le,g),++A}}}function w(t,r,i){let a=r[0],o=r[2],s=r[1],c=r[3],l=1/t,{dx:u,dy:d,x0:f,y1:p,safeWidth:m}=i,h=i.data.width;for(let r=0;r<=t;r++){let t=r*l,i=e(u*(a*(1-t)+o*t-f),0,m),g=Math.floor(i);ue[r]=g,pe[r]=i-g;let _=e(d*(p-(s*(1-t)+c*t)),0,m),v=Math.floor(_);de[r]=v*h,fe[r]=(v+1)*h,me[r]=_-v,le[r]=Math.round(t*n)}}function T(e,t,n){let r=ue[e],i=pe[e],a=de[t],o=fe[t],s=me[t],c=a+r,l=n[c],u=n[c+1],d=n[o+r],f=n[o+r+1];if(l+d+u+f>=ce)return 0;let p=l+(u-l)*i;return p+(d+(f-d)*i-p)*s}function E(e,t=!1){e.tile.intersectsClippingArea&&(O(e,t?we:e.dirtyEdges,t?Te:e.dirtyCorners),Q(e),e.intersectionData=null)}function D(e){e.tile.intersectsClippingArea&&(Z(e),O(e,we,Te),Q(e),ae(e),e.intersectionData=null)}function O(e,t,n){e.tile.intersectsClippingArea&&(n&&A(e,n),t&&k(e,t))}function k(e,r){let{geometry:i,geometryState:s,tile:c,localOrigin:u}=e,{level:d,extent:g,extentInRadians:y,ellipsoid:b}=c,x=b.radius,S=y[0],C=y[2],w=y[1],T=y[3],{samplerData:E}=s,D=g[0],O=g[2],k=g[1],A=g[3],j=P(e),{boundingBox:M,vertexAttributes:N}=i,F=u[0],I=u[1],L=u[2],{position:R,uv0:z}=N,B=R.typedBuffer,V=R.typedBufferStride,H=z.typedBuffer,U=z.typedBufferStride,{typedBuffer:ee,typedBufferStride:W}=N.normalCompressed,G=E?.length===1?E[0]:null,K=(e,t,n)=>G?o(e,t,G)??0:a(e,t,E)??0;for(let u=0;u<4;++u){if(!(r&1<<u))continue;let y=u===1||u===3,b=s.edgeResolutions[u];f(t(b));let N=b+1,P=l(c,s.edgePeerNeighbors[u]);if(_e(c,P,u)&&ne(e,u,P))continue;let R=P!=null;f(!R||P.level===c.level),f(!R||_(c,P)<=0);let z=P?.renderData?.geometryState;if(p){let e=c.surface;if(!P&&e&&!e.updatingRootTiles){let t=m[u],n=c.findNeighborTile(t,e=>e.loaded||e.leaf||e.level===c.level);n?n.intersectsClippingArea&&(f(!n.loaded),f(!n.leaf),f(n.level===d)):f(e?.rootTiles==null||!c.shouldHaveNeighbor(t))}}let q=u===1?g[2]:g[0],J=P?.extent,Y=J&&y?u===1?J[0]:J[2]:q,X=u===0?g[3]:g[1],te=+(u===1),Z=+(u===0),re=u===1?C:S,ie=u===0?T:w,Q=Math.sin(re),ae=Math.cos(re),oe=Math.sin(ie),se=Math.cos(ie),$=z?.samplerData,ce=$?.length===1?$[0]:null,le=(e,t,n)=>ce?o(n,t,ce)??0:a(n,t,$)??0,ue=R?(e,t,n)=>(K(e,t)+le(e,t,n))*.5:K,de=i.outerEdgesOffsetAndLength[u*2+0],fe=G!=null||E!=null&&E.some(e=>e!=null),pe=ce!=null||$!=null&&$.some(e=>e!=null),me=fe||pe,he=1/b,ge=n*he,ve=te*n,ye=Z*n,xe=de;f(!J||h(J[2]-J[0],g[2]-g[0])),(()=>{let e=u===1?-1:+(u===3),t=u===0?-1:+(u===2),n=(g[2]-g[0])*he,r=e*n,i=t*n,s=C-S,c=y?s*he*e:0,l=y?0:t*he,d=Z,f=y?re+c:re,p=y?Math.sin(f):Q,m=y?Math.cos(f):ae,h=y?re-c:re,_=y?Math.sin(h):Q,b=y?Math.cos(h):ae,w=d+l,T=y?ie:j(w),P=y?oe:Math.sin(T),z=y?se:Math.cos(T),K=d-l,J=y?ie:j(K),te=y?oe:Math.sin(J),ne=y?se:Math.cos(J),le=0,de=0,fe=0;{let e=0*he,t=y?q:D*(1-e)+O*e,n=y?Y:t,r=y?k*(1-e)+A*e:X,i=y?re:S*(1-e)+C*e,a=y?Q:Math.sin(i),o=y?ae:Math.cos(i),s=y?j(e):ie,c=y?Math.sin(s):oe,l=y?Math.cos(s):se,u=x+ue(t,r,n);le=o*l*u,de=a*l*u,fe=c*u}let pe=0,_e=0,Se=0;{let e=1*he,t=y?q:D*(1-e)+O*e,n=y?Y:t,r=y?k*(1-e)+A*e:X,i=y?re:S*(1-e)+C*e,a=y?Q:Math.sin(i),o=y?ae:Math.cos(i),s=y?j(e):ie,c=y?Math.sin(s):oe,l=y?Math.cos(s):se,u=x+ue(t,r,n);pe=o*l*u,_e=a*l*u,Se=c*u}for(let e=1;e<N-1;++e){let t=0,n=0,s=0;{let r=(e+1)*he,i=y?q:D*(1-r)+O*r,a=y?Y:i,o=y?k*(1-r)+A*r:X,c=y?re:S*(1-r)+C*r,l=y?Q:Math.sin(c),u=y?ae:Math.cos(c),d=y?j(r):ie,f=y?Math.sin(d):oe,p=y?Math.cos(d):se,m=x+ue(i,o,a);t=u*p*m,n=l*p*m,s=f*m}let c=t,l=n,d=s,f=pe,h=_e,g=Se;pe=c,_e=l,Se=d;{let t=xe+e,n=t*V,r=f-F,i=h-I,a=g-L;B[n]=r,B[n+1]=i,B[n+2]=a,be(r,i,a,M);let o=Math.round(e*ge),s=t*U;H[s]=y?ve:o,H[s+1]=y?o:ye}let w=le,T=de,N=fe;le=f,de=h,fe=g;let K=f,J=h,Z=g,Ce=1/Math.sqrt(K*K+J*J+Z*Z),we=Z*Ce,Te=0,Ee=0,De=0;if(me&&we*we<.999){let t=0,n=0,s=0;{let e=u===0?-1:1;t=e*(c-w),n=e*(l-T),s=e*(d-N)}{let c=e*he,l=y?q:D*(1-c)+O*c,d=y?Y:l,f=y?k*(1-c)+A*c:X,h=y?re:S*(1-c)+C*c,g=y?Q:Math.sin(h),v=y?ae:Math.cos(h),w=y?j(c):ie,T=y?Math.sin(w):oe,M=y?Math.cos(w):se,N=K,F=J,I=Z;if(R){let e=d-r,t=f-i,n=x+(ce?o(e,t,ce)??0:a(e,t,$)??0),s=y?_:g,c=y?b:v,l=y?T:te,u=y?M:ne;N=c*u*n,F=s*u*n,I=l*n}{let e=l+r,c=f+i,d=x+(G?o(e,c,G)??0:a(e,c,E)??0),h=y?p:g,_=y?m:v,b=y?T:P,S=y?M:z,C=_*S*d,w=h*S*d,D=b*d;R||(N=2*K-C,F=2*J-w,I=2*Z-D);let O=u===3?-1:1,k=O*(N-C),A=O*(F-w),j=O*(I-D);Te=s*A-n*j,Ee=t*j-s*k,De=n*k-t*A;let L=1/Math.sqrt(Te*Te+Ee*Ee+De*De);Te*=L,Ee*=L,De*=L}}}else Te=K*Ce,Ee=J*Ce,De=Z*Ce;v(ee,xe+e,Te,Ee,De,W)}})()}}function A(e,t){re(e,t)}function j(e,t){return Math.PI/2-2*Math.atan(Math.exp(-e/t))}function M(e,t,n,r){return j(e*(1-r)+t*r,n)}function N(e,t,n){return e*(1-n)+t*n}function P(e){let{tile:t}=e;if(t.surface.isWebMercator){let e=t.extent,n=t.ellipsoid.radius;return t=>M(e[1],e[3],n,t)}let n=t.extentInRadians;return e=>N(n[1],n[3],e)}function F(e){let{tile:t,geometryState:n,geometry:i}=e,{extent:a,surface:o}=t,{wireframe:s}=n,c=a[0],l=a[1],u=a[2],d=a[3],f=u-c,p=d-l,{numVerticesPerSide:m,clippingArea:h}=n,g=h==null?0:Math.max(0,(h[0]-c)/f),_=h==null?0:Math.max(0,(h[1]-l)/p),v=h==null?1:Math.min(1,(h[2]-c)/f),y=h==null?1:Math.min(1,(h[3]-l)/p),b=(m-2)**2,x=xe(n),S=b+4*x,C=o.renderer.tileGeometryCache.acquire(S),{boundingBox:w}=i;r(w),i.numVerticesPerSide=m,i.vertexAttributes=C,i.maxEdgeVertexCount=x,i.minu=g,i.minv=_,i.maxu=v,i.maxv=y,I(e),i.edgeVerticesStartIndex=b,te(e),z(e,we,Te),W(i,[],s),e.intersectionData=null}function I(t){let r=t.tile;if(!r.intersectsClippingArea)return;let{geometry:i,geometryState:s,localOrigin:c}=t,{samplerData:l,clippingArea:u,numVerticesPerSide:d}=s,{surface:f,extent:p,ellipsoid:m}=r,{isWebMercatorOnPlateCarree:h}=f,g=u??he,_=p[0],y=p[1],b=p[2],x=p[3],S=Math.max(_,g[0]),C=Math.min(b,g[2]),w=Math.max(y,g[1]),T=Math.min(x,g[3]),E=m.radius,D=r.horizontalScale,O=d-1,k=d-2,{minu:A,minv:j,maxu:M,maxv:N,boundingBox:P,vertexAttributes:F}=i,{position:I,uv0:L}=F,{typedBuffer:R,typedBufferStride:z}=F.normalCompressed,B=c[0],V=c[1],H=c[2],U=I.typedBuffer,ee=I.typedBufferStride,W=0,G=e(y,w,T),K=h?(Math.PI/2-2*Math.atan(Math.exp(-G/E)))*E:G*D,q=1/O,J=e(y*(1-q)+x*q,w,T),Y=h?(Math.PI/2-2*Math.atan(Math.exp(-J/E)))*E:J*D,X=K,te=Y,Z=l?.length===1?l[0]:null,ne=Z?(e,t)=>o(e,t,Z)??0:(e,t)=>a(e,t,l)??0;for(let t=1;t<=k;t++){let r=t/O,i=e(y*(1-r)+x*r,w,T),a=e(r,j,N),o=te,s=(t-1)/O,c=e(y*(1-s)+x*s,w,T),l=X,u=(t+1)/O,d=e(y*(1-u)+x*u,w,T),f=h?(Math.PI/2-2*Math.atan(Math.exp(-d/E)))*E:d*D,p=e(u,j,N);X=te,te=f;let m=e(_,S,C),g=m*D,F=ne(m,i),I=1/O,G=e(I,A,M),K=e(_*(1-G)+b*G,S,C),q=G,J=K,Y=K*D,Z=ne(K,i);if(t===1){let t=Y-B,r=X-V,i=Z-H,o=0*ee;U[o]=t,U[o+1]=r,U[o+2]=i,be(t,r,i,P);let s=e(I,A,M);L.setValues(W,Math.round(s*n),Math.round(a*n))}for(let r=1;r<=k;r++){let s=Y,u=Z,m=(r+1)/O,h=e(m,A,M),y=e(_*(1-m)+b*m,S,C),x=J;J=y;{let e=W+1,s=e*ee;if(t===1||r===k){let c=ne(y,i),l=y*D,u=o,d=c;if(t===1&&r<k){let t=l-B,r=u-V,i=d-H;U[s]=t,U[s+1]=r,U[s+2]=i,be(t,r,i,P),L.setValues(e,Math.round(h*n),Math.round(a*n))}Y=l,Z=d}else Y=U[s]+B,Z=U[s+2]+H}let w=Y,T=Z,E=g,j=F;g=s,F=u;let N=(W-k)*ee,I=t===1?ne(x,c):U[N+2]+H,G=ne(x,d);if(t<k){let e=W+k,t=e*ee,r=s-B,i=f-V,a=G-H;U[t]=r,U[t+1]=i,U[t+2]=a,be(r,i,a,P);let o=q;q=h,L.setValues(e,Math.round(o*n),Math.round(p*n))}{let e=w-E,t=T-j,n=l-f,r=I-G,i=n*t,a=e*r,o=-n*e,s=i*i+a*a+o*o;if(s===0)v(R,W,0,0,1,z);else{let e=1/Math.sqrt(s);v(R,W,i*e,a*e,o*e,z)}}++W}}}function L(e){e.tile.intersectsClippingArea&&(Z(e),z(e,we,Te),Q(e),ae(e),e.intersectionData=null)}function R(e,t=!1){e.tile.intersectsClippingArea&&(z(e,t?we:e.dirtyEdges,t?Te:e.dirtyCorners),Q(e),e.intersectionData=null)}function z(e,t,n){e.tile.intersectsClippingArea&&(n&&V(e,n),t&&B(e,t))}function B(n,r){let{geometry:i,geometryState:s,localOrigin:c}=n,u=n.tile,{surface:d,extent:h}=u,{clippingArea:g,samplerData:v}=s,y=g??he,b=h[0],x=h[2],S=h[1],C=h[3],w=[C>y[3],x>y[2],S<y[1],b<y[0]],T=u.horizontalScale,E=ee(d.isWebMercatorOnPlateCarree,u.ellipsoid.radius,T),{minu:D,minv:O,maxu:k,maxv:A,boundingBox:j}=i,M=Math.max(b,y[0]),N=Math.min(x,y[2]),P=Math.max(S,y[1]),F=Math.min(C,y[3]),I=c[0],L=c[1],R=c[2],z=v?.length===1?v[0]:void 0,B=z?(e,t)=>o(e,t,z)??0:(e,t)=>a(e,t,v)??0;for(let c=0;c<4;++c){if(!(r&1<<c))continue;let h=c===1||c===3,g=s.edgeResolutions[c];f(t(g));let y=g+1,z=w[c],V=l(u,s.edgePeerNeighbors[c]);if(!z&&_e(u,V,c)&&ne(n,c,V))continue;let H=V!=null&&!z,U=V?.renderData?.geometryState;if(p&&(f(!H||V.level===u.level),f(!H||_(u,V)<=0),u&&!V&&!d.updatingRootTiles)){let e=m[c],t=u.findNeighborTile(e,e=>e.loaded||e.leaf||e.level===u.level);d.updatingRootTiles||(t?t.intersectsClippingArea&&(f(!t.loaded),f(!t.leaf),f(t.level===u.level)):f(d?.rootTiles==null||!u.shouldHaveNeighbor(e)))}let ee=e(c===1?x:b,M,N),W=e(c===0?C:S,P,F),G=U?.samplerData,K=e(+(c===1),D,k),q=e(+(c===0),O,A),J=G?.length===1?G[0]:null,Y=(e,t)=>J?o(e,t,J)??0:a(e,t,G)??0,X=H?(e,t)=>(Y(e,t)+B(e,t))*.5:B,te=(x-b)/g,Z=h?c===1?te:-te:0,re=h?0:c===0?te:-te,ie=-Z,Q=-re,ae=0,oe=0,se=0;{let t=0/g,n=h?ee:e(b*(1-t)+x*t,M,N),r=h?e(S*(1-t)+C*t,P,F):W,i=X(n,r);ae=n*T,oe=E(r),se=i}let $=0,ce=0,le=0;{let t=1/g,n=h?ee:e(b*(1-t)+x*t,M,N),r=h?e(S*(1-t)+C*t,P,F):W,i=X(n,r),a=n*T,o=E(r),s=i;$=a,ce=o,le=s}for(let t=1;t<y-1;++t){let n=t/g,r=$,o=ce,s=le;{let a=h?K:e(n,D,k),l=h?e(n,O,A):q,u=r-I,d=o-L,f=s-R;be(r,d,f,j),i.setEdgeVertexFromValuesRawPositionUV(c,t,u,d,f,a,l)}{let n=(t+1)/g,r=h?ee:e(b*(1-n)+x*n,M,N),i=h?e(S*(1-n)+C*n,P,F):W,a=X(r,i);$=r*T,ce=E(i),le=a}let l=$,u=ce,d=le,f=ae,p=oe,m=se;ae=r,oe=o,se=s;let _=0,y=0,w=0;if(h){let t=u-o,i=d-s,l=p-o,f=m-s,h=e(S*(1-n)+C*n,P,F),g=ee+ie,b=h,x=g*T,E=a(g,b,v),D=x-r,O=E-s,k=c===3?-1:1;if(_=k*(-l+t)*O,y=k*D*(-f+i),w=-k*D*(-l+t),H){let e=ee+Z,n=h,o=e*T,c=a(e,n,G),u=o-r,d=c-s;_=(-l+t)*(O-d),y=(D-u)*(-f+i),w=-(D-u)*(-l+t)}}else{let t=l-r,i=d-s,u=f-r,p=m-s,h=e(b*(1-n)+x*n,M,N),g=h,S=W+Q,C=a(g,S,v)-s,T=E(S)-o,D=c===2?-1:1;if(_=D*T*(-p+i),y=D*(-u+t)*C,w=-D*T*(-u+t),H){let e=h,n=W+re,r=E(n),c=a(e,n,G)-s,l=r-o;_=(-T+l)*(-p+i),y=(-u+t)*(-C+c),w=-(-T+l)*(-u+t)}}let z=1/Math.sqrt(_*_+y*y+w*w);i.setEdgeNormalFromValues(c,t,_*z,y*z,w*z)}}}function V(e,t){re(e,t)}function H(e,t){return(Math.PI/2-2*Math.atan(Math.exp(-e/t)))*t}function U(e,t){return e*t}function ee(e,t,n){return e?e=>H(e,t):e=>U(e,n)}function W(e,t,n){let{numVerticesPerSide:r,vertexAttributes:i,maxEdgeVertexCount:a}=e,o=r-1,s=i.count,l=r-3,u=r-3,d=2*l*u,f=4*(o+a-3),p=c.reduce((t,n)=>t+(o+e.getEdgeCount(n)-3),0),m=t.reduce((e,t)=>e+o*((t.latitudeResolution-1)*2+1),0),h=3*(n?2:1),g=(d+f+m)*h;e.indices=s>=65536?new Uint32Array(g):new Uint16Array(g),e.indexCount=(d+p+m)*h,e.poleIndicesStartIndex=d*h,e.edgeIndicesStartIndex=(d+m)*h,n?(J(e),Y(e,t),X(e)):(G(e),K(e,t),q(e))}function G(e){let{numVerticesPerSide:t,indices:n,vertexAttributes:r}=e,{position:i}=r,{typedBuffer:a,typedBufferStride:o}=i,s=t-2,c=t-3,l=t-3,u=0;for(let e=0;e<c;++e){let t=e*s;for(let e=0;e<l;++e){let r=t+e,i=r+1,c=i+s,l=c-1;Se(r,i,c,l,o,a)?(n[u]=r,n[u+1]=i,n[u+2]=c,n[u+3]=c,n[u+4]=l,n[u+5]=r):(n[u]=r,n[u+1]=i,n[u+2]=l,n[u+3]=l,n[u+4]=i,n[u+5]=c),u+=6}}}function K(e,t){let{numVerticesPerSide:n,indices:r,poleIndicesStartIndex:i}=e,a=n-1,o=i;for(let i of t){let t=i.isNorth?1:2,s=i.isNorth?2:1,c=i.isNorth?3:4,l=i.isNorth?4:3,u=e.getEdgeVertexIndex(i.connectedOuterEdgeOffset,0),d=1;for(let e=0;e<i.latitudeResolution;++e){let f=e===0?i.rowOffset:u+n;for(let n=0;n<a;n++){let a=f+n;r[o]=u,r[o+t]=u+1,r[o+s]=a,e<i.latitudeResolution-1?(r[o+c]=u+1,r[o+l]=a+1,r[o+5]=a,o+=6):o+=3,u+=d}u=f,d=1}}}function q(e){let{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:r}=e,i=n-1,a=i-2,o=r;for(let n=0;n<4;++n){let r=ye[n],s=0,c=0,l=e.getEdgeCount(n),u=r.count;f(u===i-1);let d=n===1||n===2,p=d?1:2,m=d?2:1,h=e.getEdgeFirstVertexIndex(n),g=r.vertex0Index,_=r.stride;for(;s<l-1||c<u-1;){let e=g+c*_,n=h+s*1,r=s<l-1,d=c<u-1,f=r?0+i*(s+.5)/(l-1):0,v=d?1+a*(c+.5)/(u-1):0,y=r&&(!d||f<=v);y?++s:++c;let b=y?n+1:e+_;t[o]=e,t[o+p]=n,t[o+m]=b,o+=3}}e.indexCount=o}function J(e){let{indices:t,numVerticesPerSide:n,vertexAttributes:r}=e,{position:i}=r,{typedBuffer:a,typedBufferStride:o}=i,s=n-2,c=0;for(let e=0;e<n-3;++e){let r=e*s;for(let i=0;i<n-3;++i){let n=e*s+i,l=n+1,u=l+s,d=u-1,f=r+i,p=f+1,m=p+s;Se(f,p,m,m-1,o,a)?(Ce(t,c,n,l,u),c+=6,Ce(t,c,u,d,n)):(Ce(t,c,n,l,d),c+=6,Ce(t,c,d,u,l)),c+=6}}}function Y(e,t){let{indices:n,numVerticesPerSide:r,poleIndicesStartIndex:i}=e,a=r-1,o=i;for(let i of t){let t=i.connectedOuterEdgeOffset,s=e.getEdgeVertexIndex(t,0),c=1;for(let e=0;e<i.latitudeResolution;++e){let t=e===0?i.rowOffset:s+r;for(let r=0;r<a;r++)Ce(n,o,s,s+1,t+r),o+=6,e<i.latitudeResolution-1&&(Ce(n,o,s+1,t+r+1,t+r),o+=6),s+=c;s=t,c=1}}}function X(e){let{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:r}=e,i=n-1,a=i-2,o=r;for(let n=0;n<4;++n){let r=ye[n],s=0,c=0,l=e.getEdgeCount(n),u=r.count;f(u===i-1);let d=n===1||n===2,p=d?1:3,m=d?3:1,h=e.getEdgeFirstVertexIndex(n),g=r.vertex0Index,_=r.stride;for(;s<l-1||c<u-1;){let e=g+c*_,n=h+s*1,r=s<l-1,d=c<u-1,f=r?0+i*(s+.5)/(l-1):0,v=d?1+a*(c+.5)/(u-1):0,y=r&&(!d||f<=v);y?++s:++c;let b=y?n+1:e+_;t[o]=e,t[o+p]=n,t[o+p+1]=n,t[o+m]=b,t[o+m+1]=b,t[o+5]=e,o+=6}}e.indexCount=o}function te(e){let{geometry:t,geometryState:n}=e,{edgeResolutions:r}=n,{numVerticesPerSide:i,edgeVerticesStartIndex:a}=t,o=i-2,s=a;for(let e=0;e<4;++e){{let t=e===1?o-1:0,n=e===0?o-1:0,r=e===0||e===2,i=+!!r,a=+!r,s=n*o+t,c=a*o+i,l=ye[e];l.vertex0Index=s,l.stride=c,l.count=o}{let n=r[e]+1;t.outerEdgesOffsetAndLength[e*2+0]=s,t.outerEdgesOffsetAndLength[e*2+1]=n,s+=n}}}function Z(e){te(e),e.geometryState.wireframe?X(e.geometry):q(e.geometry)}function ne(r,i,a){let{geometryState:o,geometry:s,tile:c,localOrigin:l}=r,u=i===1||i===3,d=o.edgeResolutions[i];f(t(d));let p=d+1,{boundingBox:m,minu:h,minv:g,maxu:_,maxv:v,vertexAttributes:y}=s,b=e(+(i===1),h,_),x=e(+(i===0),g,v),S=a.renderData,C=S.geometryState;if(!C||!S.geometry.vertexAttributes)return!1;let w=S.geometry,T=(i+2)%4,E=w.getEdgeCount(T),D=c.getNeighborEdgeStartVertexIndex(i,a)*d,O=d*2**(c.level-a.level);f(C.edgeResolutions[T]===O),f(E-1===O);let k=S.localOrigin[0]-l[0],A=S.localOrigin[1]-l[1],j=S.localOrigin[2]-l[2],M=s.getEdgeFirstVertexIndex(i),{position:N,uv0:P}=y,F=N.typedBuffer,I=N.typedBufferStride,L=y.normalCompressed,R=L.typedBuffer,z=L.typedBufferStride,B=w.vertexAttributes,V=w.getEdgeFirstVertexIndex(T),H=B.position.typedBuffer,U=B.position.typedBufferStride,ee=B.normalCompressed.typedBuffer,W=B.normalCompressed.typedBufferStride;for(let t=1;t<p-1;++t){let r=D+t,i=M+t,a=V+r,o=i*I,s=a*U,c=H[s]+k,l=H[s+1]+A,f=H[s+2]+j;F[o]=c,F[o+1]=l,F[o+2]=f,be(c,l,f,m);let p=i*z,y=a*W;R[p]=ee[y],R[p+1]=ee[y+1];let S=t/d,C=u?b:e(S,h,_),w=u?e(S,g,v):x;P.setValues(i,Math.round(C*n),Math.round(w*n))}return!0}function re(t,r){let{geometry:i,geometryState:o,localOrigin:s}=t,{clippingArea:c,samplerData:l}=o,{minu:u,minv:d,maxu:p,maxv:m,boundingBox:h,vertexAttributes:g}=i,v=t.tile,{surface:y,ellipsoid:b,extent:x,extentInRadians:S,horizontalScale:C}=v,w=y.view?.viewingMode===`local`,T=b.radius,E=0,D=0,O=0,k=w?(()=>{let t=c,n=t!=null&&(x[3]>t[3]||x[2]>t[2]||x[1]<t[1]||x[0]<t[0]),r=ee(y.isWebMercatorOnPlateCarree,T,C);return(i,a,o)=>{let s=i===0?x[0]:x[2],c=a===0?x[1]:x[3],l=n?e(s,t[0],t[2]):s,u=n?e(c,t[1],t[3]):c,d=o;E=l*C,D=r(u),O=d}})():(e,t,n)=>{let r=S[t===0?1:3],i=S[e===0?0:2],a=Math.cos(r),o=Math.sin(r),s=Math.sin(i),c=Math.cos(i),l=T+n;E=c*a*l,D=s*a*l,O=o*l},A=0,j=0,M=0,N=0,F=0,I=0,L=0,R=0,z=0,B=w&&y.isWebMercatorOnPlateCarree,V=(e,t,n,r,i)=>{let a=0,o=0,s=0;if(w){let e=t*C,i=B?(Math.PI/2-2*Math.atan(Math.exp(-n/T)))*T:n*C,c=r;a=e-E,o=i-D,s=c-O}else{let i=P(e),c=e.tile,l=c.extent,u=c.extentInRadians,d=(t-l[0])/(l[2]-l[0]),f=(n-l[1])/(l[3]-l[1]),p=u[0]*(1-d)+u[2]*d,m=i(f),h=Math.cos(m),g=Math.sin(m),_=Math.sin(p),v=Math.cos(p),y=T+r,b=v*h*y,x=_*h*y,S=g*y;a=b-E,o=x-D,s=S-O}switch(i){case 0:L+=a,R+=o,z+=s;break;case 1:N-=a,F-=o,I-=s;break;case 2:L-=a,R-=o,z-=s;break;case 3:N+=a,F+=o,I+=s}},H=c??he,U=x[0],W=x[2],G=x[1],K=x[3],q=[K>H[3],W>H[2],G<H[1],U<H[0]],J=Math.max(U,H[0]),Y=Math.min(W,H[2]),X=Math.max(G,H[1]),te=Math.min(K,H[3]),Z=e=>Math.max(H[0],Math.min(H[2],e)),ne=e=>Math.max(H[1],Math.min(H[3],e)),re=e=>{let t=o.cornerNeighborCornerTiles;A=0,j=0,M=1,N=0,F=0,I=0,L=0,R=0,z=0;let n=1/0;for(let r=0;r<4;++r){let i=t[e*4+r];n=Math.min(n,i?.level??1/0)}for(let r=0;r<4;++r){let i=t[e*4+r];ge[r]=i?.level===n?i:null}let r=1,i=0;for(let e=0;e<4;++e){let t=ge[e];t&&(r=Math.max(r,t?.renderData.geometryState.numVerticesPerSide),i=t.extent[2]-t.extent[0])}let s=i,c=r;f(c>1);let l=s/c;for(let e=0;e<4;++e){let t=ge[(e+3)%4],n=ge[e%4];if(!t&&!n)continue;let r=e===0?1:e===1?2:e===2?3:0,i=e===0?2:e===1?3:e===2?0:1;if(t&&n){let o=se[e][0]*l,s=se[e][1]*l,c=t.extent,u=Z(c[r===0||r===1?2:0]+o),d=ne(c[r===0||r===3?3:1]+s),f=n.extent,p=Z(f[i===0||i===1?2:0]+o),m=ne(f[i===0||i===3?3:1]+s),h=t.renderData,g=n.renderData,_=a(u,d,h.geometryState.samplerData),v=a(p,m,g.geometryState.samplerData);V(h,u,d,.5*(_+v),e)}else{let o=t??n,s=t?r:i,c=o.extent,u=se[e],d=Z(c[s===0||s===1?2:0]+u[0]*l),f=ne(c[s===0||s===3?3:1]+u[1]*l),p=o.renderData,m=a(d,f,p.geometryState.samplerData);V(p,d,f,m,e)}}if(!w){let e=Math.sqrt(E*E+D*D+O*O);A=E/e,j=D/e,M=O/e}if(w||M*M<.999){let e=Math.sqrt(N*N+F*F+I*I);N/=e,F/=e,I/=e;let t=Math.sqrt(L*L+R*R+z*z);L/=t,R/=t,z/=t,A=I*R-F*z,j=N*z-I*L,M=F*L-N*R;let n=1/Math.sqrt(A*A+j*j+M*M);A*=n,j*=n,M*=n}},Q=o.cornerNeighborCornerTiles;for(let t=0;t<4;++t){if(!(r&1<<t))continue;let c=t,y=(t+1)%4,b=+(t===0||t===1),x=+(t===0||t===3),S=e(b,u,p),C=e(x,d,m),w=i.getEdgeFirstVertexIndex(c),T=i.getEdgeCount(c),N=t===0||t===3?T-1:0,P=i.getEdgeFirstVertexIndex(y),F=i.getEdgeCount(y),I=t===0||t===1?F-1:0,L=-1;for(let e=0;e<4;++e){let n=Q[t*4+e],r=Q[t*4+L];n&&(L===-1||_(r,n)>0)&&(L=e)}let R=L,z=Q[t*4+R];if(z!==v){let e=v.level-z.level,r=2**e,i=[z.lij[0]+e,z.lij[1]*r,z.lij[2]*r],a=[i[1]+r===v.lij[1],t===0&&(R===1||R===0&&z!==Q[t*4+3])||t===1&&(R===0||R===1&&z!==Q[t*4+2]),i[1]===v.lij[1]+1,t===2&&(R===3||R===2&&z!==Q[t*4+1])||t===3&&(R===2||R===3&&z!==Q[t*4+0])],c=a.reduce((e,t)=>e+ +!!t,0);f(c===1||c===2);let l=-1,u=-1,d=z.renderData;if(c===1){let e=a.findIndex(e=>e);f(0<=e&&e<=3),l=(e+2)%4;let n=o.edgeResolutions[e];u=v.getNeighborEdgeStartVertexIndex(e,z)*n+n*+(e===0&&t===0||e===1&&t===0||e===2&&t===1||e===3&&t===3)}else{f(a[1]||a[3]),l=a[1]?3:1;let e=d.geometryState.edgeResolutions[l];u=t===0||t===3?0:e}let p=d.geometry;{let e=w+N,t=P+I,r=p.getEdgeFirstVertexIndex(l)+u,i=p.vertexAttributes,a=d.localOrigin,o=i.position,c=o.typedBuffer,f=r*o.typedBufferStride,m=c[f]+a[0]-s[0],_=c[f+1]+a[1]-s[1],v=c[f+2]+a[2]-s[2];be(m,_,v,h);let y=g.position,b=y.typedBuffer,x=e*y.typedBufferStride;b[x]=m,b[x+1]=_,b[x+2]=v;let T=t*y.typedBufferStride;b[T]=m,b[T+1]=_,b[T+2]=v;let E=g.uv0;E.setValues(e,Math.round(S*n),Math.round(C*n)),E.setValues(t,Math.round(S*n),Math.round(C*n));{let n=i.normalCompressed.typedBuffer,a=r*i.normalCompressed.typedBufferStride,o=g.normalCompressed,s=o.typedBuffer;{let t=e*o.typedBufferStride;s[t]=n[a],s[t+1]=n[a+1]}{let e=t*o.typedBufferStride;s[e]=n[a],s[e+1]=n[a+1]}}}}else{let n=q[c],r=q[y],o;if(n||r){let t=e(U*(1-b)+W*b,J,Y),n=e(G*(1-x)+K*x,X,te);o=a(t,n,l)}else o=ie(Q,t);k(b,x,o),re(t);let u=E-s[0],d=D-s[1],f=O-s[2];be(u,d,f,h),i.setEdgeVertexFromValuesRawPositionUVNormal(c,N,u,d,f,S,C,A,j,M),i.setEdgeVertexFromValuesRawPositionUVNormal(y,I,u,d,f,S,C,A,j,M)}}for(let e=0;e<4;++e)ge[e]=null}function ie(e,t){let n=t*4,r=c.reduce((t,r)=>Math.min(t,e[n+r]?.level??1/0),1/0);p&&(f(!e[n+0]||!e[n+2]||g(e[n+0],e[n+2],5)),f(!e[n+1]||!e[n+3]||g(e[n+1],e[n+3],7)));let i=0,o=0;for(let t=0;t<4;++t){let s=e[n+t];if(s?.level===r){let e=t===0||t===1,n=t===0||t===3,r=s.extent,c=r[e?0:2],l=r[n?1:3],u=s.renderData?.geometryState?.samplerData,d=a(c,l,u);o+=d,i++}}let s=i?o/i:0;return f(s!=null),s}function Q(e){let{vao:t,geometry:n}=e,{vertexAttributes:r,edgeVerticesStartIndex:i}=n,{position:a}=r,o=a.typedBuffer,s=i*a.typedBufferStride,c=(n.getEdgeFirstVertexIndex(3)+n.getEdgeCount(3))*a.typedBufferStride;t.buffer()?.setSubData(o,s,s,c)}function ae(e){let{vao:t,geometry:n}=e,{indices:r,indexCount:i,edgeIndicesStartIndex:a}=n;t.indexBuffer.setSubData(r,a,a,i)}class oe{constructor(e,t,n,r,i){this.isNorth=e,this.connectedRowOffset=t,this.connectedOuterEdgeOffset=n,this.rowOffset=r,this.latitudeResolution=i}}const se=[[0,1],[1,0],[0,-1],[-1,0]],$=new s,ce=.5*d,le=new Uint16Array(u+1),ue=new Int32Array(u+1),de=new Int32Array(u+1),fe=new Int32Array(u+1),pe=new Float64Array(u+1),me=new Float64Array(u+1),he=i(-1/0,-1/0,1/0,1/0),ge=[null,null,null,null];function _e(e,t,n){if(!t)return!1;let r=_(e,t);return r>0||r===0&&n>=2}class ve{constructor(){this.vertex0Index=0,this.stride=1,this.count=0}getVertexIndex(e){return f(0<=e&&e<this.count),this.vertex0Index+this.stride*e}}const ye=[new ve,new ve,new ve,new ve];function be(e,t,n,r){e<r[0]?r[0]=e:e>r[3]&&(r[3]=e),t<r[1]?r[1]=t:t>r[4]&&(r[4]=t),n<r[2]?r[2]=n:n>r[5]&&(r[5]=n)}function xe(e){let{edgeResolutions:t,numVerticesPerSide:n}=e,r=1+Math.max(...t);return Math.max(n,r)}function Se(e,t,n,r,i,a){let o=e*i,s=a[o],c=a[o+1],l=a[o+2],u=t*i,d=a[u],f=a[u+1],p=a[u+2],m=n*i,h=a[m],g=a[m+1],_=a[m+2],v=r*i,y=a[v],b=a[v+1],x=a[v+2],S=(s-h)*(s-h)+(c-g)*(c-g)+(l-_)*(l-_);return(d-y)*(d-y)+(f-b)*(f-b)+(p-x)*(p-x)>S}function Ce(e,t,n,r,i){e[t]=n,e[t+1]=r,e[t+2]=r,e[t+3]=i,e[t+4]=i,e[t+5]=n}const we=15,Te=15,Ee=6;export{F as createPlanarGlobePatch,y as createSphericalGlobePatch,L as updateEdgeElevationsAndResolutionsPlanar,D as updateEdgeElevationsAndResolutionsSpherical,R as updateEdgesAndCornersPlanar,E as updateEdgesAndCornersSpherical};
|
|
2
|
+
import{clamp as e,isPowerOfTwo as t}from"../../../core/mathUtils.js";import{maxUint16 as n}from"../../../core/typedArrayUtil.js";import{empty as r}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as i}from"../../../geometry/support/aaBoundingRect.js";import{sampleElevation as a,sampleSingleElevation as o}from"./ElevationData.js";import{PatchGeometryLUT as s}from"./PatchGeometryLUT.js";import{zeroToFour as c,neighborTileIfLoadedOrSelf as l}from"./PatchRenderData.js";import{maxPatchTesselation as u,elevationNoDataValue as d}from"./TerrainConst.js";import{internalAssert as f,enableTerrainInternalChecks as p,neighborEdgeIndices as m,almostEquals as h}from"./terrainUtils.js";import{isCornerNeighbor as g}from"./Tile.js";import{compareTilesByLij as _}from"./tileUtils.js";import{compressNormal as v}from"../webgl-engine/lib/Normals.js";function y(e,t){let{tile:n,geometry:i,geometryState:a}=e,{extentInRadians:o,surface:s}=n,{isWebMercator:c,renderer:l}=s,{numVerticesPerSide:u,wireframe:d}=a,f=u-1,p=(u-2)**2,m=c&&(t===2||t===3),h=c&&(t===1||t===3),g=(+!!m+ +!!h)*De*u,_=Se(a),v=4*_,y=p+g+v,S=l.tileGeometryCache.acquire(y);i.numVerticesPerSide=u,i.vertexAttributes=S,i.maxEdgeVertexCount=_;let{boundingBox:C}=i;r(C);let w=P(e);$.update(f,o,w),x(e),i.poleVerticesStartIndex=p;let T=b(e,m,h);i.edgeVerticesStartIndex=p+g,te(e),O(e,Te,Ee),W(i,T,d),e.intersectionData=null}function b(e,t,r){let{tile:i,localOrigin:a,geometry:o}=e,{extent:s,ellipsoid:c}=i,{boundingBox:l,numVerticesPerSide:u,vertexAttributes:d,poleVerticesStartIndex:f}=o,p=u-1,m=a[0],h=a[1],g=a[2],_=c.radius,y=s[1],b=s[3],x=[],S=f,C=(e,t)=>{let r=t*u;xe(-m,-h,-g+e*_,l),x.push(new oe(e===1,r,e===1?0:2,S,De));let i=j(e===-1?y:b,_),a=e*Math.PI/2-i,o=(e===1?1:-1)*.99,s=_+0,{position:c,uv0:f}=d,{typedBuffer:C,typedBufferStride:w}=d.normalCompressed;for(let e=1;e<=De;++e){let t=i+e/De*a,r=Math.cos(t),u=Math.sin(t);for(let e=0;e<=p;e++){let t=e/p,i=$.sinLonLUT[e],a=$.cosLonLUT[e]*r,d=i*r,_=u,y=a*s-m,b=d*s-h,x=_*s-g;xe(y,b,x,l),c.setValues(S,y,b,x),f.setValues(S,Math.round(t*n),Math.round(o*n)),v(C,S,a,d,_,w),++S}}};return t&&C(-1,0),r&&C(1,p),x}function x(e){let t=e.geometryState.samplerData,n=t?.length===1?t[0]:null;n?S(e,n):C(e)}function S(e,t){let{tile:n}=e;if(!n.intersectsClippingArea)return;let{geometry:r,geometryState:i,localOrigin:a}=e,{numVerticesPerSide:o}=i,s=o-2,c=o-1,{vertexAttributes:l,boundingBox:u}=r,{position:d,uv0:f}=l,{typedBuffer:p,typedBufferStride:m}=l.normalCompressed,{extent:h}=n,g=n.ellipsoid.radius,_=a[0],y=a[1],b=a[2],x=d.typedBuffer,S=d.typedBufferStride,C=f.typedBuffer,E=f.typedBufferStride;w(c,h,t);let D=0,O=t.data.values;if(1<=s){let e=le[1],t=$.sinLatLUT[1],n=$.cosLatLUT[1];for(let r=1;r<=s;r++){let i=$.sinLonLUT[r],a=$.cosLonLUT[r],o=g+T(r,1,O),s=-_+o*a*n,c=-y+o*i*n,l=-b+o*t;xe(s,c,l,u);let d=(r-1)*S;x[d]=s,x[d+1]=c,x[d+2]=l;let f=(r-1)*E;C[f]=le[r],C[f+1]=e}}for(let e=1;e<=s;e++){let t=$.sinLatLUT[e],n=$.cosLatLUT[e],r=e+1,i=le[r],a=$.sinLatLUT[r],o=$.cosLatLUT[r],l=$.sinLonLUT[0],d=$.cosLonLUT[0],f=g+T(0,e,O),h=d*n*f-_,w=l*n*f-y,k=t*f-b,A=D*S,j=x[A],M=x[A+1],N=x[A+2];for(let l=1;l<=s;l++){let d=$.sinLonLUT[l],f=$.cosLonLUT[l],A=0,P=0,F=0;if(l<s){let e=(D+1)*S;A=x[e],P=x[e+1],F=x[e+2]}else{let r=$.sinLonLUT[c],i=$.cosLonLUT[c],a=g+T(c,e,O);A=i*n*a-_,P=r*n*a-y,F=t*a-b}let I=h,L=w,R=k;h=j,w=M,k=N,j=A,M=P,N=F;let z=A-I,B=P-L,V=F-R,H=0,U=0,ee=0;if(e>1){let e=(D-s)*S;H=x[e],U=x[e+1],ee=x[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=g+T(l,0,O);H=f*t*n-_,U=d*t*n-y,ee=e*n-b}let W=g+T(l,r,O),G=f*o*W-_,K=d*o*W-y,q=a*W-b;if(e<s){let e=D+s,t=e*S;x[t]=G,x[t+1]=K,x[t+2]=q,xe(G,K,q,u);let n=e*E;C[n]=le[l],C[n+1]=i}let J=H-G,Y=U-K,X=ee-q,te=f*n,Z=d*n,ne=t;ne*ne<.999&&(te=V*Y-B*X,Z=z*X-V*J,ne=B*J-z*Y),v(p,D,te,Z,ne,m),++D}}}function C(e){let{tile:t}=e;if(!t.intersectsClippingArea)return;let{geometry:r,geometryState:i,localOrigin:o}=e,{numVerticesPerSide:s,samplerData:c}=i,l=s-2,u=s-1,{vertexAttributes:d,boundingBox:f}=r,{position:p,uv0:m}=d,{typedBuffer:h,typedBufferStride:g}=d.normalCompressed,{extent:_}=t,y=_[0],b=_[2],x=_[1],S=_[3],C=t.ellipsoid.radius,w=o[0],T=o[1],E=o[2],D=p.typedBuffer,O=p.typedBufferStride,k=1/u,A=0;if(1<=l){let e=k,t=x*(1-e)+S*e,r=$.sinLatLUT[1],i=$.cosLatLUT[1];for(let o=1;o<=l;o++){let s=o*k,l=y*(1-s)+b*s,u=$.sinLonLUT[o],d=$.cosLonLUT[o],p=C+a(l,t,c),h=-w+p*d*i,g=-T+p*u*i,_=-E+p*r;xe(h,g,_,f);let v=(o-1)*O;D[v]=h,D[v+1]=g,D[v+2]=_,m.setValues(o-1,Math.round(s*n),Math.round(e*n))}}for(let e=1;e<=l;e++){let t=e*k,r=x*(1-t)+S*t,i=$.sinLatLUT[e],o=$.cosLatLUT[e],s=e+1,d=s*k,p=x*(1-d)+S*d,_=$.sinLatLUT[s],j=$.cosLatLUT[s],M=$.sinLonLUT[0],N=$.cosLonLUT[0],P=C+a(y,r,c),F=N*o*P-w,I=M*o*P-T,L=i*P-E,R=A*O,z=D[R],B=D[R+1],V=D[R+2];for(let t=1;t<=l;t++){let s=t*k,S=y*(1-s)+b*s,M=$.sinLonLUT[t],N=$.cosLonLUT[t],P=0,R=0,H=0;if(t<l){let e=(A+1)*O;P=D[e],R=D[e+1],H=D[e+2]}else{let e=$.sinLonLUT[u],t=$.cosLonLUT[u],n=C+a(b,r,c);P=t*o*n-w,R=e*o*n-T,H=i*n-E}let U=F,ee=I,W=L;F=z,I=B,L=V,z=P,B=R,V=H;let G=P-U,K=R-ee,q=H-W,J=0,Y=0,X=0;if(e>1){let e=(A-l)*O;J=D[e],Y=D[e+1],X=D[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=C+a(S,x,c);J=N*t*n-w,Y=M*t*n-T,X=e*n-E}let te=C+a(S,p,c),Z=N*j*te-w,ne=M*j*te-T,re=_*te-E;if(e<l){let e=A+l,t=e*O;D[t]=Z,D[t+1]=ne,D[t+2]=re,xe(Z,ne,re,f),m.setValues(e,Math.round(s*n),Math.round(d*n))}let ie=J-Z,Q=Y-ne,ae=X-re,oe=N*o,se=M*o,ce=i;ce*ce<.999&&(oe=q*Q-K*ae,se=G*ae-q*ie,ce=K*ie-G*Q);let le=1/Math.sqrt(oe*oe+se*se+ce*ce);v(h,A,oe*le,se*le,ce*le,g),++A}}}function w(t,r,i){let a=r[0],o=r[2],s=r[1],c=r[3],l=1/t,{dx:u,dy:d,x0:f,y1:p,safeWidth:m}=i,h=i.data.width;for(let r=0;r<=t;r++){let t=r*l,i=e(u*(a*(1-t)+o*t-f),0,m),g=Math.floor(i);ue[r]=g,pe[r]=i-g;let _=e(d*(p-(s*(1-t)+c*t)),0,m),v=Math.floor(_);de[r]=v*h,fe[r]=(v+1)*h,me[r]=_-v,le[r]=Math.round(t*n)}}function T(e,t,n){let r=ue[e],i=pe[e],a=de[t],o=fe[t],s=me[t],c=a+r,l=n[c],u=n[c+1],d=n[o+r],f=n[o+r+1];if(l+d+u+f>=ce)return 0;let p=l+(u-l)*i;return p+(d+(f-d)*i-p)*s}function E(e,t=!1){e.tile.intersectsClippingArea&&(O(e,t?Te:e.dirtyEdges,t?Ee:e.dirtyCorners),Q(e),e.intersectionData=null)}function D(e){e.tile.intersectsClippingArea&&(Z(e),O(e,Te,Ee),Q(e),ae(e),e.intersectionData=null)}function O(e,t,n){e.tile.intersectsClippingArea&&(n&&A(e,n),t&&k(e,t),(n||t)&&be(e.geometry.boundingBox))}function k(e,r){let{geometry:i,geometryState:s,tile:c,localOrigin:u}=e,{level:d,extent:g,extentInRadians:y,ellipsoid:b}=c,x=b.radius,S=y[0],C=y[2],w=y[1],T=y[3],{samplerData:E}=s,D=g[0],O=g[2],k=g[1],A=g[3],j=P(e),{boundingBox:M,vertexAttributes:N}=i,F=u[0],I=u[1],L=u[2],{position:R,uv0:z}=N,B=R.typedBuffer,V=R.typedBufferStride,H=z.typedBuffer,U=z.typedBufferStride,{typedBuffer:ee,typedBufferStride:W}=N.normalCompressed,G=E?.length===1?E[0]:null,K=(e,t,n)=>G?o(e,t,G)??0:a(e,t,E)??0;for(let u=0;u<4;++u){if(!(r&1<<u))continue;let y=u===1||u===3,b=s.edgeResolutions[u];f(t(b));let N=b+1,P=l(c,s.edgePeerNeighbors[u]);if(_e(c,P,u)&&ne(e,u,P))continue;let R=P!=null;f(!R||P.level===c.level),f(!R||_(c,P)<=0);let z=P?.renderData?.geometryState;if(p){let e=c.surface;if(!P&&e&&!e.updatingRootTiles){let t=m[u],n=c.findNeighborTile(t,e=>e.loaded||e.leaf||e.level===c.level);n?n.intersectsClippingArea&&(f(!n.loaded),f(!n.leaf),f(n.level===d)):f(e?.rootTiles==null||!c.shouldHaveNeighbor(t))}}let q=u===1?g[2]:g[0],J=P?.extent,Y=J&&y?u===1?J[0]:J[2]:q,X=u===0?g[3]:g[1],te=+(u===1),Z=+(u===0),re=u===1?C:S,ie=u===0?T:w,Q=Math.sin(re),ae=Math.cos(re),oe=Math.sin(ie),se=Math.cos(ie),$=z?.samplerData,ce=$?.length===1?$[0]:null,le=(e,t,n)=>ce?o(n,t,ce)??0:a(n,t,$)??0,ue=R?(e,t,n)=>(K(e,t)+le(e,t,n))*.5:K,de=i.outerEdgesOffsetAndLength[u*2+0],fe=G!=null||E!=null&&E.some(e=>e!=null),pe=ce!=null||$!=null&&$.some(e=>e!=null),me=fe||pe,he=1/b,ge=n*he,ve=te*n,ye=Z*n,be=de;f(!J||h(J[2]-J[0],g[2]-g[0])),(()=>{let e=u===1?-1:+(u===3),t=u===0?-1:+(u===2),n=(g[2]-g[0])*he,r=e*n,i=t*n,s=C-S,c=y?s*he*e:0,l=y?0:t*he,d=Z,f=y?re+c:re,p=y?Math.sin(f):Q,m=y?Math.cos(f):ae,h=y?re-c:re,_=y?Math.sin(h):Q,b=y?Math.cos(h):ae,w=d+l,T=y?ie:j(w),P=y?oe:Math.sin(T),z=y?se:Math.cos(T),K=d-l,J=y?ie:j(K),te=y?oe:Math.sin(J),ne=y?se:Math.cos(J),le=0,de=0,fe=0;{let e=0*he,t=y?q:D*(1-e)+O*e,n=y?Y:t,r=y?k*(1-e)+A*e:X,i=y?re:S*(1-e)+C*e,a=y?Q:Math.sin(i),o=y?ae:Math.cos(i),s=y?j(e):ie,c=y?Math.sin(s):oe,l=y?Math.cos(s):se,u=x+ue(t,r,n);le=o*l*u,de=a*l*u,fe=c*u}let pe=0,_e=0,Se=0;{let e=1*he,t=y?q:D*(1-e)+O*e,n=y?Y:t,r=y?k*(1-e)+A*e:X,i=y?re:S*(1-e)+C*e,a=y?Q:Math.sin(i),o=y?ae:Math.cos(i),s=y?j(e):ie,c=y?Math.sin(s):oe,l=y?Math.cos(s):se,u=x+ue(t,r,n);pe=o*l*u,_e=a*l*u,Se=c*u}for(let e=1;e<N-1;++e){let t=0,n=0,s=0;{let r=(e+1)*he,i=y?q:D*(1-r)+O*r,a=y?Y:i,o=y?k*(1-r)+A*r:X,c=y?re:S*(1-r)+C*r,l=y?Q:Math.sin(c),u=y?ae:Math.cos(c),d=y?j(r):ie,f=y?Math.sin(d):oe,p=y?Math.cos(d):se,m=x+ue(i,o,a);t=u*p*m,n=l*p*m,s=f*m}let c=t,l=n,d=s,f=pe,h=_e,g=Se;pe=c,_e=l,Se=d;{let t=be+e,n=t*V,r=f-F,i=h-I,a=g-L;B[n]=r,B[n+1]=i,B[n+2]=a,xe(r,i,a,M);let o=Math.round(e*ge),s=t*U;H[s]=y?ve:o,H[s+1]=y?o:ye}let w=le,T=de,N=fe;le=f,de=h,fe=g;let K=f,J=h,Z=g,Ce=1/Math.sqrt(K*K+J*J+Z*Z),we=Z*Ce,Te=0,Ee=0,De=0;if(me&&we*we<.999){let t=0,n=0,s=0;{let e=u===0?-1:1;t=e*(c-w),n=e*(l-T),s=e*(d-N)}{let c=e*he,l=y?q:D*(1-c)+O*c,d=y?Y:l,f=y?k*(1-c)+A*c:X,h=y?re:S*(1-c)+C*c,g=y?Q:Math.sin(h),v=y?ae:Math.cos(h),w=y?j(c):ie,T=y?Math.sin(w):oe,M=y?Math.cos(w):se,N=K,F=J,I=Z;if(R){let e=d-r,t=f-i,n=x+(ce?o(e,t,ce)??0:a(e,t,$)??0),s=y?_:g,c=y?b:v,l=y?T:te,u=y?M:ne;N=c*u*n,F=s*u*n,I=l*n}{let e=l+r,c=f+i,d=x+(G?o(e,c,G)??0:a(e,c,E)??0),h=y?p:g,_=y?m:v,b=y?T:P,S=y?M:z,C=_*S*d,w=h*S*d,D=b*d;R||(N=2*K-C,F=2*J-w,I=2*Z-D);let O=u===3?-1:1,k=O*(N-C),A=O*(F-w),j=O*(I-D);Te=s*A-n*j,Ee=t*j-s*k,De=n*k-t*A;let L=1/Math.sqrt(Te*Te+Ee*Ee+De*De);Te*=L,Ee*=L,De*=L}}}else Te=K*Ce,Ee=J*Ce,De=Z*Ce;v(ee,be+e,Te,Ee,De,W)}})()}}function A(e,t){re(e,t)}function j(e,t){return Math.PI/2-2*Math.atan(Math.exp(-e/t))}function M(e,t,n,r){return j(e*(1-r)+t*r,n)}function N(e,t,n){return e*(1-n)+t*n}function P(e){let{tile:t}=e;if(t.surface.isWebMercator){let e=t.extent,n=t.ellipsoid.radius;return t=>M(e[1],e[3],n,t)}let n=t.extentInRadians;return e=>N(n[1],n[3],e)}function F(e){let{tile:t,geometryState:n,geometry:i}=e,{extent:a,surface:o}=t,{wireframe:s}=n,c=a[0],l=a[1],u=a[2],d=a[3],f=u-c,p=d-l,{numVerticesPerSide:m,clippingArea:h}=n,g=h==null?0:Math.max(0,(h[0]-c)/f),_=h==null?0:Math.max(0,(h[1]-l)/p),v=h==null?1:Math.min(1,(h[2]-c)/f),y=h==null?1:Math.min(1,(h[3]-l)/p),b=(m-2)**2,x=Se(n),S=b+4*x,C=o.renderer.tileGeometryCache.acquire(S),{boundingBox:w}=i;r(w),i.numVerticesPerSide=m,i.vertexAttributes=C,i.maxEdgeVertexCount=x,i.minu=g,i.minv=_,i.maxu=v,i.maxv=y,I(e),i.edgeVerticesStartIndex=b,te(e),z(e,Te,Ee),W(i,[],s),e.intersectionData=null}function I(t){let r=t.tile;if(!r.intersectsClippingArea)return;let{geometry:i,geometryState:s,localOrigin:c}=t,{samplerData:l,clippingArea:u,numVerticesPerSide:d}=s,{surface:f,extent:p,ellipsoid:m}=r,{isWebMercatorOnPlateCarree:h}=f,g=u??he,_=p[0],y=p[1],b=p[2],x=p[3],S=Math.max(_,g[0]),C=Math.min(b,g[2]),w=Math.max(y,g[1]),T=Math.min(x,g[3]),E=m.radius,D=r.horizontalScale,O=d-1,k=d-2,{minu:A,minv:j,maxu:M,maxv:N,boundingBox:P,vertexAttributes:F}=i,{position:I,uv0:L}=F,{typedBuffer:R,typedBufferStride:z}=F.normalCompressed,B=c[0],V=c[1],H=c[2],U=I.typedBuffer,ee=I.typedBufferStride,W=0,G=e(y,w,T),K=h?(Math.PI/2-2*Math.atan(Math.exp(-G/E)))*E:G*D,q=1/O,J=e(y*(1-q)+x*q,w,T),Y=h?(Math.PI/2-2*Math.atan(Math.exp(-J/E)))*E:J*D,X=K,te=Y,Z=l?.length===1?l[0]:null,ne=Z?(e,t)=>o(e,t,Z)??0:(e,t)=>a(e,t,l)??0;for(let t=1;t<=k;t++){let r=t/O,i=e(y*(1-r)+x*r,w,T),a=e(r,j,N),o=te,s=(t-1)/O,c=e(y*(1-s)+x*s,w,T),l=X,u=(t+1)/O,d=e(y*(1-u)+x*u,w,T),f=h?(Math.PI/2-2*Math.atan(Math.exp(-d/E)))*E:d*D,p=e(u,j,N);X=te,te=f;let m=e(_,S,C),g=m*D,F=ne(m,i),I=1/O,G=e(I,A,M),K=e(_*(1-G)+b*G,S,C),q=G,J=K,Y=K*D,Z=ne(K,i);if(t===1){let t=Y-B,r=X-V,i=Z-H,o=0*ee;U[o]=t,U[o+1]=r,U[o+2]=i,xe(t,r,i,P);let s=e(I,A,M);L.setValues(W,Math.round(s*n),Math.round(a*n))}for(let r=1;r<=k;r++){let s=Y,u=Z,m=(r+1)/O,h=e(m,A,M),y=e(_*(1-m)+b*m,S,C),x=J;J=y;{let e=W+1,s=e*ee;if(t===1||r===k){let c=ne(y,i),l=y*D,u=o,d=c;if(t===1&&r<k){let t=l-B,r=u-V,i=d-H;U[s]=t,U[s+1]=r,U[s+2]=i,xe(t,r,i,P),L.setValues(e,Math.round(h*n),Math.round(a*n))}Y=l,Z=d}else Y=U[s]+B,Z=U[s+2]+H}let w=Y,T=Z,E=g,j=F;g=s,F=u;let N=(W-k)*ee,I=t===1?ne(x,c):U[N+2]+H,G=ne(x,d);if(t<k){let e=W+k,t=e*ee,r=s-B,i=f-V,a=G-H;U[t]=r,U[t+1]=i,U[t+2]=a,xe(r,i,a,P);let o=q;q=h,L.setValues(e,Math.round(o*n),Math.round(p*n))}{let e=w-E,t=T-j,n=l-f,r=I-G,i=n*t,a=e*r,o=-n*e,s=i*i+a*a+o*o;if(s===0)v(R,W,0,0,1,z);else{let e=1/Math.sqrt(s);v(R,W,i*e,a*e,o*e,z)}}++W}}}function L(e){e.tile.intersectsClippingArea&&(Z(e),z(e,Te,Ee),Q(e),ae(e),e.intersectionData=null)}function R(e,t=!1){e.tile.intersectsClippingArea&&(z(e,t?Te:e.dirtyEdges,t?Ee:e.dirtyCorners),Q(e),e.intersectionData=null)}function z(e,t,n){e.tile.intersectsClippingArea&&(n&&V(e,n),t&&B(e,t),(n||t)&&be(e.geometry.boundingBox))}function B(n,r){let{geometry:i,geometryState:s,localOrigin:c}=n,u=n.tile,{surface:d,extent:h}=u,{clippingArea:g,samplerData:v}=s,y=g??he,b=h[0],x=h[2],S=h[1],C=h[3],w=[C>y[3],x>y[2],S<y[1],b<y[0]],T=u.horizontalScale,E=ee(d.isWebMercatorOnPlateCarree,u.ellipsoid.radius,T),{minu:D,minv:O,maxu:k,maxv:A,boundingBox:j}=i,M=Math.max(b,y[0]),N=Math.min(x,y[2]),P=Math.max(S,y[1]),F=Math.min(C,y[3]),I=c[0],L=c[1],R=c[2],z=v?.length===1?v[0]:void 0,B=z?(e,t)=>o(e,t,z)??0:(e,t)=>a(e,t,v)??0;for(let c=0;c<4;++c){if(!(r&1<<c))continue;let h=c===1||c===3,g=s.edgeResolutions[c];f(t(g));let y=g+1,z=w[c],V=l(u,s.edgePeerNeighbors[c]);if(!z&&_e(u,V,c)&&ne(n,c,V))continue;let H=V!=null&&!z,U=V?.renderData?.geometryState;if(p&&(f(!H||V.level===u.level),f(!H||_(u,V)<=0),u&&!V&&!d.updatingRootTiles)){let e=m[c],t=u.findNeighborTile(e,e=>e.loaded||e.leaf||e.level===u.level);d.updatingRootTiles||(t?t.intersectsClippingArea&&(f(!t.loaded),f(!t.leaf),f(t.level===u.level)):f(d?.rootTiles==null||!u.shouldHaveNeighbor(e)))}let ee=e(c===1?x:b,M,N),W=e(c===0?C:S,P,F),G=U?.samplerData,K=e(+(c===1),D,k),q=e(+(c===0),O,A),J=G?.length===1?G[0]:null,Y=(e,t)=>J?o(e,t,J)??0:a(e,t,G)??0,X=H?(e,t)=>(Y(e,t)+B(e,t))*.5:B,te=(x-b)/g,Z=h?c===1?te:-te:0,re=h?0:c===0?te:-te,ie=-Z,Q=-re,ae=0,oe=0,se=0;{let t=0/g,n=h?ee:e(b*(1-t)+x*t,M,N),r=h?e(S*(1-t)+C*t,P,F):W,i=X(n,r);ae=n*T,oe=E(r),se=i}let $=0,ce=0,le=0;{let t=1/g,n=h?ee:e(b*(1-t)+x*t,M,N),r=h?e(S*(1-t)+C*t,P,F):W,i=X(n,r),a=n*T,o=E(r),s=i;$=a,ce=o,le=s}for(let t=1;t<y-1;++t){let n=t/g,r=$,o=ce,s=le;{let a=h?K:e(n,D,k),l=h?e(n,O,A):q,u=r-I,d=o-L,f=s-R;xe(u,d,f,j),i.setEdgeVertexFromValuesRawPositionUV(c,t,u,d,f,a,l)}{let n=(t+1)/g,r=h?ee:e(b*(1-n)+x*n,M,N),i=h?e(S*(1-n)+C*n,P,F):W,a=X(r,i);$=r*T,ce=E(i),le=a}let l=$,u=ce,d=le,f=ae,p=oe,m=se;ae=r,oe=o,se=s;let _=0,y=0,w=0;if(h){let t=u-o,i=d-s,l=p-o,f=m-s,h=e(S*(1-n)+C*n,P,F),g=ee+ie,b=h,x=g*T,E=a(g,b,v),D=x-r,O=E-s,k=c===3?-1:1;if(_=k*(-l+t)*O,y=k*D*(-f+i),w=-k*D*(-l+t),H){let e=ee+Z,n=h,o=e*T,c=a(e,n,G),u=o-r,d=c-s;_=(-l+t)*(O-d),y=(D-u)*(-f+i),w=-(D-u)*(-l+t)}}else{let t=l-r,i=d-s,u=f-r,p=m-s,h=e(b*(1-n)+x*n,M,N),g=h,S=W+Q,C=a(g,S,v)-s,T=E(S)-o,D=c===2?-1:1;if(_=D*T*(-p+i),y=D*(-u+t)*C,w=-D*T*(-u+t),H){let e=h,n=W+re,r=E(n),c=a(e,n,G)-s,l=r-o;_=(-T+l)*(-p+i),y=(-u+t)*(-C+c),w=-(-T+l)*(-u+t)}}let z=1/Math.sqrt(_*_+y*y+w*w);i.setEdgeNormalFromValues(c,t,_*z,y*z,w*z)}}}function V(e,t){re(e,t)}function H(e,t){return(Math.PI/2-2*Math.atan(Math.exp(-e/t)))*t}function U(e,t){return e*t}function ee(e,t,n){return e?e=>H(e,t):e=>U(e,n)}function W(e,t,n){let{numVerticesPerSide:r,vertexAttributes:i,maxEdgeVertexCount:a}=e,o=r-1,s=i.count,l=r-3,u=r-3,d=2*l*u,f=4*(o+a-3),p=c.reduce((t,n)=>t+(o+e.getEdgeCount(n)-3),0),m=t.reduce((e,t)=>e+o*((t.latitudeResolution-1)*2+1),0),h=3*(n?2:1),g=(d+f+m)*h;e.indices=s>=65536?new Uint32Array(g):new Uint16Array(g),e.indexCount=(d+p+m)*h,e.poleIndicesStartIndex=d*h,e.edgeIndicesStartIndex=(d+m)*h,n?(J(e),Y(e,t),X(e)):(G(e),K(e,t),q(e))}function G(e){let{numVerticesPerSide:t,indices:n,vertexAttributes:r}=e,{position:i}=r,{typedBuffer:a,typedBufferStride:o}=i,s=t-2,c=t-3,l=t-3,u=0;for(let e=0;e<c;++e){let t=e*s;for(let e=0;e<l;++e){let r=t+e,i=r+1,c=i+s,l=c-1;Ce(r,i,c,l,o,a)?(n[u]=r,n[u+1]=i,n[u+2]=c,n[u+3]=c,n[u+4]=l,n[u+5]=r):(n[u]=r,n[u+1]=i,n[u+2]=l,n[u+3]=l,n[u+4]=i,n[u+5]=c),u+=6}}}function K(e,t){let{numVerticesPerSide:n,indices:r,poleIndicesStartIndex:i}=e,a=n-1,o=i;for(let i of t){let t=i.isNorth?1:2,s=i.isNorth?2:1,c=i.isNorth?3:4,l=i.isNorth?4:3,u=e.getEdgeVertexIndex(i.connectedOuterEdgeOffset,0),d=1;for(let e=0;e<i.latitudeResolution;++e){let f=e===0?i.rowOffset:u+n;for(let n=0;n<a;n++){let a=f+n;r[o]=u,r[o+t]=u+1,r[o+s]=a,e<i.latitudeResolution-1?(r[o+c]=u+1,r[o+l]=a+1,r[o+5]=a,o+=6):o+=3,u+=d}u=f,d=1}}}function q(e){let{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:r}=e,i=n-1,a=i-2,o=r;for(let n=0;n<4;++n){let r=ye[n],s=0,c=0,l=e.getEdgeCount(n),u=r.count;f(u===i-1);let d=n===1||n===2,p=d?1:2,m=d?2:1,h=e.getEdgeFirstVertexIndex(n),g=r.vertex0Index,_=r.stride;for(;s<l-1||c<u-1;){let e=g+c*_,n=h+s*1,r=s<l-1,d=c<u-1,f=r?0+i*(s+.5)/(l-1):0,v=d?1+a*(c+.5)/(u-1):0,y=r&&(!d||f<=v);y?++s:++c;let b=y?n+1:e+_;t[o]=e,t[o+p]=n,t[o+m]=b,o+=3}}e.indexCount=o}function J(e){let{indices:t,numVerticesPerSide:n,vertexAttributes:r}=e,{position:i}=r,{typedBuffer:a,typedBufferStride:o}=i,s=n-2,c=0;for(let e=0;e<n-3;++e){let r=e*s;for(let i=0;i<n-3;++i){let n=e*s+i,l=n+1,u=l+s,d=u-1,f=r+i,p=f+1,m=p+s;Ce(f,p,m,m-1,o,a)?(we(t,c,n,l,u),c+=6,we(t,c,u,d,n)):(we(t,c,n,l,d),c+=6,we(t,c,d,u,l)),c+=6}}}function Y(e,t){let{indices:n,numVerticesPerSide:r,poleIndicesStartIndex:i}=e,a=r-1,o=i;for(let i of t){let t=i.connectedOuterEdgeOffset,s=e.getEdgeVertexIndex(t,0),c=1;for(let e=0;e<i.latitudeResolution;++e){let t=e===0?i.rowOffset:s+r;for(let r=0;r<a;r++)we(n,o,s,s+1,t+r),o+=6,e<i.latitudeResolution-1&&(we(n,o,s+1,t+r+1,t+r),o+=6),s+=c;s=t,c=1}}}function X(e){let{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:r}=e,i=n-1,a=i-2,o=r;for(let n=0;n<4;++n){let r=ye[n],s=0,c=0,l=e.getEdgeCount(n),u=r.count;f(u===i-1);let d=n===1||n===2,p=d?1:3,m=d?3:1,h=e.getEdgeFirstVertexIndex(n),g=r.vertex0Index,_=r.stride;for(;s<l-1||c<u-1;){let e=g+c*_,n=h+s*1,r=s<l-1,d=c<u-1,f=r?0+i*(s+.5)/(l-1):0,v=d?1+a*(c+.5)/(u-1):0,y=r&&(!d||f<=v);y?++s:++c;let b=y?n+1:e+_;t[o]=e,t[o+p]=n,t[o+p+1]=n,t[o+m]=b,t[o+m+1]=b,t[o+5]=e,o+=6}}e.indexCount=o}function te(e){let{geometry:t,geometryState:n}=e,{edgeResolutions:r}=n,{numVerticesPerSide:i,edgeVerticesStartIndex:a}=t,o=i-2,s=a;for(let e=0;e<4;++e){{let t=e===1?o-1:0,n=e===0?o-1:0,r=e===0||e===2,i=+!!r,a=+!r,s=n*o+t,c=a*o+i,l=ye[e];l.vertex0Index=s,l.stride=c,l.count=o}{let n=r[e]+1;t.outerEdgesOffsetAndLength[e*2+0]=s,t.outerEdgesOffsetAndLength[e*2+1]=n,s+=n}}}function Z(e){te(e),e.geometryState.wireframe?X(e.geometry):q(e.geometry)}function ne(r,i,a){let{geometryState:o,geometry:s,tile:c,localOrigin:l}=r,u=i===1||i===3,d=o.edgeResolutions[i];f(t(d));let p=d+1,{boundingBox:m,minu:h,minv:g,maxu:_,maxv:v,vertexAttributes:y}=s,b=e(+(i===1),h,_),x=e(+(i===0),g,v),S=a.renderData,C=S.geometryState;if(!C||!S.geometry.vertexAttributes)return!1;let w=S.geometry,T=(i+2)%4,E=w.getEdgeCount(T),D=c.getNeighborEdgeStartVertexIndex(i,a)*d,O=d*2**(c.level-a.level);f(C.edgeResolutions[T]===O),f(E-1===O);let k=S.localOrigin[0]-l[0],A=S.localOrigin[1]-l[1],j=S.localOrigin[2]-l[2],M=s.getEdgeFirstVertexIndex(i),{position:N,uv0:P}=y,F=N.typedBuffer,I=N.typedBufferStride,L=y.normalCompressed,R=L.typedBuffer,z=L.typedBufferStride,B=w.vertexAttributes,V=w.getEdgeFirstVertexIndex(T),H=B.position.typedBuffer,U=B.position.typedBufferStride,ee=B.normalCompressed.typedBuffer,W=B.normalCompressed.typedBufferStride;for(let t=1;t<p-1;++t){let r=D+t,i=M+t,a=V+r,o=i*I,s=a*U,c=H[s]+k,l=H[s+1]+A,f=H[s+2]+j;F[o]=c,F[o+1]=l,F[o+2]=f,xe(c,l,f,m);let p=i*z,y=a*W;R[p]=ee[y],R[p+1]=ee[y+1];let S=t/d,C=u?b:e(S,h,_),w=u?e(S,g,v):x;P.setValues(i,Math.round(C*n),Math.round(w*n))}return!0}function re(t,r){let{geometry:i,geometryState:o,localOrigin:s}=t,{clippingArea:c,samplerData:l}=o,{minu:u,minv:d,maxu:p,maxv:m,boundingBox:h,vertexAttributes:g}=i,v=t.tile,{surface:y,ellipsoid:b,extent:x,extentInRadians:S,horizontalScale:C}=v,w=y.view?.viewingMode===`local`,T=b.radius,E=0,D=0,O=0,k=w?(()=>{let t=c,n=t!=null&&(x[3]>t[3]||x[2]>t[2]||x[1]<t[1]||x[0]<t[0]),r=ee(y.isWebMercatorOnPlateCarree,T,C);return(i,a,o)=>{let s=i===0?x[0]:x[2],c=a===0?x[1]:x[3],l=n?e(s,t[0],t[2]):s,u=n?e(c,t[1],t[3]):c,d=o;E=l*C,D=r(u),O=d}})():(e,t,n)=>{let r=S[t===0?1:3],i=S[e===0?0:2],a=Math.cos(r),o=Math.sin(r),s=Math.sin(i),c=Math.cos(i),l=T+n;E=c*a*l,D=s*a*l,O=o*l},A=0,j=0,M=0,N=0,F=0,I=0,L=0,R=0,z=0,B=w&&y.isWebMercatorOnPlateCarree,V=(e,t,n,r,i)=>{let a=0,o=0,s=0;if(w){let e=t*C,i=B?(Math.PI/2-2*Math.atan(Math.exp(-n/T)))*T:n*C,c=r;a=e-E,o=i-D,s=c-O}else{let i=P(e),c=e.tile,l=c.extent,u=c.extentInRadians,d=(t-l[0])/(l[2]-l[0]),f=(n-l[1])/(l[3]-l[1]),p=u[0]*(1-d)+u[2]*d,m=i(f),h=Math.cos(m),g=Math.sin(m),_=Math.sin(p),v=Math.cos(p),y=T+r,b=v*h*y,x=_*h*y,S=g*y;a=b-E,o=x-D,s=S-O}switch(i){case 0:L+=a,R+=o,z+=s;break;case 1:N-=a,F-=o,I-=s;break;case 2:L-=a,R-=o,z-=s;break;case 3:N+=a,F+=o,I+=s}},H=c??he,U=x[0],W=x[2],G=x[1],K=x[3],q=[K>H[3],W>H[2],G<H[1],U<H[0]],J=Math.max(U,H[0]),Y=Math.min(W,H[2]),X=Math.max(G,H[1]),te=Math.min(K,H[3]),Z=e=>Math.max(H[0],Math.min(H[2],e)),ne=e=>Math.max(H[1],Math.min(H[3],e)),re=e=>{let t=o.cornerNeighborCornerTiles;A=0,j=0,M=1,N=0,F=0,I=0,L=0,R=0,z=0;let n=1/0;for(let r=0;r<4;++r){let i=t[e*4+r];n=Math.min(n,i?.level??1/0)}for(let r=0;r<4;++r){let i=t[e*4+r];ge[r]=i?.level===n?i:null}let r=1,i=0;for(let e=0;e<4;++e){let t=ge[e];t&&(r=Math.max(r,t?.renderData.geometryState.numVerticesPerSide),i=t.extent[2]-t.extent[0])}let s=i,c=r;f(c>1);let l=s/c;for(let e=0;e<4;++e){let t=ge[(e+3)%4],n=ge[e%4];if(!t&&!n)continue;let r=e===0?1:e===1?2:e===2?3:0,i=e===0?2:e===1?3:e===2?0:1;if(t&&n){let o=se[e][0]*l,s=se[e][1]*l,c=t.extent,u=Z(c[r===0||r===1?2:0]+o),d=ne(c[r===0||r===3?3:1]+s),f=n.extent,p=Z(f[i===0||i===1?2:0]+o),m=ne(f[i===0||i===3?3:1]+s),h=t.renderData,g=n.renderData,_=a(u,d,h.geometryState.samplerData),v=a(p,m,g.geometryState.samplerData);V(h,u,d,.5*(_+v),e)}else{let o=t??n,s=t?r:i,c=o.extent,u=se[e],d=Z(c[s===0||s===1?2:0]+u[0]*l),f=ne(c[s===0||s===3?3:1]+u[1]*l),p=o.renderData,m=a(d,f,p.geometryState.samplerData);V(p,d,f,m,e)}}if(!w){let e=Math.sqrt(E*E+D*D+O*O);A=E/e,j=D/e,M=O/e}if(w||M*M<.999){let e=Math.sqrt(N*N+F*F+I*I);N/=e,F/=e,I/=e;let t=Math.sqrt(L*L+R*R+z*z);L/=t,R/=t,z/=t,A=I*R-F*z,j=N*z-I*L,M=F*L-N*R;let n=1/Math.sqrt(A*A+j*j+M*M);A*=n,j*=n,M*=n}},Q=o.cornerNeighborCornerTiles;for(let t=0;t<4;++t){if(!(r&1<<t))continue;let c=t,y=(t+1)%4,b=+(t===0||t===1),x=+(t===0||t===3),S=e(b,u,p),C=e(x,d,m),w=i.getEdgeFirstVertexIndex(c),T=i.getEdgeCount(c),N=t===0||t===3?T-1:0,P=i.getEdgeFirstVertexIndex(y),F=i.getEdgeCount(y),I=t===0||t===1?F-1:0,L=-1;for(let e=0;e<4;++e){let n=Q[t*4+e],r=Q[t*4+L];n&&(L===-1||_(r,n)>0)&&(L=e)}let R=L,z=Q[t*4+R];if(z!==v){let e=v.level-z.level,r=2**e,i=[z.lij[0]+e,z.lij[1]*r,z.lij[2]*r],a=[i[1]+r===v.lij[1],t===0&&(R===1||R===0&&z!==Q[t*4+3])||t===1&&(R===0||R===1&&z!==Q[t*4+2]),i[1]===v.lij[1]+1,t===2&&(R===3||R===2&&z!==Q[t*4+1])||t===3&&(R===2||R===3&&z!==Q[t*4+0])],c=a.reduce((e,t)=>e+ +!!t,0);f(c===1||c===2);let l=-1,u=-1,d=z.renderData;if(c===1){let e=a.findIndex(e=>e);f(0<=e&&e<=3),l=(e+2)%4;let n=o.edgeResolutions[e];u=v.getNeighborEdgeStartVertexIndex(e,z)*n+n*+(e===0&&t===0||e===1&&t===0||e===2&&t===1||e===3&&t===3)}else{f(a[1]||a[3]),l=a[1]?3:1;let e=d.geometryState.edgeResolutions[l];u=t===0||t===3?0:e}let p=d.geometry;{let e=w+N,t=P+I,r=p.getEdgeFirstVertexIndex(l)+u,i=p.vertexAttributes,a=d.localOrigin,o=i.position,c=o.typedBuffer,f=r*o.typedBufferStride,m=c[f]+a[0]-s[0],_=c[f+1]+a[1]-s[1],v=c[f+2]+a[2]-s[2];xe(m,_,v,h);let y=g.position,b=y.typedBuffer,x=e*y.typedBufferStride;b[x]=m,b[x+1]=_,b[x+2]=v;let T=t*y.typedBufferStride;b[T]=m,b[T+1]=_,b[T+2]=v;let E=g.uv0;E.setValues(e,Math.round(S*n),Math.round(C*n)),E.setValues(t,Math.round(S*n),Math.round(C*n));{let n=i.normalCompressed.typedBuffer,a=r*i.normalCompressed.typedBufferStride,o=g.normalCompressed,s=o.typedBuffer;{let t=e*o.typedBufferStride;s[t]=n[a],s[t+1]=n[a+1]}{let e=t*o.typedBufferStride;s[e]=n[a],s[e+1]=n[a+1]}}}}else{let n=q[c],r=q[y],o;if(n||r){let t=e(U*(1-b)+W*b,J,Y),n=e(G*(1-x)+K*x,X,te);o=a(t,n,l)}else o=ie(Q,t);k(b,x,o),re(t);let u=E-s[0],d=D-s[1],f=O-s[2];xe(u,d,f,h),i.setEdgeVertexFromValuesRawPositionUVNormal(c,N,u,d,f,S,C,A,j,M),i.setEdgeVertexFromValuesRawPositionUVNormal(y,I,u,d,f,S,C,A,j,M)}}for(let e=0;e<4;++e)ge[e]=null}function ie(e,t){let n=t*4,r=c.reduce((t,r)=>Math.min(t,e[n+r]?.level??1/0),1/0);p&&(f(!e[n+0]||!e[n+2]||g(e[n+0],e[n+2],5)),f(!e[n+1]||!e[n+3]||g(e[n+1],e[n+3],7)));let i=0,o=0;for(let t=0;t<4;++t){let s=e[n+t];if(s?.level===r){let e=t===0||t===1,n=t===0||t===3,r=s.extent,c=r[e?0:2],l=r[n?1:3],u=s.renderData?.geometryState?.samplerData,d=a(c,l,u);o+=d,i++}}let s=i?o/i:0;return f(s!=null),s}function Q(e){let{vao:t,geometry:n}=e,{vertexAttributes:r,edgeVerticesStartIndex:i}=n,{position:a}=r,o=a.typedBuffer,s=i*a.typedBufferStride,c=(n.getEdgeFirstVertexIndex(3)+n.getEdgeCount(3))*a.typedBufferStride;t.buffer()?.setSubData(o,s,s,c)}function ae(e){let{vao:t,geometry:n}=e,{indices:r,indexCount:i,edgeIndicesStartIndex:a}=n;t.indexBuffer.setSubData(r,a,a,i)}class oe{constructor(e,t,n,r,i){this.isNorth=e,this.connectedRowOffset=t,this.connectedOuterEdgeOffset=n,this.rowOffset=r,this.latitudeResolution=i}}const se=[[0,1],[1,0],[0,-1],[-1,0]],$=new s,ce=.5*d,le=new Uint16Array(u+1),ue=new Int32Array(u+1),de=new Int32Array(u+1),fe=new Int32Array(u+1),pe=new Float64Array(u+1),me=new Float64Array(u+1),he=i(-1/0,-1/0,1/0,1/0),ge=[null,null,null,null];function _e(e,t,n){if(!t)return!1;let r=_(e,t);return r>0||r===0&&n>=2}class ve{constructor(){this.vertex0Index=0,this.stride=1,this.count=0}getVertexIndex(e){return f(0<=e&&e<this.count),this.vertex0Index+this.stride*e}}const ye=[new ve,new ve,new ve,new ve];function be(e){for(let t=0;t<3;t++)e[t]=Math.min(e[t],Math.fround(e[t])),e[t+3]=Math.max(e[t+3],Math.fround(e[t+3]))}function xe(e,t,n,r){r[0]=Math.min(r[0],e),r[3]=Math.max(r[3],e),r[1]=Math.min(r[1],t),r[4]=Math.max(r[4],t),r[2]=Math.min(r[2],n),r[5]=Math.max(r[5],n)}function Se(e){let{edgeResolutions:t,numVerticesPerSide:n}=e,r=1+Math.max(...t);return Math.max(n,r)}function Ce(e,t,n,r,i,a){let o=e*i,s=a[o],c=a[o+1],l=a[o+2],u=t*i,d=a[u],f=a[u+1],p=a[u+2],m=n*i,h=a[m],g=a[m+1],_=a[m+2],v=r*i,y=a[v],b=a[v+1],x=a[v+2],S=(s-h)*(s-h)+(c-g)*(c-g)+(l-_)*(l-_);return(d-y)*(d-y)+(f-b)*(f-b)+(p-x)*(p-x)>S}function we(e,t,n,r,i){e[t]=n,e[t+1]=r,e[t+2]=r,e[t+3]=i,e[t+4]=i,e[t+5]=n}const Te=15,Ee=15,De=6;export{F as createPlanarGlobePatch,y as createSphericalGlobePatch,L as updateEdgeElevationsAndResolutionsPlanar,D as updateEdgeElevationsAndResolutionsSpherical,R as updateEdgesAndCornersPlanar,E as updateEdgesAndCornersSpherical};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import"../../../core/has.js";import"../../../core/mathUtils.js";import"../../../geometry/Extent.js";import"../../../geometry/support/Ellipsoid.js";import"../../../core/Collection.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/support/spatialReferenceUtils.js";import"../../../kernel.js";import"../../../request.js";import"../../../core/urlUtils.js";import"../../../core/RandomLCG.js";import"../../../core/Logger.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../layers/Layer.js";import"./TerrainConst.js";import"./TilingScheme.js";function e(e){}export{e as checkPatchGeometryWaterproofness};
|
|
2
|
+
import"../../../core/has.js";import"../../../core/mathUtils.js";import"../../../geometry/Extent.js";import"../../../geometry/support/Ellipsoid.js";import"../../../core/Collection.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/support/spatialReferenceUtils.js";import"../../../kernel.js";import"../../../request.js";import"../../../core/urlUtils.js";import"../../../core/RandomLCG.js";import"../../../core/Logger.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/ObservableBase.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../layers/Layer.js";import"./TerrainConst.js";import"./TilingScheme.js";function e(e){}export{e as checkPatchGeometryWaterproofness};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import"../../../core/has.js";import{lerp as e}from"../../../core/mathUtils.js";import{normalize as t,set as n,add as r,scale as i,len as a,dot as o}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s,ZEROS as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{lonLatToSphericalPCPF as l}from"../../../geometry/projection/lonLatToSphericalPCPF.js";import{intersectsSphere as u,numPlanes as d}from"../../../geometry/support/frustumPlanes.js";import{Sphere as f}from"../../../geometry/support/sphere.js";import{sphereIntersectsInfiniteRadialConeConservative as p}from"../support/ElevationAgnosticVisibility.js";import{correctSphericalTileCornersForLatitude as m,computeSmallestSphericalTileCone as h,getSphericalTilePole as g}from"../support/sphericalTileUtils.js";import{createSphericalGlobePatch as _,updateEdgesAndCornersSpherical as v,updateEdgeElevationsAndResolutionsSpherical as y}from"./PatchGeometryFactory.js";import"../../../core/Collection.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/support/spatialReferenceUtils.js";import"../../../kernel.js";import"../../../request.js";import"../../../core/urlUtils.js";import"../../../core/RandomLCG.js";import"../../../core/Logger.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../layers/Layer.js";import"../../../geometry/Extent.js";import"./TerrainConst.js";import"./TilingScheme.js";import{Tile as b}from"./Tile.js";class x extends b{constructor(e,t,n,r,i){super(),this._convexHull=Array(24),this._boundingConeAxis=s(),this._boundingConeHalfAngleSin=1,this._boundingSphere=new f,this._baseUsedMemory=1816,this.init(e,t,n,r,i)}init(n,r,i,a,o){super.init(n,r,i,a,o);let s=this.ellipsoid.radius,c=this.extentInRadians[0],u=this.extentInRadians[1],d=this.extentInRadians[2],f=this.extentInRadians[3],p=e(u,f,.5),m=e(c,d,.5),h=n===0?0:Math.min(Math.abs(u),Math.abs(f));this._edgeLen=(d-c)*Math.cos(h)*s,this._edgeLen2=this._edgeLen*this._edgeLen,this._curvatureHeight=s-Math.sqrt(s*s-this._edgeLen2/4),l(this.centerAtSeaLevel,m,p,this.ellipsoid.radius),t(this.up,this.centerAtSeaLevel),this.updateRadiusAndCenter()}updateRadiusAndCenter(){this._updateBoundingVolumes();let e=this._center;if(this.lij[0]===0)e[1].center=c,n(e[0],0,0,0),n(e[2],0,0,0),e[1].radius=this.ellipsoid.radius+this.elevationBoundsMax;else{this._updateCenter();let t=e[1],n=this.convexHull,r=0,i=t.center;for(let e=0;e<8;++e)r=Math.max(r,C(i,n,e*3));e[1].radius=Math.sqrt(r)}}_calculateFrustumVisibility(e,t){if(!u(e,this._boundingSphere))return 2;let{level:n}=this;if(n>=2&&t!=null&&this._getPatchType()===0&&!p(this._boundingConeAxis,this._boundingConeHalfAngleSin,t.center,t.radius))return 2;if(n<10)return 1;let r=this.convexHull,i=this.surface.view.state.camera.near,a=!0;for(let t=0;t<d;t++){let n=t===4,o=e[t],s=o[0],c=o[1],l=o[2],u=o[3]-(n?i:0),d=!1;for(let e=0;e<8;++e){let t=e*3;if(s*r[t]+c*r[t+1]+l*r[t+2]+u<0){if(d=!0,!a)break}else a=!1}if(!d)return 2}return+!a}createGeometry(){_(this.renderData,this._getPatchType()),this.setMemoryDirty()}_updateBoundingVolumes(){this._updateConvexHull(),this._updateBoundingSphere()}_updateBoundingSphere(){let e=this._boundingSphere,t=this.elevationBoundsMin,n=this.elevationBoundsMax,o=this.ellipsoid.radius,s=n;if(this.level===0)e.center=c,e.radius=o+s;else{let s=this.extentInRadians,c=.5*(s[0]+s[2]),l=s[1],u=s[3];T(D,c,l,o),T(O,c,u,o),r(e.center,D,O);let d=o+.5*(t+n);i(e.center,e.center,d/a(e.center));let f=this.convexHull,p=0;for(let t=0;t<8;++t)p=Math.max(p,C(e.center,f,t*3));e.radius=Math.sqrt(p)+2}}_updateConvexHull(){let e=this.extentInRadians,n=this.ellipsoid.radius;if(this.level===0)return;let i=this.elevationBoundsMin,a=this.elevationBoundsMax,s=this._getPatchType(),c=this.surface.isWebMercator,l=c&&s===1,u=c&&s===2,d=u||l,f=Math.PI/2,p=e[0],g=e[2],_=u?-f:e[1],v=l?f:e[3],y=.5*(p+g),b=i,x=n+(d?Math.min(0,b-1):b),S=(e,t,n)=>T(e,t,n,x),C=k,w=A,D=j,O=M;S(C,p,_),S(w,p,v),S(D,g,v),S(O,g,_);let I=(e,t)=>{for(let n=0;n<3;++n)this._convexHull[t*3+n]=e[n]},L=a,R=n+(d?Math.max(0,L+1):L),z=N,B=P,V=F;T(B,y,v,x),T(V,y,_,x),r(z,B,V),t(z,z);let H=E;H[0]=C,H[1]=O,H[2]=D,H[3]=w,H[4]=V,H[5]=B,m(H,x),this._boundingConeHalfAngleSin=h(C,O,D,w,this._boundingConeAxis),I(C,0),I(w,1),I(D,2),I(O,3);let U=(e,t)=>{let n=R/o(t,z);for(let r=0;r<3;++r)this._convexHull[e*3+r]=t[r]*n};U(4,C),U(5,w),U(6,D),U(7,O)}_getPatchType(){let e=g(this.lij,this.spatialReference),t=e===1||e===3,n=e===2||e===3;return t?n?3:1:n?2:0}intersectsRay(e,t,n,r){let i=this._boundingSphere,a=i.radius+n,o=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],s=i.center[0]-e[0],c=i.center[1]-e[1],l=i.center[2]-e[2],u=(s*t[0]+c*t[1]+l*t[2])/o,d=t[0]*u,f=t[1]*u,p=t[2]*u,m=d-s,h=f-c,g=p-l;return m*m+h*h+g*g<a*a}get minimumVerticesPerSide(){return this.level<S.length?S[this.level]+1:2}updateEdgeElevations(e=!1){v(this.renderData,e)}updateEdgeElevationsAndResolutions(){y(this.renderData)}_checkBVs(){}get convexHull(){return this._convexHull}}const S=[128,64,64,32,16,8,8,4];function C(e,t,n){return w(e[0],e[1],e[2],t[n],t[n+1],t[n+2])}function w(e,t,n,r,i,a){let o=r-e,s=i-t,c=a-n;return o*o+s*s+c*c}const T=(e,t,n,r)=>{let i=Math.cos(t),a=Math.sin(t),o=Math.cos(n),s=Math.sin(n);e[0]=r*o*i,e[1]=r*o*a,e[2]=r*s},E=[null,null,null,null,null,null],D=s(),O=s(),k=s(),A=s(),j=s(),M=s(),N=s(),P=s(),F=s();export{x as SphericalPatch};
|
|
2
|
+
import"../../../core/has.js";import{lerp as e}from"../../../core/mathUtils.js";import{normalize as t,set as n,add as r,scale as i,len as a,dot as o}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s,ZEROS as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{lonLatToSphericalPCPF as l}from"../../../geometry/projection/lonLatToSphericalPCPF.js";import{intersectsSphere as u,numPlanes as d}from"../../../geometry/support/frustumPlanes.js";import{Sphere as f}from"../../../geometry/support/sphere.js";import{sphereIntersectsInfiniteRadialConeConservative as p}from"../support/ElevationAgnosticVisibility.js";import{correctSphericalTileCornersForLatitude as m,computeSmallestSphericalTileCone as h,getSphericalTilePole as g}from"../support/sphericalTileUtils.js";import{createSphericalGlobePatch as _,updateEdgesAndCornersSpherical as v,updateEdgeElevationsAndResolutionsSpherical as y}from"./PatchGeometryFactory.js";import"../../../core/Collection.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/support/spatialReferenceUtils.js";import"../../../kernel.js";import"../../../request.js";import"../../../core/urlUtils.js";import"../../../core/RandomLCG.js";import"../../../core/Logger.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/ObservableBase.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../layers/Layer.js";import"../../../geometry/Extent.js";import"./TerrainConst.js";import"./TilingScheme.js";import{Tile as b}from"./Tile.js";class x extends b{constructor(e,t,n,r,i){super(),this._convexHull=Array(24),this._boundingConeAxis=s(),this._boundingConeHalfAngleSin=1,this._boundingSphere=new f,this._baseUsedMemory=1816,this.init(e,t,n,r,i)}init(n,r,i,a,o){super.init(n,r,i,a,o);let s=this.ellipsoid.radius,c=this.extentInRadians[0],u=this.extentInRadians[1],d=this.extentInRadians[2],f=this.extentInRadians[3],p=e(u,f,.5),m=e(c,d,.5),h=n===0?0:Math.min(Math.abs(u),Math.abs(f));this._edgeLen=(d-c)*Math.cos(h)*s,this._edgeLen2=this._edgeLen*this._edgeLen,this._curvatureHeight=s-Math.sqrt(s*s-this._edgeLen2/4),l(this.centerAtSeaLevel,m,p,this.ellipsoid.radius),t(this.up,this.centerAtSeaLevel),this.updateRadiusAndCenter()}updateRadiusAndCenter(){this._updateBoundingVolumes();let e=this._center;if(this.lij[0]===0)e[1].center=c,n(e[0],0,0,0),n(e[2],0,0,0),e[1].radius=this.ellipsoid.radius+this.elevationBoundsMax;else{this._updateCenter();let t=e[1],n=this.convexHull,r=0,i=t.center;for(let e=0;e<8;++e)r=Math.max(r,C(i,n,e*3));e[1].radius=Math.sqrt(r)}}_calculateFrustumVisibility(e,t){if(!u(e,this._boundingSphere))return 2;let{level:n}=this;if(n>=2&&t!=null&&this._getPatchType()===0&&!p(this._boundingConeAxis,this._boundingConeHalfAngleSin,t.center,t.radius))return 2;if(n<10)return 1;let r=this.convexHull,i=this.surface.view.state.camera.near,a=!0;for(let t=0;t<d;t++){let n=t===4,o=e[t],s=o[0],c=o[1],l=o[2],u=o[3]-(n?i:0),d=!1;for(let e=0;e<8;++e){let t=e*3;if(s*r[t]+c*r[t+1]+l*r[t+2]+u<0){if(d=!0,!a)break}else a=!1}if(!d)return 2}return+!a}createGeometry(){_(this.renderData,this._getPatchType()),this.setMemoryDirty()}_updateBoundingVolumes(){this._updateConvexHull(),this._updateBoundingSphere()}_updateBoundingSphere(){let e=this._boundingSphere,t=this.elevationBoundsMin,n=this.elevationBoundsMax,o=this.ellipsoid.radius,s=n;if(this.level===0)e.center=c,e.radius=o+s;else{let s=this.extentInRadians,c=.5*(s[0]+s[2]),l=s[1],u=s[3];T(D,c,l,o),T(O,c,u,o),r(e.center,D,O);let d=o+.5*(t+n);i(e.center,e.center,d/a(e.center));let f=this.convexHull,p=0;for(let t=0;t<8;++t)p=Math.max(p,C(e.center,f,t*3));e.radius=Math.sqrt(p)+2}}_updateConvexHull(){let e=this.extentInRadians,n=this.ellipsoid.radius;if(this.level===0)return;let i=this.elevationBoundsMin,a=this.elevationBoundsMax,s=this._getPatchType(),c=this.surface.isWebMercator,l=c&&s===1,u=c&&s===2,d=u||l,f=Math.PI/2,p=e[0],g=e[2],_=u?-f:e[1],v=l?f:e[3],y=.5*(p+g),b=i,x=n+(d?Math.min(0,b-1):b),S=(e,t,n)=>T(e,t,n,x),C=k,w=A,D=j,O=M;S(C,p,_),S(w,p,v),S(D,g,v),S(O,g,_);let I=(e,t)=>{for(let n=0;n<3;++n)this._convexHull[t*3+n]=e[n]},L=a,R=n+(d?Math.max(0,L+1):L),z=N,B=P,V=F;T(B,y,v,x),T(V,y,_,x),r(z,B,V),t(z,z);let H=E;H[0]=C,H[1]=O,H[2]=D,H[3]=w,H[4]=V,H[5]=B,m(H,x),this._boundingConeHalfAngleSin=h(C,O,D,w,this._boundingConeAxis),I(C,0),I(w,1),I(D,2),I(O,3);let U=(e,t)=>{let n=R/o(t,z);for(let r=0;r<3;++r)this._convexHull[e*3+r]=t[r]*n};U(4,C),U(5,w),U(6,D),U(7,O)}_getPatchType(){let e=g(this.lij,this.spatialReference),t=e===1||e===3,n=e===2||e===3;return t?n?3:1:n?2:0}intersectsRay(e,t,n,r){let i=this._boundingSphere,a=i.radius+n,o=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],s=i.center[0]-e[0],c=i.center[1]-e[1],l=i.center[2]-e[2],u=(s*t[0]+c*t[1]+l*t[2])/o,d=t[0]*u,f=t[1]*u,p=t[2]*u,m=d-s,h=f-c,g=p-l;return m*m+h*h+g*g<a*a}get minimumVerticesPerSide(){return this.level<S.length?S[this.level]+1:2}updateEdgeElevations(e=!1){v(this.renderData,e)}updateEdgeElevationsAndResolutions(){y(this.renderData)}_checkBVs(){}get convexHull(){return this._convexHull}}const S=[128,64,64,32,16,8,8,4];function C(e,t,n){return w(e[0],e[1],e[2],t[n],t[n+1],t[n+2])}function w(e,t,n,r,i,a){let o=r-e,s=i-t,c=a-n;return o*o+s*s+c*c}const T=(e,t,n,r)=>{let i=Math.cos(t),a=Math.sin(t),o=Math.cos(n),s=Math.sin(n);e[0]=r*o*i,e[1]=r*o*a,e[2]=r*s},E=[null,null,null,null,null,null],D=s(),O=s(),k=s(),A=s(),j=s(),M=s(),N=s(),P=s(),F=s();export{x as SphericalPatch};
|