@arcgis/core 6.0.0-next.30 → 6.0.0-next.32
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0694c7bcfe71692e2ccf.js +1 -0
- package/assets/esri/core/workers/chunks/{e2c6cd8dac01e129ccfe.js → 0e445ec3523de9f2dfa2.js} +1 -1
- package/assets/esri/core/workers/chunks/0f6c0d42100c21367e5c.js +1 -0
- package/assets/esri/core/workers/chunks/{242a77066ac5cdb5b7d7.js → 14d81280807a3d3c1b7e.js} +1 -1
- package/assets/esri/core/workers/chunks/16cda273927ab0a39544.js +1 -0
- package/assets/esri/core/workers/chunks/1a3f71c4d97c36050030.js +1 -0
- package/assets/esri/core/workers/chunks/{ba4520ddcb6a49988da6.js → 1a8d8274df292d65f82e.js} +1 -1
- package/assets/esri/core/workers/chunks/{0b4481b57a611b15f65c.js → 1eaf8bfdd3765a90ccc2.js} +1 -1
- package/assets/esri/core/workers/chunks/29cc6b1705418b1be5d7.js +1 -0
- package/assets/esri/core/workers/chunks/2de077c7b971f2c215a6.js +1 -0
- package/assets/esri/core/workers/chunks/{fefdd10bdd5a4c8d8ed0.js → 360c944c610efa2051fc.js} +3 -3
- package/assets/esri/core/workers/chunks/{8ca2bb3c0551bb1898b6.js → 3fdcc383bbd9cf0d274c.js} +1 -1
- package/assets/esri/core/workers/chunks/{cc97e4fd0dacad970a23.js → 46453ebfee17b5421d9d.js} +1 -1
- package/assets/esri/core/workers/chunks/{64b360625c68cb863a08.js → 487c46d5245cfb35c4bb.js} +1 -1
- package/assets/esri/core/workers/chunks/{ad21757d78e372fa2ed6.js → 4a979fce1c971b614a18.js} +1 -1
- package/assets/esri/core/workers/chunks/{b5eff28cf482d920b9ea.js → 4d18b48d4a282a0f341c.js} +1 -1
- package/assets/esri/core/workers/chunks/4d8833f48348cbbcc947.js +1 -0
- package/assets/esri/core/workers/chunks/52a0aa2d19a495e48ab1.js +1 -0
- package/assets/esri/core/workers/chunks/{865cebc5c982c040ab6f.js → 55a9eaeb152a3abada67.js} +1 -1
- package/assets/esri/core/workers/chunks/572aec57593a08b8045b.js +1 -0
- package/assets/esri/core/workers/chunks/{9d40786c5ceface786ba.js → 601e1d020b8115497944.js} +1 -1
- package/assets/esri/core/workers/chunks/6029773458ab98600f67.js +1 -0
- package/assets/esri/core/workers/chunks/6b5c073dddd89d06ed80.js +1 -0
- package/assets/esri/core/workers/chunks/{7030a4d0714a35995a58.js → 6bb191b19ce43a27f205.js} +1 -1
- package/assets/esri/core/workers/chunks/6f6d1873753a9c6994aa.js +1 -0
- package/assets/esri/core/workers/chunks/7084dd6e10c6c1393e92.js +1 -0
- package/assets/esri/core/workers/chunks/7cc9d7a88b64e25fce14.js +1 -0
- package/assets/esri/core/workers/chunks/7e211d8a8ad6c6a7cf3e.js +1 -0
- package/assets/esri/core/workers/chunks/853563c66ecf58d53d36.js +1 -0
- package/assets/esri/core/workers/chunks/{c90388932a7825d9d933.js → 85de980c5b296ec69323.js} +1 -1
- package/assets/esri/core/workers/chunks/89dc49e784f7ba3b93ea.js +1 -0
- package/assets/esri/core/workers/chunks/8da2a10318f49d0dc73a.js +1 -0
- package/assets/esri/core/workers/chunks/8e6276ddd8d094c61f08.js +1 -0
- package/assets/esri/core/workers/chunks/{71f792a20077aa739f87.js → a607541959169741a943.js} +1 -1
- package/assets/esri/core/workers/chunks/b2d6b1ac9fbb50c7c8ab.js +1 -0
- package/assets/esri/core/workers/chunks/b657363113f4a37e634b.js +1 -0
- package/assets/esri/core/workers/chunks/b9cb92858a576eb6aa06.js +1 -0
- package/assets/esri/core/workers/chunks/{12b84262dedc6b393136.js → d9a240a3c6bf85124474.js} +1 -1
- package/assets/esri/core/workers/chunks/{8f008eedb11685ee2048.js → e096c1d9d53af74d3207.js} +1 -1
- package/assets/esri/core/workers/chunks/e4e2edfdc85dd14e66d4.js +1 -0
- package/assets/esri/core/workers/chunks/f4d91d470ca5fea0bd26.js +1 -0
- package/assets/esri/core/workers/chunks/f717005e14a7e9141df7.js +1 -0
- package/assets/esri/core/workers/chunks/f75eec2cbc541eec9712.js +1 -0
- package/assets/esri/core/workers/chunks/fcc3902d6d9eda6f09f5.js +1 -0
- package/assets/esri/core/workers/chunks/{28a821de9dbf10324033.js → fd031150d3a7f896e6b3.js} +1 -1
- package/config.js +1 -1
- package/core/scheduling.js +1 -1
- package/geometry/Mesh.d.ts +2 -125
- package/geometry/Mesh.js +1 -1
- package/geometry/support/GlobalCoordinateSystem.js +2 -0
- package/geometry/support/LocalCoordinateSystem.js +2 -0
- package/geometry/support/boundedPlane.js +1 -1
- package/geometry/support/coordinateSystem.js +1 -1
- package/geometry/support/meshErrors.js +1 -1
- package/geometry/support/plane.js +1 -1
- package/geometry/support/polygonUtils.js +1 -1
- package/geometry/support/ray.js +1 -1
- package/geometry/support/sphere.js +1 -1
- package/interfaces.d.ts +0 -3
- package/kernel.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/raster/functions/rasterProjectionHelper.js +1 -1
- package/layers/support/featureLayerUtils.js +1 -1
- package/package.json +2 -2
- package/support/arcadeUtils.js +1 -1
- package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightConfiguration.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightEditTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightManipulators.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/SliceController.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
- package/views/3d/environment/SunLighting.d.ts +10 -8
- package/views/3d/environment/VirtualLighting.d.ts +10 -8
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
- package/views/3d/state/ScreenSizePerspective.js +1 -1
- package/views/3d/support/RenderCoordsHelper.js +1 -1
- package/views/3d/support/ViewSlice.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/renderInfoUtils/polygon.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/PlanarPatch.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/webgl-engine/lib/Path.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/SliceHelper.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
- package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
- package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
- package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
- package/views/support/TextureCompressionWorker.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/webscene/Environment.d.ts +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
- package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/02335385b1476fe322eb.js +0 -1
- package/assets/esri/core/workers/chunks/07b726a46864501b90a0.js +0 -1
- package/assets/esri/core/workers/chunks/189321d88026bd7e6d3e.js +0 -1
- package/assets/esri/core/workers/chunks/18d47ab571b613fbe719.js +0 -1
- package/assets/esri/core/workers/chunks/1967b9c96045a5802d08.js +0 -1
- package/assets/esri/core/workers/chunks/199a7f97916679e0257c.js +0 -1
- package/assets/esri/core/workers/chunks/1d96fbad881a7d14a950.js +0 -1
- package/assets/esri/core/workers/chunks/1dc6f093028530a492e6.js +0 -1
- package/assets/esri/core/workers/chunks/2cd60fd062d954322c1f.js +0 -1
- package/assets/esri/core/workers/chunks/2d3e0e4442dbc6ec6def.js +0 -1
- package/assets/esri/core/workers/chunks/2f5d014d6a72108b0b3a.js +0 -1
- package/assets/esri/core/workers/chunks/3105336a05f38a95ebea.js +0 -1
- package/assets/esri/core/workers/chunks/4419732baf3459a80e6d.js +0 -1
- package/assets/esri/core/workers/chunks/4fb2fcc95f852bf8f86c.js +0 -1
- package/assets/esri/core/workers/chunks/59bc55880e6fd8ce20c0.js +0 -1
- package/assets/esri/core/workers/chunks/5f787809b74eed7b9a91.js +0 -1
- package/assets/esri/core/workers/chunks/6a7de221cea4426cb490.js +0 -1
- package/assets/esri/core/workers/chunks/7a0b4dc0cda190367a39.js +0 -1
- package/assets/esri/core/workers/chunks/7d3f7940815fa5dc244e.js +0 -1
- package/assets/esri/core/workers/chunks/999c23da883eb11cb29e.js +0 -1
- package/assets/esri/core/workers/chunks/9bc3afe7013ef4ae737b.js +0 -1
- package/assets/esri/core/workers/chunks/bab1d010970d98c25470.js +0 -1
- package/assets/esri/core/workers/chunks/c4f78a481f43cfae7b63.js +0 -1
- package/assets/esri/core/workers/chunks/dcf6024dc19428ff2b9d.js +0 -1
- package/assets/esri/core/workers/chunks/e04fb83ab2634bc15cc7.js +0 -1
- package/assets/esri/core/workers/chunks/ee0dc906cc7979080329.js +0 -1
- package/assets/esri/core/workers/chunks/f0d0ed155275c2e6d3da.js +0 -1
- package/chunks/boundedPlane.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 t from"../../../core/Accessor.js";import{destroyHandle as n}from"../../../core/handleUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{destroyHandle as n}from"../../../core/handleUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{create as a,copy as o}from"../../../geometry/support/boundedPlane.js";import{PropertiesPool as s}from"../../support/PropertiesPool.js";let c=class extends t{constructor(e){super(e),this._propertiesPool=new s({plane:()=>a()},this),this.isDecoration=!0,this.addHandles(n(this._propertiesPool))}set plane(e){if(!e){this._set(`plane`,e);return}let t=this._propertiesPool.get(`plane`);o(e,t),this._set(`plane`,t)}};e([r()],c.prototype,`plane`,null),e([r()],c.prototype,`isDecoration`,void 0),c=e([i(`esri.views.3d.support.ViewSlice`)],c);export{c as ViewSlice};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../Graphic.js";import has from"../../../core/has.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
|
|
2
|
+
import e from"../../../Graphic.js";import has from"../../../core/has.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{isIntegratedMeshLayer as p}from"../../../layers/support/layerUtils.js";import{debugFlags as m}from"./debugFlags.js";import{getElevationAtPoint as h}from"./ElevationProvider.js";import{getGraphicHitDedupeKey as g,resolveOrderedIntersectionHits as _}from"./intersectionHitUtils.js";import{Intersector as v}from"../webgl-engine/lib/Intersector.js";import{isValidIntersectorResultRay as y}from"../webgl-engine/lib/IntersectorResult.js";import{toHit as b,toOwner as x}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as S}from"../webgl-engine/lib/verticalOffsetUtils.js";async function C(e,t,n,o){let s=n?F(e,n):o;if(r(t))return w(e,t,s,n?.excludeLabels);if(i(t))return w(e,D(t),s,n?.excludeLabels);let c=t,l=a(c.x,c.y);s.requiresGroundFeedback=!0,s.enableDraped=!0;let u=new v(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(k(e,u.results.all,s.graphics,{getDistance:e=>e.distanceInRenderSpace,getMapPoint:t=>A(e,t),stopAtSupportSurface:!0})),f=u.results.ground,h=x(f,e),g=h!=null&&`type`in h&&p(h)&&(!has(`enable-feature:im-as-ground`)||h.isUsedAsGroundLayer)?h:null,_={screenPoint:c,results:d,ground:{mapPoint:A(e,f),distance:y(f)?f.distanceInRenderSpace:0,layer:g}};return m.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(_.intersector=u),_}async function w(e,t,r,i){r.enableDraped=!0;let a=new v(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 k(e,T(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 m.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(s.intersector=a),s}function*T(e,t){let n=E(e);if(n==null)yield*t;else for(let e of t)e.distance!=null&&e.distance<=n&&(yield e)}function E(e){let t=e.basemapTerrain,n=e.state.camera;return e.state.viewingMode!==1||!n.aboveGround||!t?.opaque?null:(W.radius=t.getLowerBoundRadius(),W.distanceToSilhouette(n.eye)*G)}function D(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 O(e,t,r,i){let a=r?F(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(S)||a.exclude?.has(S);let l=e.sceneIntersectionHelper,u=new v(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=b(t,e);if(n==null||o&&(n.type!==`graphic`||M(a.graphics,n.graphic))||s&&(n.type!==`media`||N(a.mediaElements,n.element)))return A(e,t)}return null}return A(e,u.results.min)}async function*k(e,t,n,r){let i=_(e,r.stopAtSupportSurface?(function*(){for(let n of t){yield n;let t=x(n,e);if(t!=null&&(t===e.map.ground||`type`in t&&p(t)&&(!has(`enable-feature:im-as-ground`)||t.isUsedAsGroundLayer)))break}})():t,{getDedupeKey:e=>e.type===`graphic`?j(e.graphic):null,filterHit:e=>e.type!==`graphic`||M(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 A(e,t,n){return t.getIntersectionPoint(U)?(n=P(e,U,n),t.intersector===7&&e.basemapTerrain&&(n.z=h(e.basemapTerrain,n)??0),n):null}function j(e){let t=e.getObjectId()??e.attributes?.[f];return e.origin&&t!=null?`o-${e.origin.id}-${t}`:`u-${g(e)}`}function M(e,t){return N(e,j(t))}function N(e,t){return e==null||(e.include==null||e.include.has(t))&&(e.exclude==null||!e.exclude.has(t))}function P(e,t,n){let r=e.spatialReference||l.WGS84;return u(t,e.renderSpatialReference,U,r)?t=U:(r=l.WGS84,u(t,e.renderSpatialReference,U,r)&&(t=U)),n?(n.x=t[0],n.y=t[1],n.z=t[2],n.spatialReference=r):n=new c(t,r),n}function F(e,t){let n=I(e,t.include,0),r=I(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 I(n,r,i,a=new L){if(!r)return a;if(r instanceof e)V(a,j(r)),i===0&&(n.graphicsView!=null&&r.layer===n?z(a,n.graphicsView.uid):r.layer&&R(a,n,r.layer.uid));else if(`layer`in r&&`element`in r)H(a,r.element),i===0&&R(a,n,r.layer.uid);else if(!t(r))`layer`in r&&B(a,n,r),`uid`in r&&R(a,n,r.uid);else for(let e of r)if(e===n.graphics&&n.graphicsView!=null)z(a,n.graphicsView.uid);else if(e===n.map.ground){z(a,S);for(let e of n.map.ground.allIntegratedMeshGround)R(a,n,e.uid)}else I(n,e,i,a);return a}class L{constructor(){this.layerViewUids=null,this.graphicUids=null,this.mediaElements=null}}function R(e,t,n){let r=t.allLayerViews.find(e=>e.layer.uid===n);r&&z(e,r.uid)}function z(e,t){e.layerViewUids??=new Map,e.layerViewUids.set(t,!0)}function B(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 V(e,t){e.graphicUids??=new Set,e.graphicUids.add(t)}function H(e,t){e.mediaElements??=new Set,e.mediaElements.add(t)}const U=s(),W=new d,G=1.2;export{P as computeMapPointFromVec3d,F as externalToInternalIntersectOptions,C as hitTest,A as intersectResultToMapPoint,M as testGraphicUidFilter,O as toMap};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{isPromiseLike as e}from"../../../../core/promiseUtils.js";import{projectBuffer as t}from"../../../../geometry/projection/projectBuffer.js";import{
|
|
2
|
+
import{isPromiseLike as e}from"../../../../core/promiseUtils.js";import{projectBuffer as t}from"../../../../geometry/projection/projectBuffer.js";import{newDoubleArray as n,doubleSubArray as r}from"../../../../geometry/support/DoubleArray.js";import{applyPerVertexElevationAlignment as i}from"../../layers/graphics/elevationAlignmentUtils.js";import{load as a,axisFromRings as o,ringsToOutlinedTessellationInfo as s,tessellateOrLoad as c}from"../../layers/graphics/tessellationUtils.js";import{drapedZ as l}from"../../terrain/DrapedZ.js";async function u(){return a()}class d{constructor(e,t,n,r){this.positions=e,this.polygonIndices=t,this.outline=n,this.projectionSuccess=r,this.count=e.length/3}get vertexCount(){return this.positions.length/3}get polygonIndexCount(){return this.polygonIndices.length}get outlineIndexCount(){let{outline:e}=this;if(e.output!==`tessellated-indices`)return 0;let t=0;for(let n=0;n<e.outlineIndices.length;n++)t+=w(e.outlineIndices[n]);return t}get outlineSegmentCount(){let{outline:e}=this;if(e.output!==`tessellated-indices`)return 0;let t=0;for(let n=0;n<e.outlineIndices.length;n++){let r=w(e.outlineIndices[n]);t+=r}return t}}class f extends d{}class p extends d{}class m extends d{constructor(e,t,n,r,i,a){super(e,n,r,i),this.mapPositions=t,this.sampledElevation=a}}function h(t,n){let r=v(t,n);return e(r)?null:r}function g(t,n,r,i,a){let o=b(t,n,r,i,a);return e(o)?null:o}function _(t,n){let r=y(t,n);return e(r)?null:r}function v(t,n){let{projectIfNearlyVertical:r=!1,outlineOutput:i=`none`,method:a,owner:l}=n??{},u=i===`tessellated-indices`,d=o(t.rings,!!t.hasZ,t.spatialReference),f=s(t.rings,{hasZ:!!t.hasZ,ccwRingsAsHoles:!0,spatialReference:t.spatialReference,axis:d}),m=c(f,{projectionAxis:r?d:void 0,outlines:u?f.outlines:void 0,method:a,owner:l});if(e(m))return m;if(!m.succeeded)return null;let h={output:`none`};if(i===`vertex-data`){let e=m.positions===f.positions?f.positions.slice():f.positions;h={output:`vertex-data`,outlines:x(f.outlines,e)}}else i===`tessellated-indices`&&(h=S(m));return new p(m.positions,m.indices,h,!0)}function y(n,r){let{drapedSpatialReference:i,projectIfNearlyVertical:a=!1,outlineOutput:u=`none`,method:d,owner:p}=r,m=o(n.rings,!1,n.spatialReference),h=s(n.rings,{hasZ:!1,ccwRingsAsHoles:!0,spatialReference:n.spatialReference,axis:m}),g=u!==`none`,_=t(h.positions,n.spatialReference,0,h.positions,i,0),v=c(h,{projectionAxis:a?m:void 0,outlines:g?h.outlines:void 0,method:d,owner:p});if(e(v))return v;if(!v.succeeded)return null;let{positions:y,indices:b}=v;for(let e=2;e<y.length;e+=3)y[e]=l;let C={output:`none`};if(u===`vertex-data`){if(y!==h.positions)for(let e=2;e<h.positions.length;e+=3)h.positions[e]=l;let e=y===h.positions?h.positions.slice():h.positions;C={output:`vertex-data`,outlines:x(h.outlines,e)}}else u===`tessellated-indices`&&(C=S(v));return new f(y,b,C,_)}function b(t,r,a,l,u){let{projectIfNearlyVertical:d=!1,outlineOutput:f=`none`,method:p,owner:h}=u??{},g=f!==`none`,_=!!t.hasZ&&l.mode!==`on-the-ground`,v=o(t.rings,_,t.spatialReference),y=s(t.rings,{hasZ:_,ccwRingsAsHoles:!0,spatialReference:t.spatialReference,axis:v}),b=c(y,{projectionAxis:d?v:void 0,outlines:g?y.outlines:void 0,method:p,owner:h});if(e(b))return b;if(!b.succeeded)return null;let{positions:x,vertexCount:w}=b,T=n(x.length),E=i(x,t.spatialReference,0,T,0,x,0,w,r,a,l),D={output:`none`};f===`vertex-data`?D={output:`vertex-data`,outlines:C(b,T)}:f===`tessellated-indices`&&(D=S(b));let O=E!=null;return new m(x,T,b.indices,D,O,E)}function x(e,t,n=null){return e.values().filter(({count:e})=>e>1).map(({index:e,count:i})=>{let a=e*3,o=i*3;return n==null?new T(e,i,r(t,a,o)):new E(e,i,r(t,a,o),r(n,a,o))}).toArray()}function S(e){let{outlineIndexBuffer:t,outlineRingLengths:n}=e;if(t==null||n==null)return{output:`none`};let r=Array(n.length),i=0;for(let e=0;e<n.length;e++){let a=n[e],o=t.slice(i,i+a);r[e]=o,i+=a}return{output:`tessellated-indices`,outlineIndices:r}}function C(e,t){let{outlineIndexBuffer:i,outlineRingLengths:a,positions:o}=e;if(i==null||a==null)return[];let s=0;for(let e=0;e<a.length;e++)s+=a[e]-1;let c=n(s*3),l=n(s*3),u=[],d=0,f=0;for(let e=0;e<a.length;e++){let n=a[e],s=n-1;for(let e=0;e<s;e++){let n=i[d+e]*3,r=(f+e)*3;c[r]=o[n],c[r+1]=o[n+1],c[r+2]=o[n+2],l[r]=t[n],l[r+1]=t[n+1],l[r+2]=t[n+2]}u.push(new E(f,s,r(c,f*3,s*3),r(l,f*3,s*3))),d+=n,f+=s}return u}function w(e,t=0,n=e.length){return n>1&&e[t]===e[t+n-1]?n-1:n}class T{constructor(e,t,n){this.index=e,this.count=t,this.position=n}}class E extends T{constructor(e,t,n,r){super(e,t,n),this.mapPositions=r}}export{E as OutlineVertexData,T as OutlineVertexDataDraped,d as PolygonRenderInfoBase,f as PolygonRenderInfoDraped,m as PolygonRenderInfoElevationAligned,p as PolygonRenderInfoNotElevationAligned,u as loadTessellationUtils,y as polygonToRenderInfoDraped,b as polygonToRenderInfoElevationAligned,v as polygonToRenderInfoNotElevationAligned,_ as preloadedPolygonToRenderInfoDraped,g as preloadedPolygonToRenderInfoElevationAligned,h as preloadedPolygonToRenderInfoNotElevationAligned,S as splitOutlineIndexRings,C as tessellatedOutlineIndicesToVertexData};
|
|
@@ -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)*we*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,X(e),O(e),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,we));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<=we;++e){let t=i+e/we*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 te=H-G,J=U-K,Y=ee-q,X=f*n,Z=d*n,ne=t;ne*ne<.999&&(X=V*J-B*Y,Z=z*Y-V*te,ne=B*te-z*J);let Q=1/Math.sqrt(X*X+Z*Z+ne*ne);v(p,D,X*Q,Z*Q,ne*Q,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,te=0,J=0,Y=0;if(e>1){let e=(A-l)*O;te=D[e],J=D[e+1],Y=D[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=C+a(S,x,c);te=N*t*n-w,J=M*t*n-T,Y=e*n-E}let X=C+a(S,p,c),Z=N*j*X-w,ne=M*j*X-T,Q=_*X-E;if(e<l){let e=A+l,t=e*O;D[t]=Z,D[t+1]=ne,D[t+2]=Q,be(Z,ne,Q,f),m.setValues(e,Math.round(s*n),Math.round(d*n))}let re=te-Z,ie=J-ne,ae=Y-Q,oe=N*o,se=M*o,ce=i;ce*ce<.999&&(oe=q*ie-K*ae,se=G*ae-q*re,ce=K*re-G*ie);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){e.tile.intersectsClippingArea&&(O(e),ie(e),e.intersectionData=null)}function D(e){e.tile.intersectsClippingArea&&(Z(e),O(e),ie(e),ae(e),e.intersectionData=null)}function O(e){e.tile.intersectsClippingArea&&(A(e),k(e))}function k(e){let{geometry:r,geometryState:i,tile:s,localOrigin:c}=e,{level:u,extent:d,extentInRadians:g,ellipsoid:y}=s,b=y.radius,x=g[0],S=g[2],C=g[1],w=g[3],{samplerData:T}=i,E=d[0],D=d[2],O=d[1],k=d[3],A=P(e),{boundingBox:j,vertexAttributes:M}=r,N=c[0],F=c[1],I=c[2],{position:L,uv0:R}=M,z=L.typedBuffer,B=L.typedBufferStride,V=R.typedBuffer,H=R.typedBufferStride,{typedBuffer:U,typedBufferStride:ee}=M.normalCompressed,W=T?.length===1?T[0]:null,G=(e,t,n)=>W?o(e,t,W)??0:a(e,t,T)??0;for(let c=0;c<4;++c){let g=c===1||c===3,y=i.edgeResolutions[c];f(t(y));let M=y+1,P=l(s,i.edgePeerNeighbors[c]);if(_e(s,P,c)&&ne(e,c,P))continue;let L=P!=null;f(!L||P.level===s.level),f(!L||_(s,P)<=0);let R=P?.renderData?.geometryState;if(p){let e=s.surface;if(!P&&e&&!e.updatingRootTiles){let t=m[c],n=s.findNeighborTile(t,e=>e.loaded||e.leaf||e.level===s.level);n?n.intersectsClippingArea&&(f(!n.loaded),f(!n.leaf),f(n.level===u)):f(e?.rootTiles==null||!s.shouldHaveNeighbor(t))}}let K=c===1?d[2]:d[0],q=P?.extent,te=q&&g?c===1?q[0]:q[2]:K,J=c===0?d[3]:d[1],Y=+(c===1),X=+(c===0),Z=c===1?S:x,Q=c===0?w:C,re=Math.sin(Z),ie=Math.cos(Z),ae=Math.sin(Q),oe=Math.cos(Q),se=R?.samplerData,$=se?.length===1?se[0]:null,ce=(e,t,n)=>$?o(n,t,$)??0:a(n,t,se)??0,le=L?(e,t,n)=>(G(e,t)+ce(e,t,n))*.5:G,ue=r.outerEdgesOffsetAndLength[c*2+0],de=W!=null||T!=null&&T.some(e=>e!=null),fe=$!=null||se!=null&&se.some(e=>e!=null),pe=de||fe,me=1/y,he=n*me,ge=Y*n,ve=X*n,ye=ue;f(!q||h(q[2]-q[0],d[2]-d[0])),(()=>{let e=c===1?-1:+(c===3),t=c===0?-1:+(c===2),n=(d[2]-d[0])*me,r=e*n,i=t*n,s=S-x,l=g?s*me*e:0,u=g?0:t*me,f=X,p=g?Z+l:Z,m=g?Math.sin(p):re,h=g?Math.cos(p):ie,_=g?Z-l:Z,y=g?Math.sin(_):re,C=g?Math.cos(_):ie,w=f+u,P=g?Q:A(w),R=g?ae:Math.sin(P),G=g?oe:Math.cos(P),q=f-u,Y=g?Q:A(q),ne=g?ae:Math.sin(Y),ce=g?oe:Math.cos(Y),ue=0,de=0,fe=0;{let e=0*me,t=g?K:E*(1-e)+D*e,n=g?te:t,r=g?O*(1-e)+k*e:J,i=g?Z:x*(1-e)+S*e,a=g?re:Math.sin(i),o=g?ie:Math.cos(i),s=g?A(e):Q,c=g?Math.sin(s):ae,l=g?Math.cos(s):oe,u=b+le(t,r,n);ue=o*l*u,de=a*l*u,fe=c*u}let _e=0,xe=0,Se=0;{let e=1*me,t=g?K:E*(1-e)+D*e,n=g?te:t,r=g?O*(1-e)+k*e:J,i=g?Z:x*(1-e)+S*e,a=g?re:Math.sin(i),o=g?ie:Math.cos(i),s=g?A(e):Q,c=g?Math.sin(s):ae,l=g?Math.cos(s):oe,u=b+le(t,r,n);_e=o*l*u,xe=a*l*u,Se=c*u}for(let e=1;e<M-1;++e){let t=0,n=0,s=0;{let r=(e+1)*me,i=g?K:E*(1-r)+D*r,a=g?te:i,o=g?O*(1-r)+k*r:J,c=g?Z:x*(1-r)+S*r,l=g?re:Math.sin(c),u=g?ie:Math.cos(c),d=g?A(r):Q,f=g?Math.sin(d):ae,p=g?Math.cos(d):oe,m=b+le(i,o,a);t=u*p*m,n=l*p*m,s=f*m}let l=t,u=n,d=s,f=_e,p=xe,_=Se;_e=l,xe=u,Se=d;{let t=ye+e,n=t*B,r=f-N,i=p-F,a=_-I;z[n]=r,z[n+1]=i,z[n+2]=a,be(r,i,a,j);let o=Math.round(e*he),s=t*H;V[s]=g?ge:o,V[s+1]=g?o:ve}let w=ue,M=de,P=fe;ue=f,de=p,fe=_;let q=f,Y=p,X=_,Ce=1/Math.sqrt(q*q+Y*Y+X*X),we=X*Ce,Te=0,Ee=0,De=0;if(pe&&we*we<.999){let t=0,n=0,s=0;{let e=c===0?-1:1;t=e*(l-w),n=e*(u-M),s=e*(d-P)}{let l=e*me,u=g?K:E*(1-l)+D*l,d=g?te:u,f=g?O*(1-l)+k*l:J,p=g?Z:x*(1-l)+S*l,_=g?re:Math.sin(p),v=g?ie:Math.cos(p),w=g?A(l):Q,j=g?Math.sin(w):ae,M=g?Math.cos(w):oe,N=q,P=Y,F=X;if(L){let e=d-r,t=f-i,n=b+($?o(e,t,$)??0:a(e,t,se)??0),s=g?y:_,c=g?C:v,l=g?j:ne,u=g?M:ce;N=c*u*n,P=s*u*n,F=l*n}{let e=u+r,l=f+i,d=b+(W?o(e,l,W)??0:a(e,l,T)??0),p=g?m:_,y=g?h:v,x=g?j:R,S=g?M:G,C=y*S*d,w=p*S*d,E=x*d;L||(N=2*q-C,P=2*Y-w,F=2*X-E);let D=c===3?-1:1,O=D*(N-C),k=D*(P-w),A=D*(F-E);Te=s*k-n*A,Ee=t*A-s*O,De=n*O-t*k;let I=1/Math.sqrt(Te*Te+Ee*Ee+De*De);Te*=I,Ee*=I,De*=I}}}else Te=q*Ce,Ee=Y*Ce,De=X*Ce;v(U,ye+e,Te,Ee,De,ee)}})()}}function A(e){Q(e)}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,X(e),z(e),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,te=e(y*(1-q)+x*q,w,T),J=h?(Math.PI/2-2*Math.atan(Math.exp(-te/E)))*E:te*D,Y=K,X=J,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=X,s=(t-1)/O,c=e(y*(1-s)+x*s,w,T),l=Y,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);Y=X,X=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,te=K,J=K*D,Z=ne(K,i);if(t===1){let t=J-B,r=Y-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=J,u=Z,m=(r+1)/O,h=e(m,A,M),y=e(_*(1-m)+b*m,S,C),x=te;te=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))}J=l,Z=d}else J=U[s]+B,Z=U[s+2]+H}let w=J,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),ie(e),ae(e),e.intersectionData=null)}function R(e){e.tile.intersectsClippingArea&&(z(e),ie(e),e.intersectionData=null)}function z(e){e.tile.intersectsClippingArea&&(V(e),B(e))}function B(n){let{geometry:r,geometryState:i,localOrigin:s}=n,c=n.tile,{surface:u,extent:d}=c,{clippingArea:h,samplerData:g}=i,v=h??he,y=d[0],b=d[2],x=d[1],S=d[3],C=[S>v[3],b>v[2],x<v[1],y<v[0]],w=c.horizontalScale,T=ee(u.isWebMercatorOnPlateCarree,c.ellipsoid.radius,w),{minu:E,minv:D,maxu:O,maxv:k,boundingBox:A}=r,j=Math.max(y,v[0]),M=Math.min(b,v[2]),N=Math.max(x,v[1]),P=Math.min(S,v[3]),F=s[0],I=s[1],L=s[2],R=g?.length===1?g[0]:void 0,z=R?(e,t)=>o(e,t,R)??0:(e,t)=>a(e,t,g)??0;for(let s=0;s<4;++s){let d=s===1||s===3,h=i.edgeResolutions[s];f(t(h));let v=h+1,R=C[s],B=l(c,i.edgePeerNeighbors[s]);if(!R&&_e(c,B,s)&&ne(n,s,B))continue;let V=B!=null&&!R,H=B?.renderData?.geometryState;if(p&&(f(!V||B.level===c.level),f(!V||_(c,B)<=0),c&&!B&&!u.updatingRootTiles)){let e=m[s],t=c.findNeighborTile(e,e=>e.loaded||e.leaf||e.level===c.level);u.updatingRootTiles||(t?t.intersectsClippingArea&&(f(!t.loaded),f(!t.leaf),f(t.level===c.level)):f(u?.rootTiles==null||!c.shouldHaveNeighbor(e)))}let U=e(s===1?b:y,j,M),ee=e(s===0?S:x,N,P),W=H?.samplerData,G=e(+(s===1),E,O),K=e(+(s===0),D,k),q=W?.length===1?W[0]:null,te=(e,t)=>q?o(e,t,q)??0:a(e,t,W)??0,J=V?(e,t)=>(te(e,t)+z(e,t))*.5:z,Y=(b-y)/h,X=d?s===1?Y:-Y:0,Z=d?0:s===0?Y:-Y,Q=-X,re=-Z,ie=0,ae=0,oe=0;{let t=0/h,n=d?U:e(y*(1-t)+b*t,j,M),r=d?e(x*(1-t)+S*t,N,P):ee,i=J(n,r);ie=n*w,ae=T(r),oe=i}let se=0,$=0,ce=0;{let t=1/h,n=d?U:e(y*(1-t)+b*t,j,M),r=d?e(x*(1-t)+S*t,N,P):ee,i=J(n,r),a=n*w,o=T(r),s=i;se=a,$=o,ce=s}for(let t=1;t<v-1;++t){let n=t/h,i=se,o=$,c=ce;{let a=d?G:e(n,E,O),l=d?e(n,D,k):K,u=i-F,f=o-I,p=c-L;be(i,f,p,A),r.setEdgeVertexFromValuesRawPositionUV(s,t,u,f,p,a,l)}{let n=(t+1)/h,r=d?U:e(y*(1-n)+b*n,j,M),i=d?e(x*(1-n)+S*n,N,P):ee,a=J(r,i);se=r*w,$=T(i),ce=a}let l=se,u=$,f=ce,p=ie,m=ae,_=oe;ie=i,ae=o,oe=c;let v=0,C=0,R=0;if(d){let t=u-o,r=f-c,l=m-o,d=_-c,p=e(x*(1-n)+S*n,N,P),h=U+Q,y=p,b=h*w,T=a(h,y,g),E=b-i,D=T-c,O=s===3?-1:1;if(v=O*(-l+t)*D,C=O*E*(-d+r),R=-O*E*(-l+t),V){let e=U+X,n=p,o=e*w,s=a(e,n,W),u=o-i,f=s-c;v=(-l+t)*(D-f),C=(E-u)*(-d+r),R=-(E-u)*(-l+t)}}else{let t=l-i,r=f-c,u=p-i,d=_-c,m=e(y*(1-n)+b*n,j,M),h=m,x=ee+re,S=a(h,x,g)-c,w=T(x)-o,E=s===2?-1:1;if(v=E*w*(-d+r),C=E*(-u+t)*S,R=-E*w*(-u+t),V){let e=m,n=ee+Z,i=T(n),s=a(e,n,W)-c,l=i-o;v=(-w+l)*(-d+r),C=(-u+t)*(-S+s),R=-(-w+l)*(-u+t)}}let z=1/Math.sqrt(v*v+C*C+R*R);r.setEdgeNormalFromValues(s,t,v*z,C*z,R*z)}}}function V(e){Q(e)}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?(te(e),J(e,t),Y(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 te(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 J(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 Y(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 X(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){X(e),e.geometryState.wireframe?Y(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 Q(t){let{geometry:r,geometryState:i,localOrigin:o}=t,{clippingArea:s,samplerData:c}=i,{minu:l,minv:u,maxu:d,maxv:p,boundingBox:m,vertexAttributes:h}=r,g=t.tile,{surface:v,ellipsoid:y,extent:b,extentInRadians:x,horizontalScale:S}=g,C=v.view?.viewingMode===`local`,w=y.radius,T=0,E=0,D=0,O=C?(()=>{let t=s,n=t!=null&&(b[3]>t[3]||b[2]>t[2]||b[1]<t[1]||b[0]<t[0]),r=ee(v.isWebMercatorOnPlateCarree,w,S);return(i,a,o)=>{let s=i===0?b[0]:b[2],c=a===0?b[1]:b[3],l=n?e(s,t[0],t[2]):s,u=n?e(c,t[1],t[3]):c,d=o;T=l*S,E=r(u),D=d}})():(e,t,n)=>{let r=x[t===0?1:3],i=x[e===0?0:2],a=Math.cos(r),o=Math.sin(r),s=Math.sin(i),c=Math.cos(i),l=w+n;T=c*a*l,E=s*a*l,D=o*l},k=0,A=0,j=0,M=0,N=0,F=0,I=0,L=0,R=0,z=C&&v.isWebMercatorOnPlateCarree,B=(e,t,n,r,i)=>{let a=0,o=0,s=0;if(C){let e=t*S,i=z?(Math.PI/2-2*Math.atan(Math.exp(-n/w)))*w:n*S,c=r;a=e-T,o=i-E,s=c-D}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=w+r,b=v*h*y,x=_*h*y,S=g*y;a=b-T,o=x-E,s=S-D}switch(i){case 0:I+=a,L+=o,R+=s;break;case 1:M-=a,N-=o,F-=s;break;case 2:I-=a,L-=o,R-=s;break;case 3:M+=a,N+=o,F+=s}},V=s??he,H=b[0],U=b[2],W=b[1],G=b[3],K=[G>V[3],U>V[2],W<V[1],H<V[0]],q=Math.max(H,V[0]),te=Math.min(U,V[2]),J=Math.max(W,V[1]),Y=Math.min(G,V[3]),X=e=>Math.max(V[0],Math.min(V[2],e)),Z=e=>Math.max(V[1],Math.min(V[3],e)),ne=e=>{let t=i.cornerNeighborCornerTiles;k=0,A=0,j=1,M=0,N=0,F=0,I=0,L=0,R=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,o=0;for(let e=0;e<4;++e){let t=ge[e];t&&(r=Math.max(r,t?.renderData.geometryState.numVerticesPerSide),o=t.extent[2]-t.extent[0])}let s=o,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=X(c[r===0||r===1?2:0]+o),d=Z(c[r===0||r===3?3:1]+s),f=n.extent,p=X(f[i===0||i===1?2:0]+o),m=Z(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);B(h,u,d,.5*(_+v),e)}else{let o=t??n,s=t?r:i,c=o.extent,u=se[e],d=X(c[s===0||s===1?2:0]+u[0]*l),f=Z(c[s===0||s===3?3:1]+u[1]*l),p=o.renderData,m=a(d,f,p.geometryState.samplerData);B(p,d,f,m,e)}}if(!C){let e=Math.sqrt(T*T+E*E+D*D);k=T/e,A=E/e,j=D/e}if(C||j*j<.999){let e=Math.sqrt(M*M+N*N+F*F);M/=e,N/=e,F/=e;let t=Math.sqrt(I*I+L*L+R*R);I/=t,L/=t,R/=t,k=F*L-N*R,A=M*R-F*I,j=N*I-M*L;let n=1/Math.sqrt(k*k+A*A+j*j);k*=n,A*=n,j*=n}},Q=i.cornerNeighborCornerTiles;for(let t=0;t<4;++t){let s=t,v=(t+1)%4,y=+(t===0||t===1),b=+(t===0||t===3),x=e(y,l,d),S=e(b,u,p),C=r.getEdgeFirstVertexIndex(s),w=r.getEdgeCount(s),M=t===0||t===3?w-1:0,N=r.getEdgeFirstVertexIndex(v),P=r.getEdgeCount(v),F=t===0||t===1?P-1:0,I=-1;for(let e=0;e<4;++e){let n=Q[t*4+e],r=Q[t*4+I];n&&(I===-1||_(r,n)>0)&&(I=e)}let L=I,R=Q[t*4+L];if(R!==g){let e=g.level-R.level,r=2**e,a=[R.lij[0]+e,R.lij[1]*r,R.lij[2]*r],s=[a[1]+r===g.lij[1],t===0&&(L===1||L===0&&R!==Q[t*4+3])||t===1&&(L===0||L===1&&R!==Q[t*4+2]),a[1]===g.lij[1]+1,t===2&&(L===3||L===2&&R!==Q[t*4+1])||t===3&&(L===2||L===3&&R!==Q[t*4+0])],c=s.reduce((e,t)=>e+ +!!t,0);f(c===1||c===2);let l=-1,u=-1,d=R.renderData;if(c===1){let e=s.findIndex(e=>e);f(0<=e&&e<=3),l=(e+2)%4;let n=i.edgeResolutions[e];u=g.getNeighborEdgeStartVertexIndex(e,R)*n+n*+(e===0&&t===0||e===1&&t===0||e===2&&t===1||e===3&&t===3)}else{f(s[1]||s[3]),l=s[1]?3:1;let e=d.geometryState.edgeResolutions[l];u=t===0||t===3?0:e}let p=d.geometry;{let e=C+M,t=N+F,r=p.getEdgeFirstVertexIndex(l)+u,i=p.vertexAttributes,a=d.localOrigin,s=i.position,c=s.typedBuffer,f=r*s.typedBufferStride,g=c[f]+a[0]-o[0],_=c[f+1]+a[1]-o[1],v=c[f+2]+a[2]-o[2];be(g,_,v,m);let y=h.position,b=y.typedBuffer,w=e*y.typedBufferStride;b[w]=g,b[w+1]=_,b[w+2]=v;let T=t*y.typedBufferStride;b[T]=g,b[T+1]=_,b[T+2]=v;let E=h.uv0;E.setValues(e,Math.round(x*n),Math.round(S*n)),E.setValues(t,Math.round(x*n),Math.round(S*n));{let n=i.normalCompressed.typedBuffer,a=r*i.normalCompressed.typedBufferStride,o=h.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=K[s],i=K[v],l;if(n||i){let t=e(H*(1-y)+U*y,q,te),n=e(W*(1-b)+G*b,J,Y);l=a(t,n,c)}else l=re(Q,t);O(y,b,l),ne(t);let u=T-o[0],d=E-o[1],f=D-o[2];be(u,d,f,m),r.setEdgeVertexFromValuesRawPositionUVNormal(s,M,u,d,f,x,S,k,A,j),r.setEdgeVertexFromValuesRawPositionUVNormal(v,F,u,d,f,x,S,k,A,j)}}for(let e=0;e<4;++e)ge[e]=null}function re(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 ie(e){let{vao:t,geometry:n}=e,{vertexAttributes:r,edgeVerticesStartIndex:i}=n,{position:a}=r,o=a.typedBuffer,s=i*a.typedBufferStride;t.buffer()?.setSubData(o,s,s,o.length)}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=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)*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,J(e),O(e,we,Te),U(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,ee=F-R,V=0,H=0,te=0;if(e>1){let e=(D-s)*S;V=x[e],H=x[e+1],te=x[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=g+T(l,0,O);V=f*t*n-_,H=d*t*n-y,te=e*n-b}let U=g+T(l,r,O),W=f*o*U-_,G=d*o*U-y,K=a*U-b;if(e<s){let e=D+s,t=e*S;x[t]=W,x[t+1]=G,x[t+2]=K,be(W,G,K,u);let n=e*E;C[n]=le[l],C[n+1]=i}let q=V-W,ne=H-G,re=te-K,J=f*n,Y=d*n,X=t;X*X<.999&&(J=ee*ne-B*re,Y=z*re-ee*q,X=B*q-z*ne);let Z=1/Math.sqrt(J*J+Y*Y+X*X);v(p,D,J*Z,Y*Z,X*Z,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],ee=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,V=0;if(t<l){let e=(A+1)*O;P=D[e],R=D[e+1],V=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,V=i*n-E}let H=F,te=I,U=L;F=z,I=B,L=ee,z=P,B=R,ee=V;let W=P-H,G=R-te,K=V-U,q=0,ne=0,re=0;if(e>1){let e=(A-l)*O;q=D[e],ne=D[e+1],re=D[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=C+a(S,x,c);q=N*t*n-w,ne=M*t*n-T,re=e*n-E}let J=C+a(S,p,c),Y=N*j*J-w,X=M*j*J-T,Z=_*J-E;if(e<l){let e=A+l,t=e*O;D[t]=Y,D[t+1]=X,D[t+2]=Z,be(Y,X,Z,f),m.setValues(e,Math.round(s*n),Math.round(d*n))}let ie=q-Y,Q=ne-X,ae=re-Z,oe=N*o,se=M*o,ce=i;ce*ce<.999&&(oe=K*Q-G*ae,se=W*ae-K*ie,ce=G*ie-W*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&&(Y(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,ee=R.typedBufferStride,V=z.typedBuffer,H=z.typedBufferStride,{typedBuffer:te,typedBufferStride:U}=N.normalCompressed,W=E?.length===1?E[0]:null,G=(e,t,n)=>W?o(e,t,W)??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)&&X(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 K=u===1?g[2]:g[0],q=P?.extent,ne=q&&y?u===1?q[0]:q[2]:K,re=u===0?g[3]:g[1],J=+(u===1),Y=+(u===0),Z=u===1?C:S,ie=u===0?T:w,Q=Math.sin(Z),ae=Math.cos(Z),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)=>(G(e,t)+le(e,t,n))*.5:G,de=i.outerEdgesOffsetAndLength[u*2+0],fe=W!=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=J*n,ye=Y*n,xe=de;f(!q||h(q[2]-q[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=Y,f=y?Z+c:Z,p=y?Math.sin(f):Q,m=y?Math.cos(f):ae,h=y?Z-c:Z,_=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),G=d-l,q=y?ie:j(G),J=y?oe:Math.sin(q),X=y?se:Math.cos(q),le=0,de=0,fe=0;{let e=0*he,t=y?K:D*(1-e)+O*e,n=y?ne:t,r=y?k*(1-e)+A*e:re,i=y?Z: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?K:D*(1-e)+O*e,n=y?ne:t,r=y?k*(1-e)+A*e:re,i=y?Z: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?K:D*(1-r)+O*r,a=y?ne:i,o=y?k*(1-r)+A*r:re,c=y?Z: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*ee,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*H;V[s]=y?ve:o,V[s+1]=y?o:ye}let w=le,T=de,N=fe;le=f,de=h,fe=g;let G=f,q=h,Y=g,Ce=1/Math.sqrt(G*G+q*q+Y*Y),we=Y*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?K:D*(1-c)+O*c,d=y?ne:l,f=y?k*(1-c)+A*c:re,h=y?Z: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=G,F=q,I=Y;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:J,u=y?M:X;N=c*u*n,F=s*u*n,I=l*n}{let e=l+r,c=f+i,d=x+(W?o(e,c,W)??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*G-C,F=2*q-w,I=2*Y-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=G*Ce,Ee=q*Ce,De=Y*Ce;v(te,xe+e,Te,Ee,De,U)}})()}}function A(e,t){Z(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,J(e),z(e,we,Te),U(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],ee=c[1],V=c[2],H=I.typedBuffer,te=I.typedBufferStride,U=0,W=e(y,w,T),G=h?(Math.PI/2-2*Math.atan(Math.exp(-W/E)))*E:W*D,K=1/O,q=e(y*(1-K)+x*K,w,T),ne=h?(Math.PI/2-2*Math.atan(Math.exp(-q/E)))*E:q*D,re=G,J=ne,Y=l?.length===1?l[0]:null,X=Y?(e,t)=>o(e,t,Y)??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=J,s=(t-1)/O,c=e(y*(1-s)+x*s,w,T),l=re,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);re=J,J=f;let m=e(_,S,C),g=m*D,F=X(m,i),I=1/O,W=e(I,A,M),G=e(_*(1-W)+b*W,S,C),K=W,q=G,ne=G*D,Y=X(G,i);if(t===1){let t=ne-B,r=re-ee,i=Y-V,o=0*te;H[o]=t,H[o+1]=r,H[o+2]=i,be(t,r,i,P);let s=e(I,A,M);L.setValues(U,Math.round(s*n),Math.round(a*n))}for(let r=1;r<=k;r++){let s=ne,u=Y,m=(r+1)/O,h=e(m,A,M),y=e(_*(1-m)+b*m,S,C),x=q;q=y;{let e=U+1,s=e*te;if(t===1||r===k){let c=X(y,i),l=y*D,u=o,d=c;if(t===1&&r<k){let t=l-B,r=u-ee,i=d-V;H[s]=t,H[s+1]=r,H[s+2]=i,be(t,r,i,P),L.setValues(e,Math.round(h*n),Math.round(a*n))}ne=l,Y=d}else ne=H[s]+B,Y=H[s+2]+V}let w=ne,T=Y,E=g,j=F;g=s,F=u;let N=(U-k)*te,I=t===1?X(x,c):H[N+2]+V,W=X(x,d);if(t<k){let e=U+k,t=e*te,r=s-B,i=f-ee,a=W-V;H[t]=r,H[t+1]=i,H[t+2]=a,be(r,i,a,P);let o=K;K=h,L.setValues(e,Math.round(o*n),Math.round(p*n))}{let e=w-E,t=T-j,n=l-f,r=I-W,i=n*t,a=e*r,o=-n*e,s=i*i+a*a+o*o;if(s===0)v(R,U,0,0,1,z);else{let e=1/Math.sqrt(s);v(R,U,i*e,a*e,o*e,z)}}++U}}}function L(e){e.tile.intersectsClippingArea&&(Y(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&&ee(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=te(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],ee=l(u,s.edgePeerNeighbors[c]);if(!z&&_e(u,ee,c)&&X(n,c,ee))continue;let V=ee!=null&&!z,H=ee?.renderData?.geometryState;if(p&&(f(!V||ee.level===u.level),f(!V||_(u,ee)<=0),u&&!ee&&!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 te=e(c===1?x:b,M,N),U=e(c===0?C:S,P,F),W=H?.samplerData,G=e(+(c===1),D,k),K=e(+(c===0),O,A),q=W?.length===1?W[0]:null,ne=(e,t)=>q?o(e,t,q)??0:a(e,t,W)??0,re=V?(e,t)=>(ne(e,t)+B(e,t))*.5:B,J=(x-b)/g,Y=h?c===1?J:-J:0,Z=h?0:c===0?J:-J,ie=-Y,Q=-Z,ae=0,oe=0,se=0;{let t=0/g,n=h?te:e(b*(1-t)+x*t,M,N),r=h?e(S*(1-t)+C*t,P,F):U,i=re(n,r);ae=n*T,oe=E(r),se=i}let $=0,ce=0,le=0;{let t=1/g,n=h?te:e(b*(1-t)+x*t,M,N),r=h?e(S*(1-t)+C*t,P,F):U,i=re(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?G:e(n,D,k),l=h?e(n,O,A):K,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?te:e(b*(1-n)+x*n,M,N),i=h?e(S*(1-n)+C*n,P,F):U,a=re(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=te+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),V){let e=te+Y,n=h,o=e*T,c=a(e,n,W),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=U+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),V){let e=h,n=U+Z,r=E(n),c=a(e,n,W)-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 ee(e,t){Z(e,t)}function V(e,t){return(Math.PI/2-2*Math.atan(Math.exp(-e/t)))*t}function H(e,t){return e*t}function te(e,t,n){return e?e=>V(e,t):e=>H(e,n)}function U(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?(q(e),ne(e,t),re(e)):(W(e),G(e,t),K(e))}function W(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 G(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 K(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 q(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 ne(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 re(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 J(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 Y(e){J(e),e.geometryState.wireframe?re(e.geometry):K(e.geometry)}function X(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,ee=w.getEdgeFirstVertexIndex(T),V=B.position.typedBuffer,H=B.position.typedBufferStride,te=B.normalCompressed.typedBuffer,U=B.normalCompressed.typedBufferStride;for(let t=1;t<p-1;++t){let r=D+t,i=M+t,a=ee+r,o=i*I,s=a*H,c=V[s]+k,l=V[s+1]+A,f=V[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*U;R[p]=te[y],R[p+1]=te[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 Z(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=te(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,ee=(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}},V=c??he,H=x[0],U=x[2],W=x[1],G=x[3],K=[G>V[3],U>V[2],W<V[1],H<V[0]],q=Math.max(H,V[0]),ne=Math.min(U,V[2]),re=Math.max(W,V[1]),J=Math.min(G,V[3]),Y=e=>Math.max(V[0],Math.min(V[2],e)),X=e=>Math.max(V[1],Math.min(V[3],e)),Z=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=Y(c[r===0||r===1?2:0]+o),d=X(c[r===0||r===3?3:1]+s),f=n.extent,p=Y(f[i===0||i===1?2:0]+o),m=X(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);ee(h,u,d,.5*(_+v),e)}else{let o=t??n,s=t?r:i,c=o.extent,u=se[e],d=Y(c[s===0||s===1?2:0]+u[0]*l),f=X(c[s===0||s===3?3:1]+u[1]*l),p=o.renderData,m=a(d,f,p.geometryState.samplerData);ee(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=K[c],r=K[y],o;if(n||r){let t=e(H*(1-b)+U*b,q,ne),n=e(W*(1-x)+G*x,re,J);o=a(t,n,l)}else o=ie(Q,t);k(b,x,o),Z(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;t.buffer()?.setSubData(o,s,s,o.length)}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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{fromValues as e,create as t}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import n from"../../../geometry/SpatialReference.js";import{projectVectorToVector as r}from"../../../geometry/projection/projectVectorToVector.js";import{wrap as i}from"../../../geometry/support/aaBoundingBox.js";import{create as a}from"../../../geometry/support/aaBoundingRect.js";import{isPlateCarree as o}from"../../../geometry/support/spatialReferenceUtils.js";import{sphereIntersectsInfiniteVerticalCylinderConservative as s}from"../support/ElevationAgnosticVisibility.js";import{createPlanarGlobePatch as c,updateEdgesAndCornersPlanar as l,updateEdgeElevationsAndResolutionsPlanar as u}from"./PatchGeometryFactory.js";import{Tile as d}from"./Tile.js";import{intersectAabbInvDirBefore as f}from"../webgl-engine/lib/RayIntersections.js";class p extends d{constructor(e,t,n,r,i){super(),this._horizontalScaleFactor=1,this._extentInRenderSR=a(),this._baseRadius=0,this._baseUsedMemory=900,this._subtreeGeometryElevationBoundMin=0,this._subtreeGeometryElevationBoundMax=0,this.init(e,t,n,r,i)}init(t,i,a,s,c){super.init(t,i,a,s,c);let l=c.view.renderSpatialReference,u=c.spatialReference,d=l!=null&&o(l)&&u!=null&&u.isGeographic?this.ellipsoid.radius*Math.PI/180:1;this._horizontalScaleFactor=d;let{isWebMercatorOnPlateCarree:f}=c,p=this._extentInRenderSR,m=this.extent;if(f){let t=e(m[0],m[1],0);r(t,n.WebMercator,t,n.PlateCarree);let i=e(m[2],m[3],0);r(i,n.WebMercator,i,n.PlateCarree),p[0]=t[0],p[1]=t[1],p[2]=i[0],p[3]=i[1]}else for(let e=0;e<4;++e)p[e]=m[e]*d;this.centerAtSeaLevel[0]=(p[0]+p[2])*.5,this.centerAtSeaLevel[1]=(p[1]+p[3])*.5,this.centerAtSeaLevel[2]=0,this._edgeLen=Math.max(p[2]-p[0],p[3]-p[1]),this._edgeLen2=this._edgeLen*this._edgeLen,this.updateRadiusAndCenter()}updateRadiusAndCenter(){this._updateCenter();let e=this._extentInRenderSR,t=(e[2]-e[0])*.5,n=(e[3]-e[1])*.5,r=Math.sqrt(t*t+n*n);this._baseRadius=r;let i=(this.elevationBoundsMax-this.elevationBoundsMin)*.5,a=Math.max(r,i);this._center[1].radius=a}_calculateFrustumVisibility(e,t){if(t!=null&&!s(this.centerAtSeaLevel,this._baseRadius,t.center,t.radius))return 2;let n=this._aabb(),r=e,i=n[0],a=n[1],o=n[2],c=n[3],l=n[4],u=n[5],d=!0;for(let e=0;e<6;e++){let t=r[e],n=t[0],s=t[1],f=t[2],p=t[3];if(n*(n>0?i:c)+s*(s>0?a:l)+f*(f>0?o:u)+p>=0)return 2;d&&=n*(n<0?i:c)+s*(s<0?a:l)+f*(f<0?o:u)+p<=0}return+!d}_aabb(){let e=this._extentInRenderSR;return i(e[0],e[1],Math.min(this.elevationBoundsMin,this._subtreeGeometryElevationBoundMin),e[2],e[3],Math.max(this.elevationBoundsMax,this._subtreeGeometryElevationBoundMax))}intersectsRay(e,t,n,r){return m[0]=1/t[0],m[1]=1/t[1],m[2]=1/t[2],f(this._aabb(),e,m,n,r)}createGeometry(){c(this.renderData),this._updateSubtreeGeometryElevationsBounds(),this.setMemoryDirty()}_updateSubtreeGeometryElevationsBounds(){let e=this._subtreeGeometryElevationBoundMin,t=this._subtreeGeometryElevationBoundMax,n=this.renderData,r=e,i=t;if(n){let e=n.geometry.boundingBox;r=e[2],i=e[5]}else if(!this.leaf){r=1/0,i=-1/0;for(let e of this.children){let t=e;r=Math.min(r,t._subtreeGeometryElevationBoundMin),i=Math.max(i,t._subtreeGeometryElevationBoundMax)}}(r!==this._subtreeGeometryElevationBoundMin||i!==this._subtreeGeometryElevationBoundMax)&&(this._subtreeGeometryElevationBoundMin=r,this._subtreeGeometryElevationBoundMax=i,this.updateVisibility(),this.parent?._updateSubtreeGeometryElevationsBounds())}get minimumVerticesPerSide(){return this.level<9?3:2}updateEdgeElevations(){l(this.renderData),this._updateSubtreeGeometryElevationsBounds()}updateEdgeElevationsAndResolutions(){u(this.renderData),this._updateSubtreeGeometryElevationsBounds()}get horizontalScale(){return this._horizontalScaleFactor}}const m=t();export{p as PlanarPatch};
|
|
2
|
+
import{fromValues as e,create as t}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import n from"../../../geometry/SpatialReference.js";import{projectVectorToVector as r}from"../../../geometry/projection/projectVectorToVector.js";import{wrap as i}from"../../../geometry/support/aaBoundingBox.js";import{create as a}from"../../../geometry/support/aaBoundingRect.js";import{isPlateCarree as o}from"../../../geometry/support/spatialReferenceUtils.js";import{sphereIntersectsInfiniteVerticalCylinderConservative as s}from"../support/ElevationAgnosticVisibility.js";import{createPlanarGlobePatch as c,updateEdgesAndCornersPlanar as l,updateEdgeElevationsAndResolutionsPlanar as u}from"./PatchGeometryFactory.js";import{Tile as d}from"./Tile.js";import{intersectAabbInvDirBefore as f}from"../webgl-engine/lib/RayIntersections.js";class p extends d{constructor(e,t,n,r,i){super(),this._horizontalScaleFactor=1,this._extentInRenderSR=a(),this._baseRadius=0,this._baseUsedMemory=900,this._subtreeGeometryElevationBoundMin=0,this._subtreeGeometryElevationBoundMax=0,this.init(e,t,n,r,i)}init(t,i,a,s,c){super.init(t,i,a,s,c);let l=c.view.renderSpatialReference,u=c.spatialReference,d=l!=null&&o(l)&&u!=null&&u.isGeographic?this.ellipsoid.radius*Math.PI/180:1;this._horizontalScaleFactor=d;let{isWebMercatorOnPlateCarree:f}=c,p=this._extentInRenderSR,m=this.extent;if(f){let t=e(m[0],m[1],0);r(t,n.WebMercator,t,n.PlateCarree);let i=e(m[2],m[3],0);r(i,n.WebMercator,i,n.PlateCarree),p[0]=t[0],p[1]=t[1],p[2]=i[0],p[3]=i[1]}else for(let e=0;e<4;++e)p[e]=m[e]*d;this.centerAtSeaLevel[0]=(p[0]+p[2])*.5,this.centerAtSeaLevel[1]=(p[1]+p[3])*.5,this.centerAtSeaLevel[2]=0,this._edgeLen=Math.max(p[2]-p[0],p[3]-p[1]),this._edgeLen2=this._edgeLen*this._edgeLen,this.updateRadiusAndCenter()}updateRadiusAndCenter(){this._updateCenter();let e=this._extentInRenderSR,t=(e[2]-e[0])*.5,n=(e[3]-e[1])*.5,r=Math.sqrt(t*t+n*n);this._baseRadius=r;let i=(this.elevationBoundsMax-this.elevationBoundsMin)*.5,a=Math.max(r,i);this._center[1].radius=a}_calculateFrustumVisibility(e,t){if(t!=null&&!s(this.centerAtSeaLevel,this._baseRadius,t.center,t.radius))return 2;let n=this._aabb(),r=e,i=n[0],a=n[1],o=n[2],c=n[3],l=n[4],u=n[5],d=!0;for(let e=0;e<6;e++){let t=r[e],n=t[0],s=t[1],f=t[2],p=t[3];if(n*(n>0?i:c)+s*(s>0?a:l)+f*(f>0?o:u)+p>=0)return 2;d&&=n*(n<0?i:c)+s*(s<0?a:l)+f*(f<0?o:u)+p<=0}return+!d}_aabb(){let e=this._extentInRenderSR;return i(e[0],e[1],Math.min(this.elevationBoundsMin,this._subtreeGeometryElevationBoundMin),e[2],e[3],Math.max(this.elevationBoundsMax,this._subtreeGeometryElevationBoundMax))}intersectsRay(e,t,n,r){return m[0]=1/t[0],m[1]=1/t[1],m[2]=1/t[2],f(this._aabb(),e,m,n,r)}createGeometry(){c(this.renderData),this._updateSubtreeGeometryElevationsBounds(),this.setMemoryDirty()}_updateSubtreeGeometryElevationsBounds(){let e=this._subtreeGeometryElevationBoundMin,t=this._subtreeGeometryElevationBoundMax,n=this.renderData,r=e,i=t;if(n){let e=n.geometry.boundingBox;r=e[2],i=e[5]}else if(!this.leaf){r=1/0,i=-1/0;for(let e of this.children){let t=e;r=Math.min(r,t._subtreeGeometryElevationBoundMin),i=Math.max(i,t._subtreeGeometryElevationBoundMax)}}(r!==this._subtreeGeometryElevationBoundMin||i!==this._subtreeGeometryElevationBoundMax)&&(this._subtreeGeometryElevationBoundMin=r,this._subtreeGeometryElevationBoundMax=i,this.updateVisibility(),this.parent?._updateSubtreeGeometryElevationsBounds())}get minimumVerticesPerSide(){return this.level<9?3:2}updateEdgeElevations(e=!1){l(this.renderData,e),this._updateSubtreeGeometryElevationsBounds()}updateEdgeElevationsAndResolutions(){u(this.renderData),this._updateSubtreeGeometryElevationsBounds()}get horizontalScale(){return this._horizontalScaleFactor}}const m=t();export{p as PlanarPatch};
|
|
@@ -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(){v(this.renderData)}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/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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{
|
|
2
|
+
import{set as e,length as t,normalize as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as i}from"../../../../geometry/support/DoubleArray.js";import{newPathVertex as a}from"./PathVertex.js";class o{constructor(e,t,n,o,s,c){this.numVertices=e,this.positionsES=n,this.offset=s,this.positions=c,this.directions=i((e-1)*3),this.frames=i(e*6),this.minSiblingLengths=i(e),this._tmpVertex=a(t);let l=e,u=Math.floor(l/2),d=this.offset+3*u,f=o[d],p=o[d+1],m=o[d+2];this.origin=r(f,p,m);let h=this.offset+l*3;for(let e=this.offset;e<h;e+=3)c[e]=o[e]-f,c[e+1]=o[e+1]-p,c[e+2]=o[e+2]-m;this.updatePathVertexInformation()}getVertex(e){let t=this._tmpVertex,n=(e-1)*3,r=Math.min(e,this.numVertices-2)*3,i=e*6;for(let a=0;a<3;++a)t.vLeft[a]=e===0?0:this.directions[n+a],t.vRight[a]=this.directions[r+a],t.frame.up[a]=this.frames[i+a],t.frame.right[a]=this.frames[i+3+a];return t.vMinSiblingLength=this.minSiblingLengths[e],t}setFrame(e,t,n){let r=e*6;for(let e=0;e<3;++e)this.frames[r+e]=t[e],this.frames[r+3+e]=n[e]}setFrameFromUpVector(e,t){let n=this.getVertex(e);n.setFrameFromUpVector(t),this.setFrame(e,n.frame.up,n.frame.right)}updatePathVertexInformation(){let{numVertices:r,positions:i,directions:a,minSiblingLengths:o}=this,s=this._tmpVertex.vRight,c=0;for(let l=0;l<r-1;++l){let r=this.offset+l*3;e(s,i[r+3]-i[r],i[r+4]-i[r+1],i[r+5]-i[r+2]);let u=t(s);o[l]=l===0?u:Math.min(c,u),c=u,n(s,s);for(let e=0;e<3;++e)a[l*3+e]=s[e]}o[r-1]=c}}export{o as Path};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{floatSubArray as e}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as t}from"../../../../geometry/support/HalfFloatArray.js";import{newIndexArray as n}from"../../../../geometry/support/Indices.js";import{newShortArray as r}from"../../../../geometry/support/ShortArray.js";import{pathNumProfilesPerJoin as i,pathNumJoinSubdivisions as a}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{compressNormal as o,encodeInt16 as s}from"./Normals.js";import{PathEvaluator as c}from"./PathEvaluator.js";import{encodePathVertexInfo as l}from"./PathVertexInfo.js";class u{constructor(o,s,l,u,d){this.path=o,this.profile=s,this.extruder=l,this.cap=u,this._extrusionVertexCount=0,this._extrusionFrameCount=0;let f=this.path.
|
|
2
|
+
import{floatSubArray as e}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as t}from"../../../../geometry/support/HalfFloatArray.js";import{newIndexArray as n}from"../../../../geometry/support/Indices.js";import{newShortArray as r}from"../../../../geometry/support/ShortArray.js";import{pathNumProfilesPerJoin as i,pathNumJoinSubdivisions as a}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{compressNormal as o,encodeInt16 as s}from"./Normals.js";import{PathEvaluator as c}from"./PathEvaluator.js";import{encodePathVertexInfo as l}from"./PathVertexInfo.js";class u{constructor(o,s,l,u,d){this.path=o,this.profile=s,this.extruder=l,this.cap=u,this._extrusionVertexCount=0,this._extrusionFrameCount=0;let f=this.path.numVertices-2;this.numExtrusionProfiles=i*f+2,this.numVerticesTotal=s.vertices.length*this.numExtrusionProfiles,this.numExtrusionFrames=this.path.numVertices;let p=this.cap.numVertices;this.startCapGeometryVertexOffset=this.numVerticesTotal,this.numVerticesTotal+=p,this.endCapGeometryVertexOffset=this.numVerticesTotal,this.numVerticesTotal+=p,this.profileRightAxes=r(this.numExtrusionFrames*2),this.profileUpAxes=r(this.numExtrusionFrames*2);let m=d===1;this.profileRotationFrameUpAxes=m?r(this.numExtrusionFrames*2):null,this.pathMaxStretchDistances=t(this.numExtrusionFrames),this.profileRotations=r(this.numExtrusionFrames),this.framePositionIndices=n(this.numExtrusionFrames),this.pathVertexInfos=new Uint32Array(this.numVerticesTotal),this.positions=e(o.positions,o.offset,o.numVertices*3);let h=l.join===2;this._numJoinTriangles=s.joinTriangleBudgets[d][l.join];let g=2*s.numSegments*(h?a:1);this._compressed=this._numJoinTriangles<g;let _=2*s.numSegments*(f+1)+this._numJoinTriangles*f;this.vertexIndices=n(_*3+2*this.cap.numIndices,this.numVerticesTotal),this._rebuildGeometry(),this._buildTopology(),this.evaluator=new c(this,s,l,u.type,d)}emitVertexDescriptor(e){let t=this._extrusionVertexCount;this.pathVertexInfos[t]=l(e),++this._extrusionVertexCount}emitExtrusionFrame(e,t){let{frame:n,rotationFrameUp:r,rotationAngle:i,maxStretchDistance:a}=e,c=this._extrusionFrameCount;return o(this.profileRightAxes,c,n.right[0],n.right[1],n.right[2]),o(this.profileUpAxes,c,n.up[0],n.up[1],n.up[2]),this.profileRotations[c]=s(i/Math.PI),this.profileRotationFrameUpAxes&&o(this.profileRotationFrameUpAxes,c,r[0],r[1],r[2]),this.pathMaxStretchDistances[c]=a,this.framePositionIndices[c]=t,this._extrusionFrameCount++}_rebuildGeometry(){this._extrusionVertexCount=0,this._extrusionFrameCount=0;let{path:e}=this,{numVertices:t}=e,{profile:n}=this;this._updatePositions();for(let n=0;n<t;++n)this.emitExtrusionFrame(e.getVertex(n),n);for(let e=0;e<n.vertices.length;++e)this.emitVertexDescriptor({frameIndex:0,sourceIndex:e,subdivision:0,type:1,capSide:0});let r=(e,t,n)=>{this.emitVertexDescriptor({frameIndex:e,sourceIndex:t,subdivision:n,type:0,capSide:0})};for(let e=1;e<t-1;++e)this.extruder.extrude(e,this.profile,r);let i=t-1;for(let e=0;e<n.vertices.length;++e)this.emitVertexDescriptor({frameIndex:i,sourceIndex:e,subdivision:0,type:1,capSide:1});this.cap.rebuildCapGeometry((e,t,n)=>this.emitVertexDescriptor({frameIndex:0,sourceIndex:e,subdivision:t,type:n,capSide:0})),this.cap.rebuildCapGeometry((e,t,n)=>this.emitVertexDescriptor({frameIndex:i,sourceIndex:e,subdivision:t,type:n,capSide:1}))}_updatePositions(){let{positions:e,offset:t,numVertices:n}=this.path;if(!Array.isArray(e))return;let r=n*3,i=this.positions;for(let n=0;n<r;++n)i[n]=e[t+n]}_buildTopology(){let e=this.profile.vertices.length*(this.numExtrusionProfiles-1),{vertexIndices:t}=this,n=0,r=(e,r,i)=>{t[n++]=e,t[n++]=r,t[n++]=i};this.extruder.buildTopology(this.path,this.profile,0,this.profileRotationFrameUpAxes!=null,this._compressed,this._numJoinTriangles,(e,t)=>{for(let n=0;n<this.profile.numSegments;++n){let i=this.profile.indices[n*2],a=this.profile.indices[n*2+1];r(e+i,t+i,t+a),r(e+i,t+a,e+a)}},r),this.cap.buildTopology(r,0,this.startCapGeometryVertexOffset,0),this.cap.buildTopology(r,1,this.endCapGeometryVertexOffset,e)}onPathChanged(){this._rebuildGeometry(),this._buildTopology()}}export{u as PathBuilder};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{pathNumProfilesPerJoin as t,pathNumJoinSubdivisions as n}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{constructPathRotationRight as r,needsJoinSubdivisions as i}from"./pathGeometryUtils.js";class a{constructor(e){this.join=e,this.cutoffAngle=this.join===0?.8*Math.PI:0}extrude(e,n,r){for(let i=0;i<t;++i)for(let t=0;t<n.vertices.length;++t)r(e,t,i)}buildTopology(e,t,n,r,i,a,o,s){i?this._buildCompressedTopology(e,t,n,r,a,o,s):this._buildFixedTopology(e,t,n,o)}_buildCompressedTopology(e,r,i,a,o,s,c){let l=r.vertices.length,u=this.join===2?n:1,d=Array(l).fill(!1),f=i;for(let i=1;i<e.
|
|
2
|
+
import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{pathNumProfilesPerJoin as t,pathNumJoinSubdivisions as n}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{constructPathRotationRight as r,needsJoinSubdivisions as i}from"./pathGeometryUtils.js";class a{constructor(e){this.join=e,this.cutoffAngle=this.join===0?.8*Math.PI:0}extrude(e,n,r){for(let i=0;i<t;++i)for(let t=0;t<n.vertices.length;++t)r(e,t,i)}buildTopology(e,t,n,r,i,a,o,s){i?this._buildCompressedTopology(e,t,n,r,a,o,s):this._buildFixedTopology(e,t,n,o)}_buildCompressedTopology(e,r,i,a,o,s,c){let l=r.vertices.length,u=this.join===2?n:1,d=Array(l).fill(!1),f=i;for(let i=1;i<e.numVertices-1;++i){let p=l*(1+(i-1)*t);s(f,p),this._classifyJoinVertices(e.getVertex(i),r,a,d);let m=o-r.indices.reduce((e,t)=>e+(d[t]?0:u),0);this._emitCompressedJoinTopology(r,p,d,c);for(let e=0;e<m;++e)c(p,p,p);f=p+n*l}let p=l*(1+(e.numVertices-2)*t);s(f,p)}_buildFixedTopology(e,r,i,a){let o=r.vertices.length,s=this.join===2,c=+!s,l=s?n:2,u=i;for(let r=1;r<e.numVertices-1;++r){let e=o*(1+(r-1)*t);a(u,e);for(let t=c;t<l;++t){let n=e+t*o;a(n,n+o)}u=e+n*o}let d=o*(1+(e.numVertices-2)*t);a(u,d)}_classifyJoinVertices(e,t,n,a){let s=e.rotationAngle,c=r(o,e.frame,e.rotationFrameUp,n);for(let e=0;e<a.length;++e){let n=t.vertices[e];a[e]=!i(n,c,s)}}_emitCompressedJoinTopology(e,t,r,i){let a=e.vertices.length,o=this.join===2,s=+!o,c=o?n:2;for(let n=0;n<e.numSegments;++n){let o=e.indices[n*2],l=e.indices[n*2+1];if(!(r[o]&&r[l]))for(let e=s;e<c;++e){let n=t+e*a,s=n+a,c=n+o,u=s+o,d=s+l,f=n+l;r[o]||i(c,u,d),r[l]||i(c,d,f)}}}}const o=e();export{a as PathExtruder};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{clamp as e}from"../../../../core/mathUtils.js";import{baseObjectMemory as t,
|
|
2
|
+
import{clamp as e}from"../../../../core/mathUtils.js";import{baseObjectMemory as t,integerArrayElementBytes as n,estimateArrayMemory as r}from"../../../../core/memoryEstimations.js";import{set as i,copy as a,exactEquals as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as s,clone as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as u,getZeroIndexArray as d}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as f}from"../../layers/graphics/olidUtils.js";import{Attribute as p}from"./Attribute.js";import{Geometry as m}from"./Geometry.js";import{pathVertexInfoPacking as h}from"./PathVertexInfo.js";import{createPositionReader as g}from"./PositionReader.js";class _ extends m{constructor(e,n,r,i){let{vertexIndices:a,framePositionIndices:o,numExtrusionFrames:c}=n,l=u(c),m=d(c),h=[[`position`,new p(n.positions,o,3,!0)],[`profileRight`,new p(n.profileRightAxes,l,2,!0)],[`profileUp`,new p(n.profileUpAxes,l,2,!0)],[`profileRotation`,new p(n.profileRotations,l,1,!0)],[`pathMaxStretchDistance`,new p(n.pathMaxStretchDistances,l,1,!0)],[`pathVertexInfo`,new p(n.pathVertexInfos,a,1,!0)]];n.profileRotationFrameUpAxes&&h.push([`pathRotationUp`,new p(n.profileRotationFrameUpAxes,l,2,!0)]),r.sizeAttributeValue!=null&&h.push([`sizeFeatureAttribute`,new p([r.sizeAttributeValue],m,1,!0)]),r.size!=null&&h.push([`size`,new p([...r.size],m,2,!0)]),r.colorAttributeValue!=null&&h.push([`colorFeatureAttribute`,new p([r.colorAttributeValue],m,1,!0)]),r.color!=null&&h.push([`color`,new p([...r.color],m,4,!0)]),r.opacityAttributeValue!=null&&h.push([`opacityFeatureAttribute`,new p([r.opacityAttributeValue],m,1,!0)]),r.opacity!=null&&h.push([`opacity`,new p([r.opacity],m,1,!0)]),i!=null&&f(h,i,m),super(e,h,null,0),this.builder=n,this.visualVariablesState=r,this._positionCacheMemory=0,this._lastSize=s(),this._usedMemory=3*t}computeBufferMemory(e){let t=super.computeBufferMemory(e),{builder:r}=this;t+=e.arrayMemory(r.framePositionIndices,n,!0),t+=e.arrayMemory(r.vertexIndices,n,!0);let{path:i}=r;t+=e.arrayMemory(i.positions)+e.arrayMemory(i.positionsES)+e.arrayMemory(i.origin),t+=e.arrayMemory(i.directions)+e.arrayMemory(i.frames)+e.arrayMemory(i.minSiblingLengths);let a=i.getVertex(0);return t+=e.arrayMemory(a.vLeft)+e.arrayMemory(a.vRight),t+=e.arrayMemory(a.frame.up)+e.arrayMemory(a.frame.right),t}get indexCount(){return this.attributes.get(`pathVertexInfo`)?.indices.length??0}get readPrimitivePosition(){if(this._invalidateOnSizeChange(),this._readPrimitivePosition==null){let{builder:e,size:t}=this,{vertexIndices:n,numVerticesTotal:i,evaluator:a}=e,o=l(i*3);for(let e=0;e<i;++e)a.evaluateVertexPosition(o,t,e,e);this._readPrimitivePosition=g(o,n,3),this._positionCacheMemory=r(o,8),this._usedMemory+=this._positionCacheMemory,this.notifyMemoryChange?.(this._positionCacheMemory)}return this._readPrimitivePosition}_invalidateReadPrimitivePosition(){super._invalidateReadPrimitivePosition();let e=this._positionCacheMemory;this._positionCacheMemory=0,this._usedMemory-=e,e&&this.notifyMemoryChange?.(-e)}onPathChanged(){this.builder.onPathChanged(),this.invalidateBoundingInfo(),i(this._lastSize,-1,-1),this._invalidateReadPrimitivePosition()}get size(){let{parameters:t}=this.material,n=c(t.size);if(t.vvSize){let{offset:r,factor:i,minSize:a,maxSize:o,fallback:s}=t.vvSize,c=this.visualVariablesState.sizeAttributeValue??NaN;Number.isNaN(c)?(n[0]*=s[0],n[1]*=s[2]):(n[0]*=e(r[0]+c*i[0],a[0],o[0]),n[1]*=e(r[2]+c*i[2],a[2],o[2]))}else t.hasPathSize&&this.visualVariablesState.size&&a(n,this.visualVariablesState.size);return n}_computePrimitivePositionIndices(){let e=this.attributes.get(`pathVertexInfo`),t=this.attributes.get(`position`);if(e&&t){let n=t.indices,r=e.indices,i=e.data,a=h.getField(0);return r.map(t=>n[a.get(i[e.stride*t])])}return t?.indices??null}get boundingInfo(){return this._invalidateOnSizeChange(),super.boundingInfo}_invalidateOnSizeChange(){let{size:e}=this;o(e,this._lastSize)||(a(this._lastSize,e),this.invalidateBoundingInfo(),this._invalidateReadPrimitivePosition())}}function v(e){return e instanceof _}export{_ as PathGeometry,v as isPathGeometry};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{
|
|
2
|
+
import{create as e,equals as t,copy as n}from"../../../../geometry/support/boundedPlane.js";const r=e();class i{constructor(){this._plane=e(),this._isDecoration=!0}get plane(){return this._plane}get isDecoration(){return this._isDecoration}update({plane:e,isDecoration:i}){let a=!1;return this._isDecoration!==i&&(this._isDecoration=i,a=!0),e??=r,t(e,this._plane)?a:(n(e,this._plane),!0)}}export{i as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/PooledArray.js";import{copy as t,lerp as n,squaredLength as r,dot as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
2
|
+
import e from"../../../../core/PooledArray.js";import{copy as t,lerp as n,squaredLength as r,dot as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as o,extrusionContainsPoint as s}from"../../../../geometry/support/boundedPlane.js";import{clipLineSegment as c,create as l,clipPolygon as u,fromValues as d}from"../../../../geometry/support/plane.js";function f(e){return(t,r,i)=>!s(e,n(b,t,r,i))}const p=new e({allocator:e=>e??a()}),m=new e({allocator:e=>e??a()});function*h(e,t){let n=t,r=p,i=m;for(let t of e){if(r.length=0,u(t,n,()=>r.pushNew(),!1),r.length>=3&&(yield r),r.length=0,u(t,n,()=>r.pushNew(),!0),r.length<3)return;n=r,[r,i]=[i,r]}}class g{constructor(e){this._lineRemainingA=y(),this._lineRemainingB=y(),this._lineVisible=y(),this._slicedAwayHalfspaces=_(e),this._slicePlane=o(e)}*processTriangle(e){yield*h(this._slicedAwayHalfspaces,e)}*processLineSegment(e,n,r){let i=this._lineRemainingA,a=this._lineRemainingB;t(i[0],n),t(i[1],r);for(let n of this._slicedAwayHalfspaces){if(c(n,i[0],i[1],this._lineVisible[0],this._lineVisible[1],!1)&&(t(e[0],this._lineVisible[0]),t(e[1],this._lineVisible[1]),yield e),!c(n,i[0],i[1],a[0],a[1],!0))return;[a,i]=[i,a]}}validatePoint(e){return!s(this._slicePlane,e)}}function _(e){let t=[l(e.plane),l(),l(),l(),l()];return v(e.basis1,e.origin,t[1],t[2]),v(e.basis2,e.origin,t[3],t[4]),t}function v(e,t,n,a){let o=r(e),s=i(e,t);d(e[0],e[1],e[2],-s+o,n),d(-e[0],-e[1],-e[2],s+o,a)}function y(){return[a(),a()]}const b=a();export{g as SliceScreenPolygonPrimitiveProcessor,h as clipPolygonAgainstSlicedAwayHalfspaces,_ as createSliceExtrusionHalfspacePlanes,f as sliceFilterPredicate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{set as e,exactEquals as t,dot as n,length as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{dot as a,scale as o,add as s,normalize as c,copy as l,set as u,length as d,cross as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as m,fromPositionAndNormal as h,intersectRay as g}from"../../../../geometry/support/plane.js";import{wrap as _}from"../../../../geometry/support/ray.js";import{makeOrthoBasisDirUpFallback as v}from"./GeometryUtil.js";function y(e,t){let n=
|
|
2
|
+
import{set as e,exactEquals as t,dot as n,length as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{dot as a,scale as o,add as s,normalize as c,copy as l,set as u,length as d,cross as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as m,fromPositionAndNormal as h,intersectRay as g}from"../../../../geometry/support/plane.js";import{wrap as _}from"../../../../geometry/support/ray.js";import{makeOrthoBasisDirUpFallback as v}from"./GeometryUtil.js";function y(e,t){let n=e.numVertices,r=.99619469809,i=p(),a=p(),o=p(),y=p(),b=p(),x=p(),S=m(),C=e.getVertex(0);l(a,t),u(i,0,1,0),v(C.vRight,a,i,i,o,a,r),e.setFrame(0,a,o);let T=e.positions,E=e.offset;for(let t=1;t<n;++t){C=e.getVertex(t),s(b,C.vLeft,C.vRight);let n=d(b);n>0?(n=1/Math.sqrt(n),b[0]*=n,b[1]*=n,b[2]*=n):(b[0]=C.vRight[0],b[1]=C.vRight[1],b[2]=C.vRight[2]),x[0]=T[E]+a[0],x[1]=T[E+1]+a[1],x[2]=T[E+2]+a[2],E+=3;let l=u(w,T[E],T[E+1],T[E+2]);h(l,b,S),g(S,_(x,C.vLeft),y)?(y[0]-=T[E],y[1]-=T[E+1],y[2]-=T[E+2],c(a,y),f(o,b,a),c(o,o)):v(b,a,o,i,o,a,r),e.setFrame(t,a,o)}}const b=.001;function x(t,n,r,i){if(!i)return e(t,1,0);let l=a(r,n.up),u=a(r,n.right);return o(w,n.right,l),o(T,n.up,-u),s(w,w,T),c(w,w),e(t,a(w,n.right),a(w,n.up))}function S(e,t,i,a=0){return n(e,t)*Math.sign(i)>=-a*r(e)}function C(e,n,r){return r!==0&&!t(e,i)&&S(e,n,r,b)}const w=p(),T=p();export{b as classificationTolerance,y as computeMinimumRotationTangentFrame,x as constructPathRotationRight,S as isOuterJoinVertex,C as needsJoinSubdivisions};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{set as e,dot as t,min as n,max as r,subtract as i,add as a,scale as o,projectAndScale as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as c,add as l,rotateZ as u,scale as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as f,ZEROS as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
2
|
+
import{set as e,dot as t,min as n,max as r,subtract as i,add as a,scale as o,projectAndScale as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as c,add as l,rotateZ as u,scale as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as f,ZEROS as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as m,updateUnboundedPlane as h}from"../../../../geometry/support/boundedPlane.js";import{sv2d as g}from"../../../../geometry/support/vectorStacks.js";import{MoveVertex as _}from"../operations/MoveVertex.js";import{RotateVertex as v}from"../operations/RotateVertex.js";import{ScaleVertex as y}from"../operations/ScaleVertex.js";import{UpdateVertices as b}from"../operations/UpdateVertices.js";function x(e,t){return C(e,t,!1)}function S(e,t){return C(e,t,!0)}function C(e,t,n){if(e instanceof b){if(e.operation instanceof _)return w(e.operation,t,n),!0;if(e.operation instanceof v)return T(e.operation,t,n),!0;if(e.operation instanceof y)return E(e.operation,t,n),!0}return!1}function w(e,t,n=!1){let r=n?-1:1,i=f(r*e.dx,r*e.dy,r*e.dz);l(t.origin,t.origin,i),h(t)}function T(e,t,n=!1){let r=n?-e.angle:e.angle;u(t.basis1,t.basis1,p,r),u(t.basis2,t.basis2,p,r),h(t)}function E(e,t,n=!1){let r=n?1/e.factor1:e.factor1,i=n?1/e.factor2:e.factor2;d(t.basis1,t.basis1,r),d(t.basis2,t.basis2,i),s(t.origin,t.origin,e.origin,e.axis1,r),s(t.origin,t.origin,e.origin,e.axis2,i),h(t)}function D(s,u,d,f,p=!1){f||=m();let _=e(g.get(),s[1],-s[0]),v=e(g.get(),1/0,1/0),y=e(g.get(),-1/0,-1/0),b=g.get(),x=u.allVerticesUnordered;x.forEach(({pos:i})=>{e(b,t(s,i),t(_,i)),n(v,v,b),r(y,y,b)});let S=1e-6,C=e(g.get(),y[0]-v[0]<S?d/2:0,y[1]-v[1]<S?d/2:0);i(v,v,C),a(y,y,C);let w=p?x.reduce((e,t)=>e+(t.pos[2]??0),0)/x.length:0;return o(f.basis1,s,(y[0]-v[0])/2),o(f.basis2,_,(y[1]-v[1])/2),c(f.origin,v[0]*s[0]+v[1]*_[0],v[0]*s[1]+v[1]*_[1],w),l(f.origin,f.origin,f.basis1),l(f.origin,f.origin,f.basis2),h(f),f}export{x as apply,S as applyInverse,D as calculateOrientedBounds};
|
|
@@ -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{isSome as n}from"../../../core/arrayUtils.js";import{destroyHandle as r}from"../../../core/handleUtils.js";import"../../../core/has.js";import{mapCollectionAsync as i}from"../../../core/mapCollectionUtils.js";import{allSettledValues as a,throwIfAborted as o,onAbort as s}from"../../../core/promiseUtils.js";import{watch as c,sync as l}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as u,getMetersPerVerticalUnitForSR as d}from"../../../core/units.js";import{property as f,subclass as p}from"../../../core/accessorSupport/decorators.js";import{squaredDistance as m}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as h,squaredDistance as g}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEpsilon as v}from"../../../core/libs/gl-matrix-2/math/common.js";import{UpdatingHandles as y}from"../../../core/support/UpdatingHandles.js";import{absoluteHeightElevationInfo as b}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as x,isLine as S,isDrapedLine as C}from"../sketch/constraints.js";import{fromAnyMapPoint as w,asVec2 as T,markAsTarget as E}from"../sketch/normalizedPoint.js";import{FeatureSnappingSourceInfo as D}from"./FeatureSnappingSourceInfo.js";import{sortCandidatesInPlace as O}from"./snappingUtils.js";import{DrapedEdgeSnappingCandidate as k}from"./candidates/DrapedEdgeSnappingCandidate.js";import{EdgeSnappingCandidate as A}from"./candidates/EdgeSnappingCandidate.js";import{FeatureSnappingCandidate as j}from"./candidates/FeatureSnappingCandidate.js";import{RightAngleSnappingCandidate as M}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as N}from"../support/viewUtils.js";import{screenDistance as P}from"../../../core/screenUtils.js";let F=class extends t{get updating(){return this._snappingSources.some(e=>e?.valid==null||e.valid===!0&&e.snappingSource?.updating===!0)||this._updatingHandles.updating}constructor(e){super(e),this.options=null,this._domain=1,this._updatingHandles=new y,this._sourceModules={featureService:{module:null,loader:null},featureCollection:{module:null,loader:null},graphics:{module:null,loader:null},notes:{module:null,loader:null},scene:{module:null,loader:null}}}initialize(){let e=i(()=>this.options?._effectiveFeatureSources,(e,t)=>this._createSourceInfo(e,t));this._snappingSources=e,this.addHandles([r(e),c(()=>({rulesEnabled:!!this.options?.attributeRulesEnabled,sources:this._snappingSources.filter(n)}),({rulesEnabled:e,sources:t})=>{for(let n of t)n.attributeRulesEnabled=e},l)])}destroy(){this._set(`options`,null),this._updatingHandles.destroy()}async fetchCandidates(e,t,n,r){if(!(t&this._domain)||this.options==null||!this.options.effectiveFeatureEnabled)return[];let i=[],s=this._computeScreenSizeDistanceParameters(e,n);for(let t of this._snappingSources){if(!t?.valid||!t.snappingSource?.layerSource?.enabled||t.layerView?.suspended)continue;let a=t.getFetchCandidatesParameters(e,n,s);for(let e of a)i.push(t.snappingSource.fetchCandidates(e,r).then(e=>this._processCandidatesFromSource(t,e,n)))}let c=(await a(i)).flat();return this._addRightAngleCandidates(c,e,s,n),o(r),O(e,c),c}_addRightAngleCandidates(e,t,n,r){let i=r.vertexHandle==null?r.editGeometryOperations!=null&&r.editGeometryOperations.data.type===`polygon`?r.editGeometryOperations.data.parts[0]?.getFirstVertex()?.pos:null:r.vertexHandle.rightSegment?.rightVertex?.pos,a=r.vertexHandle==null?r.editGeometryOperations
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{isSome as n}from"../../../core/arrayUtils.js";import{destroyHandle as r}from"../../../core/handleUtils.js";import"../../../core/has.js";import{mapCollectionAsync as i}from"../../../core/mapCollectionUtils.js";import{allSettledValues as a,throwIfAborted as o,onAbort as s}from"../../../core/promiseUtils.js";import{watch as c,sync as l}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as u,getMetersPerVerticalUnitForSR as d}from"../../../core/units.js";import{property as f,subclass as p}from"../../../core/accessorSupport/decorators.js";import{squaredDistance as m}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as h,squaredDistance as g}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEpsilon as v}from"../../../core/libs/gl-matrix-2/math/common.js";import{UpdatingHandles as y}from"../../../core/support/UpdatingHandles.js";import{absoluteHeightElevationInfo as b}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as x,isLine as S,isDrapedLine as C}from"../sketch/constraints.js";import{fromAnyMapPoint as w,asVec2 as T,markAsTarget as E}from"../sketch/normalizedPoint.js";import{FeatureSnappingSourceInfo as D}from"./FeatureSnappingSourceInfo.js";import{sortCandidatesInPlace as O}from"./snappingUtils.js";import{DrapedEdgeSnappingCandidate as k}from"./candidates/DrapedEdgeSnappingCandidate.js";import{EdgeSnappingCandidate as A}from"./candidates/EdgeSnappingCandidate.js";import{FeatureSnappingCandidate as j}from"./candidates/FeatureSnappingCandidate.js";import{RightAngleSnappingCandidate as M}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as N}from"../support/viewUtils.js";import{screenDistance as P}from"../../../core/screenUtils.js";let F=class extends t{get updating(){return this._snappingSources.some(e=>e?.valid==null||e.valid===!0&&e.snappingSource?.updating===!0)||this._updatingHandles.updating}constructor(e){super(e),this.options=null,this._domain=1,this._updatingHandles=new y,this._sourceModules={featureService:{module:null,loader:null},featureCollection:{module:null,loader:null},graphics:{module:null,loader:null},notes:{module:null,loader:null},scene:{module:null,loader:null}}}initialize(){let e=i(()=>this.options?._effectiveFeatureSources,(e,t)=>this._createSourceInfo(e,t));this._snappingSources=e,this.addHandles([r(e),c(()=>({rulesEnabled:!!this.options?.attributeRulesEnabled,sources:this._snappingSources.filter(n)}),({rulesEnabled:e,sources:t})=>{for(let n of t)n.attributeRulesEnabled=e},l)])}destroy(){this._set(`options`,null),this._updatingHandles.destroy()}async fetchCandidates(e,t,n,r){if(!(t&this._domain)||this.options==null||!this.options.effectiveFeatureEnabled)return[];let i=[],s=this._computeScreenSizeDistanceParameters(e,n);for(let t of this._snappingSources){if(!t?.valid||!t.snappingSource?.layerSource?.enabled||t.layerView?.suspended)continue;let a=t.getFetchCandidatesParameters(e,n,s);for(let e of a)i.push(t.snappingSource.fetchCandidates(e,r).then(e=>this._processCandidatesFromSource(t,e,n)))}let c=(await a(i)).flat();return this._addRightAngleCandidates(c,e,s,n),o(r),O(e,c),c}_addRightAngleCandidates(e,t,n,r){let i=r.vertexHandle==null?r.editGeometryOperations!=null&&r.editGeometryOperations.data.type===`polygon`?r.editGeometryOperations.data.parts[0]?.getFirstVertex()?.pos:null:r.vertexHandle.rightSegment?.rightVertex?.pos,a=r.vertexHandle==null?r.editGeometryOperations!=null&&(r.editGeometryOperations.data.type===`polyline`||r.editGeometryOperations.data.type===`polygon`)?r.editGeometryOperations.data.parts[0]?.getLastVertex()?.pos:null:r.vertexHandle.leftSegment?.leftVertex?.pos,{view:o}=this,s=w(i,o,r),c=w(a,o,r),l=e.length;for(let r=0;r<l;r++)this._addRightAngleCandidate(e[r],c,t,n,e),this._addRightAngleCandidate(e[r],s,t,n,e)}_addRightAngleCandidate(e,t,n,r,i){if(t==null||!I(e))return;let a=e.constraint.closestTo(t),o=(a[0]-n[0])/r.x,s=(a[1]-n[1])/r.y,{start:c,end:l}=e.constraint;if(o*o+s*s<=1){let n=m(T(a),T(c))>m(T(a),T(l))?c:l,r=new M({targetPoint:E(a),otherVertex:t,otherVertexType:0,previousVertex:n,constraint:new x(t,a),objectId:e.objectId,isDraped:e.isDraped,domain:1});i.push(r)}}_computeScreenSizeDistanceParameters(e,t){let n=this.options==null?0:this.options.distance*(t.pointer===`touch`?this.options.touchSensitivityMultiplier:1);return this.view==null?{x:n,y:n,z:n,distance:n}:this.view.type===`2d`?(n*=this.view.resolution,{x:n,y:n,z:n,distance:n}):this._computeScreenSizeDistanceParameters3D(e,n,this.view,t)}_computeScreenSizeDistanceParameters3D(e,t,n,r){let{spatialReference:i}=r;n.renderCoordsHelper.toRenderCoords(e,i,z);let a=n.state.camera.computeScreenPixelSizeAt(z),o=a*n.renderCoordsHelper.unitInMeters,s=o/u(i),c=o/d(i),l=t*s,f=t*c,p=N(e,i,b,n),m=p?R(p,e,s,0,0,n,r):0,h=p?R(p,e,0,s,0,n,r):0,g=p?R(p,e,0,0,c,n,r):0;return{x:m===0?0:l/m,y:h===0?0:l/h,z:g===0?0:f/g,distance:a*t}}_processCandidatesFromSource(e,t,n){let r=[];for(let i of t)e.snappingSource&&!this._candidateIsExcluded(e.snappingSource,i,n.excludeFeature)&&(i instanceof j&&(i.layer=e.layer),r.push(i));return r}_candidateIsExcluded(e,t,n){if(n==null)return!1;let r=this._getCandidateObjectId(t);if(r==null)return!1;let i=e.layerSource.layer;return i.type===`graphics`?n.uid===r:n.sourceLayer!==i||!n.attributes||!(`objectIdField`in i)?!1:n.attributes[i.objectIdField]===r}_getCandidateObjectId(e){return e instanceof j?e.objectId:null}async _createSourceInfo(e,t){let n=e.layer;n.loaded||(await n.load(),o(t));let{view:r}=this,i=await this._createFeatureSnappingSourceType(e,t);return o(t),i==null?new D({}):new D({snappingSource:i,view:r,layer:n})}_handleSourceAbort(e,t){let n=s(t,()=>e.destroy());return n&&e.addHandles(n),e}async _createFeatureSnappingSourceType(e,t){switch(e.layer.type){case`feature`:case`geojson`:case`csv`:case`oriented-imagery`:case`subtype-group`:case`wfs`:return this._createFeatureSnappingSourceFeatureLayer(e,t);case`graphics`:case`sketch`:return this._createFeatureSnappingSourceGraphicsLayer(e,t);case`map-notes`:return this._createFeatureSnappingSourceMapNotesLayer(e,t);case`scene`:case`building-scene`:return this._createFeatureSnappingSourceSceneLayer(e,t)}return null}async _createFeatureSnappingSourceSceneLayer(e,t){let{view:n}=this;if(n==null||n.type!==`3d`)return null;let r=await this._getSourceModule(`scene`);return o(t),this._handleSourceAbort(new r.SceneLayerSnappingSource({layerSource:e,view:n}),t)}async _createFeatureSnappingSourceFeatureLayer(e,t){switch(e.layer.source?.type){case`feature-layer`:case`oriented-imagery`:{let n=await this._getSourceModule(`featureService`);return o(t),this._handleSourceAbort(new n.FeatureServiceSnappingSource({spatialReference:this.spatialReference,view:this.view,layerSource:e}),t)}case`memory`:case`csv`:case`geojson`:case`wfs`:{if(e.layer.geometryType===`mesh`)return null;let n=await this._getSourceModule(`featureCollection`);return o(t),this._handleSourceAbort(new n.FeatureCollectionSnappingSource({layerSource:e,view:this.view}),t)}}return null}async _createFeatureSnappingSourceGraphicsLayer(e,t){let n=await this._getSourceModule(`graphics`);return o(t),this._handleSourceAbort(new n.GraphicsSnappingSource({getGraphicsLayers:()=>[e.layer],spatialReference:this.spatialReference,view:this.view,layerSource:e}),t)}async _createFeatureSnappingSourceMapNotesLayer(e,t){let n=await this._getSourceModule(`notes`);return o(t),this._handleSourceAbort(new n.GraphicsSnappingSource({getGraphicsLayers:()=>e.layer.sublayers?.toArray()??[],spatialReference:this.spatialReference,view:this.view,layerSource:e}),t)}async _getSourceModule(e){let t=this._sourceModules[e];if(t.loader==null){let t=this._loadSourceModule(e),n={module:null,loader:t};this._sourceModules[e]=n;let r=await t,i={module:r,loader:t};return this._sourceModules[e]=i,r}return t.module==null?t.loader:t.module}_loadSourceModule(e){let t=this._updatingHandles;switch(e){case`featureService`:return t.addPromise(import(`./featureSources/FeatureServiceSnappingSource.js`));case`featureCollection`:return t.addPromise(import(`./featureSources/FeatureCollectionSnappingSource.js`));case`graphics`:return t.addPromise(import(`./featureSources/GraphicsSnappingSource.js`));case`notes`:return t.addPromise(import(`./featureSources/GraphicsSnappingSource.js`));case`scene`:return t.addPromise(import(`./featureSources/SceneLayerSnappingSource.js`))}}get test(){}};e([f({constructOnly:!0})],F.prototype,`spatialReference`,void 0),e([f({constructOnly:!0})],F.prototype,`view`,void 0),e([f()],F.prototype,`options`,void 0),e([f({readOnly:!0})],F.prototype,`updating`,null),e([f()],F.prototype,`_snappingSources`,void 0),F=e([p(`esri.views.interactive.snapping.FeatureSnappingEngine`)],F);function I(e){let t=e instanceof A||e instanceof k,n=S(e.constraint)||C(e.constraint);return t&&n&&!L(e.constraint)}function L({start:e,end:t}){let n=g(e,t),r=m(T(e),T(t));return n<v()||r/n<V}function R(e,t,n,r,i,a,{spatialReference:o}){let s=h(B,t);s[0]+=n,s[1]+=r,s[2]+=i;let c=N(s,o,b,a);return c?P(c,e):1/0}const z=_(),B=_(),V=1e-4;export{F as FeatureSnappingEngine};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{set as e}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as t}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
2
|
+
import{set as e}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as t}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromAABoundingRect as n,distance as r,create as i}from"../../../../../geometry/support/boundedPlane.js";function a(t,i){return n(i.extent,o),r(o,e(s,t.x,t.y,0))}const o=i(),s=t();export{a as distanceToTile};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{getBasisEncoder as e,destroyBasisEncoder as t}from"../../libs/basisu/BasisUEncoder.js";import{getDXTEncoder as n,destroyDXTEncoder as r}from"../../libs/dxtEncoder/DXTEncoder.js";import{CompressedTextureFormat as i}from"../webgl/enums.js";let a=null,o,s=null,c;class l{constructor(e,t){this.internalFormat=e,this.compressedTexture=t}}function u(){a=null,o=null,s=null,c=null,t(),r()}async function d(e){let t=e.data instanceof ImageBitmap?e.data:null,n;n=e.data instanceof ImageBitmap?g(e.data):_(e.data,e.width,e.height,e.components,e.needsFlip);try{let t=e.preMultiplyAlpha&&!e.isOpaque;if(e.hasS3TC){s||await p();let r=s?.encode(n,e.width,e.height,t);if(r){let e=S(r,!0),t=[r.buffer];return{result:new l(e?.internalFormat??null,e?.textureData??null),transferList:t}}return{result:new l(null,null)}}if(e.hasETC){if(a||await f(),t&&!s&&await p(),t){let t=new Uint8ClampedArray(n.length);s?.premultiply(new Uint8Array(n),e.width,e.height,t),n=t}let r=m(n,e.width,e.height,e.hasMipmap,void 0,void 0,!1,!1,e.isOpaque),i=r?h(r):null,o=i?.compressedTexture?.levels.map(e=>e.buffer)||[];return{result:new l(i?.internalFormat??null,i?.compressedTexture??null),transferList:o}}return{result:new l(null,null)}}finally{t?.close()}}async function f(){a||(a=await(o??=e()),o=null)}async function p(){s||(s=await(c??=n()),c=null)}function m(e,t,n,r,i=255,o=0,s=!1,c=!1,l=!1){if(!a)return null;let u=new a.BasisEncoder;u.setPerceptual(!c),u.setCheckForAlpha(!l),u.setForceAlpha(!1),u.setRenormalize(c),u.setMipGen(r),u.setMipSRGB(!c),u.setCreateKTX2File(!0),u.setKTX2AndBasisSRGBTransferFunc(!c),u.setQualityLevel(i),u.setETC1SCompressionLevel(o);let d=new Uint8Array(e.byteLength);try{u.setSliceSourceImage(0,new Uint8Array(e),t,n,s);let r=u.encode(d);if(!r)return null;let i=new Uint8Array(d.buffer,0,r),o=new a.KTX2File(new Uint8Array(i));try{if(!o.isValid())return null}finally{o.close(),o.delete()}return i}finally{u.delete()}}function h(e){if(!a)return new l(null,null);let t=new a.KTX2File(new Uint8Array(e));try{if(!t.startTranscoding())return new l(null,null);let[e,n]=t.getHasAlpha()?[1,i.COMPRESSED_RGBA8_ETC2_EAC]:[0,i.COMPRESSED_RGB8_ETC2],r=t.getLevels(),a=[];for(let n=0;n<r;n++){let r=new Uint8Array(t.getImageTranscodedSizeInBytes(n,0,0,e));if(!t.transcodeImage(r,n,0,0,e,0,-1,-1))return new l(null,null);a.push(r)}return{internalFormat:n,compressedTexture:{type:`compressed`,levels:a}}}finally{t.close(),t.delete()}}function g(e){let t=new OffscreenCanvas(e.width,e.height),n=t.getContext(`2d
|
|
2
|
+
import{getBasisEncoder as e,destroyBasisEncoder as t}from"../../libs/basisu/BasisUEncoder.js";import{getDXTEncoder as n,destroyDXTEncoder as r}from"../../libs/dxtEncoder/DXTEncoder.js";import{CompressedTextureFormat as i}from"../webgl/enums.js";let a=null,o,s=null,c;class l{constructor(e,t){this.internalFormat=e,this.compressedTexture=t}}function u(){a=null,o=null,s=null,c=null,t(),r()}async function d(e){let t=e.data instanceof ImageBitmap?e.data:null,n;n=e.data instanceof ImageBitmap?g(e.data):_(e.data,e.width,e.height,e.components,e.needsFlip);try{let t=e.preMultiplyAlpha&&!e.isOpaque;if(e.hasS3TC){s||await p();let r=s?.encode(n,e.width,e.height,t);if(r){let e=S(r,!0),t=[r.buffer];return{result:new l(e?.internalFormat??null,e?.textureData??null),transferList:t}}return{result:new l(null,null)}}if(e.hasETC){if(a||await f(),t&&!s&&await p(),t){let t=new Uint8ClampedArray(n.length);s?.premultiply(new Uint8Array(n),e.width,e.height,t),n=t}let r=m(n,e.width,e.height,e.hasMipmap,void 0,void 0,!1,!1,e.isOpaque),i=r?h(r):null,o=i?.compressedTexture?.levels.map(e=>e.buffer)||[];return{result:new l(i?.internalFormat??null,i?.compressedTexture??null),transferList:o}}return{result:new l(null,null)}}finally{t?.close()}}async function f(){a||(a=await(o??=e()),o=null)}async function p(){s||(s=await(c??=n()),c=null)}function m(e,t,n,r,i=255,o=0,s=!1,c=!1,l=!1){if(!a)return null;let u=new a.BasisEncoder;u.setPerceptual(!c),u.setCheckForAlpha(!l),u.setForceAlpha(!1),u.setRenormalize(c),u.setMipGen(r),u.setMipSRGB(!c),u.setCreateKTX2File(!0),u.setKTX2AndBasisSRGBTransferFunc(!c),u.setQualityLevel(i),u.setETC1SCompressionLevel(o);let d=new Uint8Array(e.byteLength);try{u.setSliceSourceImage(0,new Uint8Array(e),t,n,s);let r=u.encode(d);if(!r)return null;let i=new Uint8Array(d.buffer,0,r),o=new a.KTX2File(new Uint8Array(i));try{if(!o.isValid())return null}finally{o.close(),o.delete()}return i}finally{u.delete()}}function h(e){if(!a)return new l(null,null);let t=new a.KTX2File(new Uint8Array(e));try{if(!t.startTranscoding())return new l(null,null);let[e,n]=t.getHasAlpha()?[1,i.COMPRESSED_RGBA8_ETC2_EAC]:[0,i.COMPRESSED_RGB8_ETC2],r=t.getLevels(),a=[];for(let n=0;n<r;n++){let r=new Uint8Array(t.getImageTranscodedSizeInBytes(n,0,0,e));if(!t.transcodeImage(r,n,0,0,e,0,-1,-1))return new l(null,null);a.push(r)}return{internalFormat:n,compressedTexture:{type:`compressed`,levels:a}}}finally{t.close(),t.delete()}}function g(e){let t=new OffscreenCanvas(e.width,e.height),n=t.getContext(`2d`,{willReadFrequently:!0});return n.drawImage(e,0,0),n.getImageData(0,0,t.width,t.height).data}function _(e,t,n,r,i){let a=new Uint8ClampedArray(e).subarray(0,t*n*r);if(!i)return a;let o=new Uint8ClampedArray(a.length),s=t*r;for(let e=0;e<n;e++){let t=e*s,r=(n-e-1)*s;o.set(a.subarray(t,t+s),r)}return o}function v(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}const y=v(`DXT1`),b=v(`DXT3`),x=v(`DXT5`);function S(e,t){let n=new Int32Array(e.buffer,e.byteOffset,31),r=n[21],a,o;switch(r){case y:a=8,o=i.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case b:a=16,o=i.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case x:a=16,o=i.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return null}let s=1,c=n[4],l=n[3];(c&3||l&3)&&(c=c+3&-4,l=l+3&-4);let u=c,d=l;n[2]&131072&&t!==!1&&(s=Math.max(1,n[7]));let f,p,m=e.byteOffset+n[1]+4,h=[];for(let t=0;t<s;++t)p=(c+3>>2)*(l+3>>2)*a,f=new Uint8Array(e.buffer,m,p),h.push(f),m+=p,c=Math.max(1,c>>1),l=Math.max(1,l>>1);return{textureData:{type:`compressed`,levels:h},internalFormat:o,width:u,height:d}}export{l as TextureCompressionWorkerOutput,d as compress,m as compressRGBADataToKTX2,h as createTextureDataKTX2,u as destroy,f as initializeBasisEncoder,p as initializeDXTEncoder};
|
package/views/webgl/Texture.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import has from"../../core/has.js";import t from"../../core/Logger.js";import{abortMaybe as n}from"../../core/maybe.js";import{hasValue as r}from"../../core/object.js";import{throwIfAborted as i,isAbortError as a}from"../../core/promiseUtils.js";import{checkWebGLError as o}from"./checkWebGLError.js";import{ResourceType as s,CompressedTextureFormat as c}from"./enums.js";import{estimateMemory as l}from"./TextureDescriptor.js";import{isCompressedData as u,deriveInternalFormat as d,isTexImageSource as f,is3DTarget as p,validateTexture as m,isCompressedFormat as h,getDimensions as g,isSizedPixelFormat as _,calcMipmapLevels as v}from"./textureUtils.js";import{ValidatedTextureDescriptor as y}from"./ValidatedTextureDescriptor.js";const b=!!has(`esri-tests-disable-gpu-memory-measurements`),x=()=>t.getLogger(`esri/views/webgl/Texture`);class S{static{this.TEXTURE_UNIT_FOR_UPDATES=0}static{this.compressionWorkerHandle=null}constructor(t,n=null,r=null){if(this.type=1,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._shadowFilterDirty=!1,this._wasImmutablyAllocated=!1,`context`in t)this._descriptor=t,r=n;else{let r=y.validate(t,n);if(!r)throw new e(`texture:invalid-descriptor`,`Texture descriptor invalid`);this._descriptor=r}this._descriptor.target===34067?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get usedMemory(){return b?0:l(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty||this._shadowFilterDirty}get hasWebGLTextureObject(){return!!this._glName}dispose(){this.abortCompression(),this.hasWebGLTextureObject&&this._descriptor.context?.gl&&(this._descriptor.context.instanceCounter.decrement(s.Texture,this),this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null)}release(){this.dispose()}[Symbol.dispose](){this.dispose()}resize(t,n){let r=this._descriptor;if(r.width!==t||r.height!==n){if(this._wasImmutablyAllocated)throw new e(`texture:immutable-resize`,`Immutable textures can't be resized!`);r.width=t,r.height=n,this._descriptor.target===34067?this._setDataCubeMap(null):this.setData(null)}}enableCompression(e){this._descriptor.compress=e}disableCompression(){this._descriptor.compress=void 0}setData(e){this.abortCompression(),!u(e)&&this._descriptor.internalFormat&&r(c,this._descriptor.internalFormat)&&(this._descriptor.internalFormat=void 0),this._setData(e),!u(e)&&this._descriptor.compress&&this._compressOnWorker(e)}updateData(t,n,r,i,a,o,s=0){o||x().error(`An attempt to use uninitialized data!`),this.hasWebGLTextureObject||x().error(`An attempt to update uninitialized texture!`);let c=this._descriptor;c.internalFormat=d(c);let{context:l,pixelFormat:p,dataType:m,target:h,isImmutable:g}=c;if(g&&!this._wasImmutablyAllocated)throw new e(`texture:uninitialized`,`Cannot update immutable texture before allocation!`);let _=l.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES,!0);(n<0||r<0||n+i>c.width||r+a>c.height)&&x().error(`An attempt to update out of bounds of the texture!`),this._configurePixelStorage();let{gl:v}=l;s&&(i&&a||x().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),v.pixelStorei(v.UNPACK_SKIP_ROWS,s)),f(o)?v.texSubImage2D(h,t,n,r,i,a,p,m,o):u(o)?v.compressedTexSubImage2D(h,t,n,r,i,a,c.internalFormat,o.levels[t]):v.texSubImage2D(h,t,n,r,i,a,p,m,o),s&&v.pixelStorei(v.UNPACK_SKIP_ROWS,0),l.bindTexture(_,S.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(t,n,r,i,a,o,s,c){c||x().error(`An attempt to use uninitialized data!`),this.hasWebGLTextureObject||x().error(`An attempt to update an uninitialized texture!`);let l=this._descriptor;l.internalFormat=d(l);let{context:f,pixelFormat:m,dataType:h,isImmutable:g,target:_}=l;if(g&&!this._wasImmutablyAllocated)throw new e(`texture:uninitialized`,`Cannot update immutable texture before allocation!`);p(_)||x().warn(`Attempting to set 3D texture data on a non-3D texture`);let v=f.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES);f.setActiveTexture(S.TEXTURE_UNIT_FOR_UPDATES),(n<0||r<0||i<0||n+a>l.width||r+o>l.height||i+s>l.depth)&&x().error(`An attempt to update out of bounds of the texture!`),this._configurePixelStorage();let{gl:y}=f;if(u(c))c=c.levels[t],y.compressedTexSubImage3D(_,t,n,r,i,a,o,s,l.internalFormat,c);else{let e=c;y.texSubImage3D(_,t,n,r,i,a,o,s,m,h,e)}f.bindTexture(v,S.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){let t=this._descriptor;if(t.width===0||t.height===0)return;if(!t.hasMipmap){if(this._wasImmutablyAllocated)throw new e(`texture:immutable-change`,`Cannot add mipmaps to immutable texture after allocation`);t.hasMipmap=!0,this._samplingModeDirty=!0,m(t)}t.samplingMode===9729?(this._samplingModeDirty=!0,t.samplingMode=9985):t.samplingMode===9728&&(this._samplingModeDirty=!0,t.samplingMode=9984);let n=this._descriptor.context.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(S.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(t.target),this._descriptor.context.bindTexture(n,S.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){let t=this._descriptor;if(t.hasMipmap){if(this._wasImmutablyAllocated)throw new e(`texture:immutable-change`,`Cannot delete mipmaps to immutable texture after allocation`);t.hasMipmap=!1,this._samplingModeDirty=!0,m(t)}t.samplingMode===9985?(this._samplingModeDirty=!0,t.samplingMode=9729):t.samplingMode===9984&&(this._samplingModeDirty=!0,t.samplingMode=9728)}setSamplingMode(e){e!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=e,this._samplingModeDirty=!0)}setWrapMode(e){e!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=e,m(this._descriptor),this._wrapModeDirty=!0)}setShadowFiltering(e){e!==this._descriptor.linearFilterDepth&&(this._descriptor.linearFilterDepth=this._descriptor.compareEnabled=e,this.setSamplingMode(e?9729:9728),m(this._descriptor),this._shadowFilterDirty=!0)}applyChanges(){this._samplingModeDirty&&=(this._applySamplingMode(),!1),this._wrapModeDirty&&=(this._applyWrapMode(),!1),this._shadowFilterDirty&&=(this._applyShadowMode(),!1)}abortCompression(){this._compressionAbortController=n(this._compressionAbortController)}_setData(t,n){let r=this._descriptor,i=r.context?.gl;if(!i)return;o(i),this.hasWebGLTextureObject||(this._glName=i.createTexture(),r.context.instanceCounter.increment(s.Texture,this)),m(r);let a=r.context.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES);r.context.setActiveTexture(S.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),o(i);let c=n??r.target,l=p(c);if(f(t))this._setDataFromTexImageSource(t,c);else{let{width:n,height:a,depth:s}=r;if(n==null||a==null)throw new e(`texture:missing-size`,`Width and height must be specified!`);if(l&&s==null)throw new e(`texture:missing-depth`,`Depth must be specified!`);if(r.internalFormat=d(r),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(c,r.internalFormat,r.hasMipmap,n,a,s),u(t)){if(!h(r.internalFormat))throw new e(`texture:format-mismatch`,`Attempting to use compressed data with an uncompressed format!`);this._setDataFromCompressedSource(t,r.internalFormat,c)}else this._texImage(c,0,r.internalFormat,n,a,s,t),o(i),r.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),this._applyShadowMode(),o(i),r.context.bindTexture(a,S.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(e=null){for(let t=34069;t<=34074;t++)this._setData(e,t)}_configurePixelStorage(){let e=this._descriptor.context.gl,{unpackAlignment:t,flipped:n,preMultiplyAlpha:r}=this._descriptor;e.pixelStorei(e.UNPACK_ALIGNMENT,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,+!!n),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,+!!r)}_setDataFromTexImageSource(e,t){let{gl:n}=this._descriptor.context,r=this._descriptor;r.internalFormat=d(r);let i=p(t),{width:a,height:s,depth:c}=g(e);r.width&&r.height,r.width||=a,r.height||=s,i&&r.depth,i&&(r.depth=c),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(t,r.internalFormat,r.hasMipmap,a,s,c),this._texImage(t,0,r.internalFormat,a,s,c,e),o(n),r.hasMipmap&&(this.generateMipmap(),o(n))}_setDataFromCompressedSource(e,t,n){let r=this._descriptor,{width:i,height:a,depth:o}=r,s=e.levels,c=v(n,i,a,o),l=Math.min(c,s.length)-1;this._descriptor.context.gl.texParameteri(r.target,33085,l),this._forEachMipmapLevel((e,r,i,a)=>{let o=s[Math.min(e,s.length-1)];this._compressedTexImage(n,e,t,r,i,a,o)},l)}_texStorage(t,n,r,i,a,o){let{gl:s}=this._descriptor.context;if(!_(n)&&!h(n))throw new e(`texture:missing-format`,`Immutable textures must have a sized or compressed internal format`);if(!this._descriptor.isImmutable)return;let c=r?v(t,i,a,o):1;if(p(t)){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);s.texStorage3D(t,c,n,i,a,o)}else s.texStorage2D(t,c,n,i,a);this._wasImmutablyAllocated=!0}_texImage(t,n,r,i,a,o,s){let c=this._descriptor.context.gl,l=p(t),{isImmutable:u,pixelFormat:d,dataType:f}=this._descriptor;if(u){if(s!=null){let r=s;if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.texSubImage3D(t,n,0,0,0,i,a,o,d,f,r)}else c.texSubImage2D(t,n,0,0,i,a,d,f,r)}}else{let u=s;if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.texImage3D(t,n,r,i,a,o,0,d,f,u)}else c.texImage2D(t,n,r,i,a,0,d,f,u)}}_compressedTexImage(t,n,r,i,a,o,s){let c=this._descriptor.context.gl,l=p(t);if(this._descriptor.isImmutable){if(s!=null){if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.compressedTexSubImage3D(t,n,0,0,0,i,a,o,r,s)}else c.compressedTexSubImage2D(t,n,0,0,i,a,r,s)}}else if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.compressedTexImage3D(t,n,r,i,a,o,0,s)}else c.compressedTexImage2D(t,n,r,i,a,0,s)}async _compressOnWorker(e){let{width:t,height:n,context:r,flipped:o,preMultiplyAlpha:s,hasMipmap:c,compress:l}=this._descriptor;if(!l)return;let{compressionTracker:u,compressionCallback:d,preserveSourceBitmap:f}=l,{compressedTextureETC:p,compressedTextureS3TC:m}=r.capabilities;if(!S.compressionWorkerHandle?.isCompressible(e,this._descriptor)||!p&&!m)return;this.abortCompression();let h=new AbortController;this._compressionAbortController=h,u?.increment();let g,_=!1,v=!1;try{e instanceof ImageBitmap?f?(g=await createImageBitmap(e),i(h),v=!0):g=e:e instanceof Uint8Array?(g=e.buffer,_=this.descriptor.flipped):(g=await createImageBitmap(e,{imageOrientation:o?`flipY`:`none`}),i(h),v=!0);let r={data:g,width:t,height:n,needsFlip:_,components:this._descriptor.pixelFormat===6408?4:3,preMultiplyAlpha:s,isOpaque:this._descriptor.isOpaque,hasMipmap:c,hasETC:!!p,hasS3TC:!!m},a=await S.compressionWorkerHandle.invoke(r,h.signal,1);if(i(h),a.compressedTexture&&this.hasWebGLTextureObject){let e=this.usedMemory;this._descriptor.internalFormat=a.internalFormat,this._setData(a.compressedTexture),d?.(e-this.usedMemory)}}catch(e){a(e)||x().error(`Texture compression failed!`)}finally{u?.decrement(),this._compressionAbortController?.signal.aborted&&(this._compressionAbortController=null),v&&g instanceof ImageBitmap&&g.close()}}_forEachMipmapLevel(t,n=1/0){let{width:r,height:i,depth:a,hasMipmap:o,target:s}=this._descriptor,c=s===32879;if(r==null||i==null||c&&a==null)throw new e(`texture:missing-size`,`Missing texture dimensions for mipmap calculation`);for(let e=0;t(e,r,i,a),!(!o||r===1&&i===1&&(!c||a===1)||e>=n);++e)r=Math.max(1,r>>1),i=Math.max(1,i>>1),c&&(a=Math.max(1,a>>1))}_applySamplingMode(){let e=this._descriptor,t=e.context?.gl,n=e.samplingMode,r=e.samplingMode;n===9985||n===9987?(n=9729,e.hasMipmap||(r=9729)):(n===9984||n===9986)&&(n=9728,e.hasMipmap||(r=9728)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,n),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,r)}_applyWrapMode(){let e=this._descriptor,t=e.context?.gl;typeof e.wrapMode==`number`?(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode)):(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode.s),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode.t))}_applyShadowMode(){let e=this._descriptor,t=e.context?.gl,n=e.compareEnabled?t.COMPARE_REF_TO_TEXTURE:t.NONE;t.texParameteri(e.target,t.TEXTURE_COMPARE_MODE,n),e.compareEnabled&&t.texParameteri(e.target,t.TEXTURE_COMPARE_FUNC,t.GREATER),o(t)}_applyAnisotropicFilteringParameters(){let e=this._descriptor,t=e.context.capabilities.textureFilterAnisotropic;t&&e.context.gl.texParameterf(e.target,t.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}}export{S as default};
|
|
2
|
+
import e from"../../core/Error.js";import has from"../../core/has.js";import t from"../../core/Logger.js";import{abortMaybe as n}from"../../core/maybe.js";import{hasValue as r}from"../../core/object.js";import{throwIfAborted as i,isAbortError as a}from"../../core/promiseUtils.js";import{checkWebGLError as o}from"./checkWebGLError.js";import{ResourceType as s,CompressedTextureFormat as c}from"./enums.js";import{estimateMemory as l}from"./TextureDescriptor.js";import{isCompressedData as u,deriveInternalFormat as d,isTexImageSource as f,is3DTarget as p,validateTexture as m,isCompressedFormat as h,getDimensions as g,isSizedPixelFormat as _,calcMipmapLevels as v}from"./textureUtils.js";import{ValidatedTextureDescriptor as y}from"./ValidatedTextureDescriptor.js";const b=!!has(`esri-tests-disable-gpu-memory-measurements`),x=()=>t.getLogger(`esri/views/webgl/Texture`);class S{static{this.TEXTURE_UNIT_FOR_UPDATES=0}static{this.compressionWorkerHandle=null}constructor(t,n=null,r=null){if(this.type=1,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._shadowFilterDirty=!1,this._wasImmutablyAllocated=!1,`context`in t)this._descriptor=t,r=n;else{let r=y.validate(t,n);if(!r)throw new e(`texture:invalid-descriptor`,`Texture descriptor invalid`);this._descriptor=r}this._descriptor.target===34067?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get usedMemory(){return b?0:l(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty||this._shadowFilterDirty}get hasWebGLTextureObject(){return!!this._glName}dispose(){this.abortCompression(),this.hasWebGLTextureObject&&this._descriptor.context?.gl&&(this._descriptor.context.instanceCounter.decrement(s.Texture,this),this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null)}release(){this.dispose()}[Symbol.dispose](){this.dispose()}resize(t,n){let r=this._descriptor;if(r.width!==t||r.height!==n){if(this._wasImmutablyAllocated)throw new e(`texture:immutable-resize`,`Immutable textures can't be resized!`);r.width=t,r.height=n,this._descriptor.target===34067?this._setDataCubeMap(null):this.setData(null)}}enableCompression(e){this._descriptor.compress=e}disableCompression(){this._descriptor.compress=void 0}setData(e){this.abortCompression(),!u(e)&&this._descriptor.internalFormat&&r(c,this._descriptor.internalFormat)&&(this._descriptor.internalFormat=void 0),this._setData(e),!u(e)&&this._descriptor.compress&&this._compressOnWorker(e)}updateData(t,n,r,i,a,o,s=0){o||x().error(`An attempt to use uninitialized data!`),this.hasWebGLTextureObject||x().error(`An attempt to update uninitialized texture!`);let c=this._descriptor;c.internalFormat=d(c);let{context:l,pixelFormat:p,dataType:m,target:h,isImmutable:g}=c;if(g&&!this._wasImmutablyAllocated)throw new e(`texture:uninitialized`,`Cannot update immutable texture before allocation!`);let _=l.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES,!0);(n<0||r<0||n+i>c.width||r+a>c.height)&&x().error(`An attempt to update out of bounds of the texture!`),this._configurePixelStorage();let{gl:v}=l;s&&(i&&a||x().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),v.pixelStorei(v.UNPACK_SKIP_ROWS,s)),f(o)?v.texSubImage2D(h,t,n,r,i,a,p,m,o):u(o)?v.compressedTexSubImage2D(h,t,n,r,i,a,c.internalFormat,o.levels[t]):v.texSubImage2D(h,t,n,r,i,a,p,m,o),s&&v.pixelStorei(v.UNPACK_SKIP_ROWS,0),l.bindTexture(_,S.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(t,n,r,i,a,o,s,c){c||x().error(`An attempt to use uninitialized data!`),this.hasWebGLTextureObject||x().error(`An attempt to update an uninitialized texture!`);let l=this._descriptor;l.internalFormat=d(l);let{context:f,pixelFormat:m,dataType:h,isImmutable:g,target:_}=l;if(g&&!this._wasImmutablyAllocated)throw new e(`texture:uninitialized`,`Cannot update immutable texture before allocation!`);p(_)||x().warn(`Attempting to set 3D texture data on a non-3D texture`);let v=f.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES);f.setActiveTexture(S.TEXTURE_UNIT_FOR_UPDATES),(n<0||r<0||i<0||n+a>l.width||r+o>l.height||i+s>l.depth)&&x().error(`An attempt to update out of bounds of the texture!`),this._configurePixelStorage();let{gl:y}=f;if(u(c))c=c.levels[t],y.compressedTexSubImage3D(_,t,n,r,i,a,o,s,l.internalFormat,c);else{let e=c;y.texSubImage3D(_,t,n,r,i,a,o,s,m,h,e)}f.bindTexture(v,S.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){let t=this._descriptor;if(t.width===0||t.height===0)return;if(!t.hasMipmap){if(this._wasImmutablyAllocated)throw new e(`texture:immutable-change`,`Cannot add mipmaps to immutable texture after allocation`);t.hasMipmap=!0,this._samplingModeDirty=!0,m(t)}t.samplingMode===9729?(this._samplingModeDirty=!0,t.samplingMode=9985):t.samplingMode===9728&&(this._samplingModeDirty=!0,t.samplingMode=9984);let n=this._descriptor.context.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(S.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(t.target),this._descriptor.context.bindTexture(n,S.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){let t=this._descriptor;if(t.hasMipmap){if(this._wasImmutablyAllocated)throw new e(`texture:immutable-change`,`Cannot delete mipmaps to immutable texture after allocation`);t.hasMipmap=!1,this._samplingModeDirty=!0,m(t)}t.samplingMode===9985?(this._samplingModeDirty=!0,t.samplingMode=9729):t.samplingMode===9984&&(this._samplingModeDirty=!0,t.samplingMode=9728)}setSamplingMode(e){e!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=e,this._samplingModeDirty=!0)}setWrapMode(e){e!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=e,m(this._descriptor),this._wrapModeDirty=!0)}setShadowFiltering(e){e!==this._descriptor.linearFilterDepth&&(this._descriptor.linearFilterDepth=this._descriptor.compareEnabled=e,this.setSamplingMode(e?9729:9728),m(this._descriptor),this._shadowFilterDirty=!0)}applyChanges(){this._samplingModeDirty&&=(this._applySamplingMode(),!1),this._wrapModeDirty&&=(this._applyWrapMode(),!1),this._shadowFilterDirty&&=(this._applyShadowMode(),!1)}abortCompression(){this._compressionAbortController=n(this._compressionAbortController)}_setData(t,n){let r=this._descriptor,i=r.context?.gl;if(!i)return;o(i),this.hasWebGLTextureObject||(this._glName=i.createTexture(),r.context.instanceCounter.increment(s.Texture,this)),m(r);let a=r.context.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES);r.context.setActiveTexture(S.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),o(i);let c=n??r.target,l=p(c);if(f(t))this._setDataFromTexImageSource(t,c);else{let{width:n,height:a,depth:s}=r;if(n==null||a==null)throw new e(`texture:missing-size`,`Width and height must be specified!`);if(l&&s==null)throw new e(`texture:missing-depth`,`Depth must be specified!`);if(r.internalFormat=d(r),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(c,r.internalFormat,r.hasMipmap,n,a,s),u(t)){if(!h(r.internalFormat))throw new e(`texture:format-mismatch`,`Attempting to use compressed data with an uncompressed format!`);this._setDataFromCompressedSource(t,r.internalFormat,c)}else this._texImage(c,0,r.internalFormat,n,a,s,t),o(i),r.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),this._applyShadowMode(),o(i),r.context.bindTexture(a,S.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(e=null){for(let t=34069;t<=34074;t++)this._setData(e,t)}_configurePixelStorage(){let e=this._descriptor.context.gl,{unpackAlignment:t,flipped:n,preMultiplyAlpha:r}=this._descriptor;e.pixelStorei(e.UNPACK_ALIGNMENT,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,+!!n),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,+!!r)}_setDataFromTexImageSource(e,t){let{gl:n}=this._descriptor.context,r=this._descriptor;r.internalFormat=d(r);let i=p(t),{width:a,height:s,depth:c}=g(e);r.width&&r.height,r.width||=a,r.height||=s,i&&r.depth,i&&(r.depth=c),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(t,r.internalFormat,r.hasMipmap,a,s,c),this._texImage(t,0,r.internalFormat,a,s,c,e),o(n),r.hasMipmap&&(this.generateMipmap(),o(n))}_setDataFromCompressedSource(e,t,n){let r=this._descriptor,{width:i,height:a,depth:o}=r,s=e.levels,c=v(n,i,a,o),l=Math.min(c,s.length)-1;this._descriptor.context.gl.texParameteri(r.target,33085,l),this._forEachMipmapLevel((e,r,i,a)=>{let o=s[Math.min(e,s.length-1)];this._compressedTexImage(n,e,t,r,i,a,o)},l)}_texStorage(t,n,r,i,a,o){let{gl:s}=this._descriptor.context;if(!_(n)&&!h(n))throw new e(`texture:missing-format`,`Immutable textures must have a sized or compressed internal format`);if(!this._descriptor.isImmutable)return;let c=r?v(t,i,a,o):1;if(p(t)){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);s.texStorage3D(t,c,n,i,a,o)}else s.texStorage2D(t,c,n,i,a);this._wasImmutablyAllocated=!0}_texImage(t,n,r,i,a,o,s){let c=this._descriptor.context.gl,l=p(t),{isImmutable:u,pixelFormat:d,dataType:f}=this._descriptor;if(u){if(s!=null){let r=s;if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.texSubImage3D(t,n,0,0,0,i,a,o,d,f,r)}else c.texSubImage2D(t,n,0,0,i,a,d,f,r)}}else{let u=s;if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.texImage3D(t,n,r,i,a,o,0,d,f,u)}else c.texImage2D(t,n,r,i,a,0,d,f,u)}}_compressedTexImage(t,n,r,i,a,o,s){let c=this._descriptor.context.gl,l=p(t);if(this._descriptor.isImmutable){if(s!=null){if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.compressedTexSubImage3D(t,n,0,0,0,i,a,o,r,s)}else c.compressedTexSubImage2D(t,n,0,0,i,a,r,s)}}else if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.compressedTexImage3D(t,n,r,i,a,o,0,s)}else c.compressedTexImage2D(t,n,r,i,a,0,s)}async _compressOnWorker(e){let{width:t,height:n,context:r,flipped:o,preMultiplyAlpha:s,hasMipmap:c,compress:l}=this._descriptor;if(!l)return;let{compressionTracker:u,compressionCallback:d,preserveSourceBitmap:f}=l,{compressedTextureETC:p,compressedTextureS3TC:m}=r.capabilities;if(!S.compressionWorkerHandle?.isCompressible(e,this._descriptor)||!p&&!m)return;this.abortCompression();let h=new AbortController;this._compressionAbortController=h,u?.increment();let g,_=!1,v=!1;try{e instanceof ImageBitmap?f?(g=await createImageBitmap(e),i(h),v=!0):g=e:e instanceof Uint8Array?(g=e.buffer,_=this.descriptor.flipped):(g=await createImageBitmap(e,{imageOrientation:o?`flipY`:`none`}),i(h),v=!0);let r={data:g,width:t,height:n,needsFlip:_,components:this._descriptor.pixelFormat===6408?4:3,preMultiplyAlpha:s,isOpaque:this._descriptor.isOpaque,hasMipmap:c,hasETC:!!p,hasS3TC:!!m},a=await S.compressionWorkerHandle.invoke(r,h.signal,1);if(i(h),a.compressedTexture&&this.hasWebGLTextureObject){let e=this.usedMemory;this._descriptor.internalFormat=a.internalFormat,this._setData(a.compressedTexture),d?.(e-this.usedMemory)}}catch(e){a(e)||x().error(`Texture compression failed!`)}finally{u?.decrement(),this._compressionAbortController?.signal.aborted&&(this._compressionAbortController=null),v&&g instanceof ImageBitmap&&g.close()}}_forEachMipmapLevel(t,n=1/0){let{width:r,height:i,depth:a,hasMipmap:o,target:s}=this._descriptor,c=s===32879;if(r==null||i==null||c&&a==null)throw new e(`texture:missing-size`,`Missing texture dimensions for mipmap calculation`);for(let e=0;t(e,r,i,a),!(!o||r===1&&i===1&&(!c||a===1)||e>=n);++e)r=Math.max(1,r>>1),i=Math.max(1,i>>1),c&&(a=Math.max(1,a>>1))}_applySamplingMode(){let e=this._descriptor,t=e.context?.gl,n=e.samplingMode,r=e.samplingMode;n===9985||n===9987?(n=9729,e.hasMipmap||(r=9729)):(n===9984||n===9986)&&(n=9728,e.hasMipmap||(r=9728)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,n),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,r),e.maxMipLevel!=null&&t.texParameteri(e.target,t.TEXTURE_MAX_LEVEL,e.maxMipLevel)}_applyWrapMode(){let e=this._descriptor,t=e.context?.gl;typeof e.wrapMode==`number`?(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode)):(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode.s),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode.t))}_applyShadowMode(){let e=this._descriptor,t=e.context?.gl,n=e.compareEnabled?t.COMPARE_REF_TO_TEXTURE:t.NONE;t.texParameteri(e.target,t.TEXTURE_COMPARE_MODE,n),e.compareEnabled&&t.texParameteri(e.target,t.TEXTURE_COMPARE_FUNC,t.GREATER),o(t)}_applyAnisotropicFilteringParameters(){let e=this._descriptor,t=e.context.capabilities.textureFilterAnisotropic;t&&e.context.gl.texParameterf(e.target,t.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}}export{S as default};
|
|
@@ -72,7 +72,7 @@ export default class Environment extends JSONSupport {
|
|
|
72
72
|
get lighting(): SunLighting | VirtualLighting;
|
|
73
73
|
set lighting(value: (SunLightingProperties & { type?: "sun" }) | (VirtualLightingProperties & { type: "virtual" }));
|
|
74
74
|
/**
|
|
75
|
-
* Indicates whether stars
|
|
75
|
+
* Indicates whether the deep-sky background, which contains stars and the Milky Way, is enabled.
|
|
76
76
|
*
|
|
77
77
|
* @default true
|
|
78
78
|
*/
|