@arcgis/core 6.0.0-next.29 → 6.0.0-next.30

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.
Files changed (122) hide show
  1. package/WebDocument2D.js +1 -1
  2. package/WebMap.d.ts +3 -19
  3. package/WebMap.js +1 -1
  4. package/WebScene.js +1 -1
  5. package/arcgisGlobal.d.ts +1 -0
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/039d9bc5b5015012f811.js +1 -0
  8. package/assets/esri/core/workers/chunks/{b01688ccc29d33bfc82d.js → 28a821de9dbf10324033.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{d3c3fb079ad97970f834.js → 4fb2fcc95f852bf8f86c.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{84940d8e14caf5a27e04.js → 64b360625c68cb863a08.js} +1 -1
  11. package/assets/esri/core/workers/chunks/71f792a20077aa739f87.js +1 -0
  12. package/assets/esri/core/workers/chunks/{e480e7d5f40049a2053b.js → 7af4edc6e87d27b9d467.js} +1 -1
  13. package/assets/esri/core/workers/chunks/90c1d10eae7ae71889b0.js +1 -0
  14. package/assets/esri/core/workers/chunks/{8a485130781b49dbf608.js → 9d40786c5ceface786ba.js} +1 -1
  15. package/assets/esri/core/workers/chunks/aba259a70bee68d2edb7.js +1 -0
  16. package/assets/esri/core/workers/chunks/c33a9635c294c8774977.js +1 -0
  17. package/assets/esri/views/3d/environment/resources/milkyway-band.avif +0 -0
  18. package/chunks/GlobalIllumination.glsl.js +16 -10
  19. package/chunks/GlobalIlluminationBlur.glsl.js +14 -14
  20. package/chunks/GlobalIlluminationUpscale.glsl.js +4 -4
  21. package/chunks/RibbonLine.glsl.js +78 -75
  22. package/config.js +1 -1
  23. package/core/workers/WorkerHandle.js +1 -1
  24. package/kernel.js +1 -1
  25. package/layers/WMTSLayer.d.ts +1 -1
  26. package/layers/WMTSLayer.js +1 -1
  27. package/layers/mixins/TiledImagery.d.ts +7 -0
  28. package/layers/support/WMTSSublayer.d.ts +5 -5
  29. package/networks/Network.js +1 -1
  30. package/networks/support/TopologyValidationJobInfo.js +1 -1
  31. package/package.json +2 -2
  32. package/rest/networks/support/ValidateNetworkTopologyResult.js +1 -1
  33. package/support/timeUtils.js +1 -1
  34. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  35. package/views/2d/layers/GeospatialPDFLayerView2D.js +1 -1
  36. package/views/2d/layers/SketchLayerView2D.js +1 -1
  37. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  38. package/views/2d/types.d.ts +2 -1
  39. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  40. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  41. package/views/3d/interactive/visualElements/Object3DVisualElement.js +1 -1
  42. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  43. package/views/3d/interactive/visualElements/StageObjectVisualElement.js +2 -0
  44. package/views/3d/layers/WMTSLayerView3D.js +1 -1
  45. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  46. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  47. package/views/3d/layers/graphics/Graphics3DBufferGraphicLayer.js +1 -1
  48. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  49. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  50. package/views/3d/layers/graphics/Graphics3DPathSymbolLayerConstants.js +1 -1
  51. package/views/3d/layers/graphics/Graphics3DStageObjectGraphicLayer.js +1 -1
  52. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  53. package/views/3d/layers/graphics/elevationAlignmentUtils.js +1 -1
  54. package/views/3d/layers/graphics/pointUtils.js +1 -1
  55. package/views/3d/terrain/ExtentHelper.js +1 -1
  56. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  57. package/views/3d/terrain/PatchRenderData.js +1 -1
  58. package/views/3d/terrain/SphericalPatch.js +1 -1
  59. package/views/3d/terrain/TerrainRenderer.js +1 -1
  60. package/views/3d/terrain/TerrainSurface.js +1 -1
  61. package/views/3d/terrain/Tile.js +1 -1
  62. package/views/3d/terrain/tileUtils.js +1 -1
  63. package/views/3d/types.d.ts +2 -1
  64. package/views/3d/webgl-engine/Stage.js +1 -1
  65. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexInfo.glsl.js +10 -11
  66. package/views/3d/webgl-engine/core/shaderLibrary/util/PackedUint32.glsl.js +2 -0
  67. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  68. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  69. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlur.glsl.js +1 -1
  70. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationUpscale.glsl.js +1 -1
  71. package/views/3d/webgl-engine/effects/globalIllumination/globalIlluminationUniforms.js +2 -0
  72. package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
  73. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  74. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  75. package/views/3d/webgl-engine/lib/PackedUint32.js +2 -0
  76. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  77. package/views/3d/webgl-engine/lib/PathVertexInfo.js +1 -1
  78. package/views/3d/webgl-engine/lib/RibbonLineVertexInfo.js +2 -0
  79. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  80. package/views/3d/webgl-engine/materials/HUDMaterialBaseInstance.js +1 -1
  81. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  82. package/views/3d/webgl-engine/materials/LineCalloutMaterialBaseInstance.js +1 -1
  83. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  84. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  85. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  86. package/views/3d/webgl-engine/parts/Model.js +1 -1
  87. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  88. package/views/3d/webgl-engine/shaders/RibbonLineLayouts.js +1 -1
  89. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  90. package/views/3d/webgl-engine/shaders/RibbonLineTextureBuffer.glsl.js +1 -1
  91. package/views/SelectionManager.d.ts +5 -5
  92. package/views/SelectionManager.js +1 -1
  93. package/views/input/InputManager.js +1 -1
  94. package/views/layers/WMTSLayerView.d.ts +16 -0
  95. package/views/layers/WMTSLayerView.js +2 -0
  96. package/views/layers/support/highlightUtils.js +1 -1
  97. package/views/selection/SelectionOperation.js +1 -1
  98. package/views/selection/types.d.ts +3 -3
  99. package/views/support/GeometryWorker.js +1 -1
  100. package/views/support/GeometryWorkerHandle.js +1 -1
  101. package/views/support/selectionUtils.js +1 -1
  102. package/webdoc/support/webdocLoadUtils.js +1 -1
  103. package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +1 -1
  104. package/widgets/FeatureTable/AttachmentsColumn.js +1 -1
  105. package/widgets/FeatureTable/RelationshipColumn.js +1 -1
  106. package/widgets/OrientedImageryViewer/imageMeasurementWorkerUtils.js +1 -1
  107. package/widgets/support/SelectionList/GroupLayerItem.d.ts +5 -5
  108. package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
  109. package/widgets/support/SelectionList/ItemBase.d.ts +3 -3
  110. package/widgets/support/SelectionList/LayerItem.js +1 -1
  111. package/widgets/support/SelectionList/SelectionListViewModel.d.ts +5 -6
  112. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  113. package/widgets/support/SelectionList/types.d.ts +3 -1
  114. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  115. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  116. package/widgets/support/symbolPreviewUtils.js +1 -1
  117. package/assets/esri/core/workers/chunks/2de4296590bf9f9e9add.js +0 -1
  118. package/assets/esri/core/workers/chunks/4976f5567fc7f1b63d10.js +0 -1
  119. package/assets/esri/core/workers/chunks/53c7510df09b71ab5646.js +0 -1
  120. package/assets/esri/core/workers/chunks/66c2a28a851130b87c04.js +0 -1
  121. package/assets/esri/core/workers/chunks/e7aaf7579592b79d6dd7.js +0 -1
  122. package/layers/geospatialPDF/CIM2DLayerview.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{toConst as e}from"../../../core/compilerUtils.js";import"../../../core/has.js";import{clamp as t}from"../../../core/mathUtils.js";import{abortMaybe as n}from"../../../core/maybe.js";import r from"../../../core/ObjectPool.js";import{subtract as i,squaredLength as a,dot as o,scale as s,add as c,length as l,copy as u}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d,unitZ as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../geometry/ellipsoidUtils.js";import{create as m,equals as h,rectangleContainsRectangleCyclicalAware as g,rectanglesIntersectCyclicalAware as _,width as v,height as y}from"../../../geometry/support/aaBoundingRect.js";import{Sphere as b}from"../../../geometry/support/sphere.js";import{isGroupLayer as x}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as S}from"../support/flowUtils.js";import{ElevationBounds as C}from"./ElevationBounds.js";import{ElevationTileAgent as w,isElevationTileAgent as T}from"./ElevationTileAgent.js";import{LayerClasses as E}from"./LayerClass.js";import{MapDataCacheItem as D}from"./MapDataCacheItem.js";import{MapTileAgent as ee,isMapTileAgent as te}from"./MapTileAgent.js";import{maxPatchTesselation as ne}from"./TerrainConst.js";import{isVectorTile as O,isTileTexture as re,isRasterTile as ie,isCreateBitmapResult as ae}from"./TerrainData.js";import{weakAssert as k,isBlendableLayerView as oe,oppositeCorner as A,internalAssert as j,enableTerrainInternalChecks as M,neighborEdgeIndices as N,oppositeEdge as P,neighborCornerIndices as F,almostEquals as I,isNorth as L,isSouth as R,isWest as z,isEast as B,isWestCorner as V,isNorthCorner as se}from"./terrainUtils.js";import{tileAgentDone as H}from"./TileAgent.js";import{TilePerLayerInfo as U}from"./TilePerLayerInfo.js";import{fallsWithinLayerView as W}from"./tileUtils.js";class ce{constructor(){this._lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this._dirty=!0,this._previouslyRendered=!1,this._lastElevationSourceUpdateRequestSignature=null,this.extent=m(),this._elevationBoundsMin=NaN,this._elevationBoundsMax=0,this.layerInfo=[[],[]],this.extentInRadians=m(),this.centerAtSeaLevel=d(),this._center=[d(),new b,d()],this.up=f(),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=0,this._rasterTileMemory=0,this._vectorTileMemory=0,this._mapDataRefCount=0,this.screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0,this.onCompressionFinished=()=>{this.setPendingUpdate(16),this.setMemoryDirty()},this.extentMidX=0,this.extentMidY=0,this.distanceToPOI=-1,this._lastPOI=d(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0}get lij(){return this._lij}get spatialReference(){return this._surface.spatialReference??this._surface.tilingScheme.spatialReference}get isDisposed(){return this._surface==null}get elevationLevelDelta(){return this._surface.getElevationLevelDelta(this.level)}_setPendingUpdateForDescendants(){let e=this._children;if(e[0])for(let t of e)t.renderData&&(t.setPendingUpdate(16),t.setMemoryDirty()),t._setPendingUpdateForDescendants()}static prune(){K.prune(0),q.prune(0),U.prune()}get _cached(){return!this.leaf&&this._mapDataRefCount<=0}get withinClippingArea(){return this._withinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBoundsMin(){return this._elevationBoundsMin}get elevationBoundsMax(){return this._elevationBoundsMax}get level(){return this._lij[0]}get key(){return`${this._lij[0]}/${this._lij[1]}/${this._lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[1].radius}get visible(){return this._dirty&&this.computeVisibility(),this._visible}get frustumVisibility(){return this._dirty&&this.computeVisibility(),this._frustumVisibility}checkVisibility(e){if(this._dirty)return null;let t=this._calculateVisibility(e);if(this._frustumVisibility!==t||this._visible!==(t!==2&&this._intersectsClippingArea))throw Error(`Assertion failed: waterproof.visibility-cache-mismatch: Tile[${this.lij}]`);return t}computeVisibility(){this._dirty=!1;let e=this.parent?.frustumVisibility??1;this._frustumVisibility=this._calculateVisibility(e);let t=this._frustumVisibility!==2&&this._intersectsClippingArea;t!==this._visible&&(this._visible=t,this._surface.emit(`tiles-visibility-changed`),this._surface.renderer.setDirty(),this.updateAgentSuspension())}_calculateVisibility(e){let t=this.parent;return e===0?0:t!=null&&e===2&&this._elevationBoundsMin>=t._elevationBoundsMin&&this._elevationBoundsMax<=t._elevationBoundsMax?2:this._calculateFrustumVisibility(this.surface.frustum,this._surface.view.frustum.boundingSphere)}get _loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){let e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit(`tiles-visibility-changed`),this._previouslyRendered=e,this._surface.renderer.setDirty()),e}init(e,t,n,r,i){this._lij[0]=e,this._lij[1]=t,this._lij[2]=n,this.ellipsoid=p(i.tilingScheme.spatialReference),i.tilingScheme.getExtent(e,t,n,this.extent),i.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this.extentMidX=.5*(this.extent[0]+this.extent[2]),this.extentMidY=.5*(this.extent[1]+this.extent[3]),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,i.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[1].radius=0,this.elevationLevel=e,this._lastElevationSourceUpdateRequestSignature=null,r&&!Number.isNaN(r.elevationBoundsMin)?(this._elevationBoundsMin=r.elevationBoundsMin,this._elevationBoundsMax=r.elevationBoundsMax):(this._elevationBoundsMin=0,this._elevationBoundsMax=0),this._pendingUpdates=0,this.renderData=null,this.screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=r,this.clearChildren(),this._surface=i,this.updateVisibility(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0;for(let e of E){let t=i.numLayers(e),n=this.layerInfo[e];for(let e of n)e.release();n.length=t;for(let r=0;r<t;r++)n[r]=U.acquire(this._surface.upsampleInfoPool),e===0&&this.findElevationBoundsForLayer(r,-1)}this.computeElevationBounds(),this._maxTesselation=Math.min(i.tilingScheme.pixelSize,ne)}dispose(){k(!this.renderData,`tile.renderData was not unloaded`),this._surface?.upsampleMapCache.pop(this.key),this.layerInfo.forEach(e=>{e.forEach(e=>e.release()),e.length=0}),this._surface=this._parent=null,this.clearChildren(),this.setMemoryDirty()}refMapData(){++this._mapDataRefCount,this._cached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){--this._mapDataRefCount,this._cached&&this.cachedMemory>0&&this._surface.upsampleMapCache.put(this.key,new D(e(this)))}setMemoryDirty(){this._usedMemory=0}get usedMemory(){return this._ensureUsedMemory()+(this._cached?0:this.mapDataMemory)}get cachedMemory(){return this._ensureUsedMemory(),this._surface==null?this.usedMemory:this._cached?this.mapDataMemory:0}get mapDataMemory(){return this._rasterTileMemory+this._vectorTileMemory}get _cpuImageMemorySize(){let e=this._surface.tilingScheme.pixelSize;return e*e*4}_ensureUsedMemory(){if(this._usedMemory>0)return this._vectorTileMemory=this.layerInfo[1].reduce((e,{data:t})=>e+(O(t)?t.usedMemoryPerReference:0),0),this._usedMemory;this._usedMemory=this._baseUsedMemory,this._rasterTileMemory=0,this._vectorTileMemory=0;for(let{data:e}of this.layerInfo[1])O(e)?this._vectorTileMemory+=e.usedMemoryPerReference:this._rasterTileMemory+=this.getTerrainDataMemory(e);for(let e of this.layerInfo[0])this._usedMemory+=e.data?this._cpuImageMemorySize:0;return this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._rasterTileMemory+=this.renderData.texture?.usedMemory??0),this._cached&&this._surface.upsampleMapCache.updateSize(this.key),this._usedMemory}getUsedMemoryForLayer(e,t){let n=this.layerInfo[e][t];return n?.data?e===1?this._cached?0:this.getTerrainDataMemory(n.data):e===0?this._cpuImageMemorySize:0:0}getTerrainDataMemory(e){return re(e)?e.texture.usedMemory:ie(e)?e.memoryUsage:O(e)?e.usedMemoryPerReference:ae(e)?this._cpuImageMemorySize:0}updateScreenDepth(e){let[t,n,r]=this._center[1].center,i=e,a=i[2]*t+i[6]*n+i[10]*r+i[14];this.screenDepth=a<0?0:a/(i[3]*t+i[7]*n+i[11]*r+i[15])}shouldSplit(e,t,n){if(!this.visible||e.frustum&&!(this._intersectsClippingArea&&this._calculateFrustumVisibility(e.frustum)!==2))return 0;let r=this.level;i(Q,this._center[1].center,t);let u=a(Q),d=this._closestCenterOnElevationRange(t,fe),f=i(pe,d,t),p=Math.min(u,a(f));if(this._edgeLen2>p&&r<e.maxLod)return 1;let m=Math.sqrt(p),h=e.fovX*m*2,g=this._edgeLen/h,_=()=>{if(r<e.maxLod)return this.elevationLevel=r,0;let t=r+Math.ceil(-Math.log2(e.relativeWidthLimit/g));return t===this.elevationLevel?0:(this.elevationLevel=t,2)},v=n==null?1/0:n-r;if(v<=.5)return _();let y=o(this.up,Q),b=this._elevationBoundsMax-this._elevationBoundsMin,x=b/this.edgeLen;if(e.aboveGround&&y>0&&x<.001&&y/m-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-x>0)return _();let S=n==null?1:3-Math.min(v,2);if(g*S<e.relativeWidthLimit||r>=e.maxLod)return _();if(r<7)return 1;s($,this.up,y),i($,$,f);let C=a($);if(C<=this.radius*this.radius)return 1;s($,$,this.radius/Math.sqrt(C)),c($,$,d),i($,t,$);let w=Math.min(1,(Math.abs(o($,this.up))+.5*b+this._curvatureHeight)/l($)),T=.1/e.angledSplitBias,E=e.fovY*m*2;return w*(this._edgeLen/E*S)<T*e.relativeHeightLimit?_():1}needsElevationSourceUpdate(){let e=this.renderData?.geometryState.samplerDataSourceLevels;if(e==null)return!1;let t=Math.max(this.elevationLevel-this.elevationLevelDelta,0);return e.some(e=>e>t)&&this._lastElevationSourceUpdateRequestSignature!==this._elevationSourceUpdateRequestSignature(e)}markElevationSourceUpdateRequested(){let e=this.renderData?.geometryState.samplerDataSourceLevels;this._lastElevationSourceUpdateRequestSignature=e==null?null:this._elevationSourceUpdateRequestSignature(e)}_elevationSourceUpdateRequestSignature(e){return`${Math.max(this.elevationLevel-this.elevationLevelDelta,0)}:${e.join(`,`)}`}createChildren(){let e=this._children,t=this.lij[0]+1,n=this.lij[1]*2,r=this.lij[2]*2;return e[0]=this.surface.createTile(t,n,r,this),e[1]=this.surface.createTile(t,n,r+1,this),e[2]=this.surface.createTile(t,n+1,r,this),e[3]=this.surface.createTile(t,n+1,r+1,this),e}clearChildren(){this._children[0]=this._children[1]=this._children[2]=this._children[3]=null}get loaded(){return this.renderData?.hasGeometry??!1}get hasGeometryState(){return this.renderData?.geometryState!=null}load(){this.refMapData();for(let e of E)this._createOrUpdateAgents(0,e);this.surface.renderer.loadTile(this)}unload(){this.renderData&&this.unrefMapData(),this.surface.renderer.unloadTile(this);for(let e of E){let t=this.layerInfo[e];for(let e of t)e.loadingAgent&&e.loadingAgent!==H&&(G(e.loadingAgent),e.loadingAgent=null),e.pendingUpdates=0}this.resetPendingUpdate(8),this.resetPendingUpdate(16),this.resetPendingUpdate(32)}unloadMapData(){let e=this.layerInfo[1];for(let t of e)t.loadingAgent&&t.loadingAgent!==H&&(G(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0,t.invalidateSourceData();this.renderData?.releaseTexture(),this.setMemoryDirty()}updateClippingStatus(e){if(h(e,this._clippingArea))return!1;let t=this._intersectsClippingArea,n=this._withinClippingArea;e==null?(this._intersectsClippingArea=!0,this._withinClippingArea=!0):(this._intersectsClippingArea=this.intersectsExtent(e),this._withinClippingArea=this._isWithinExtent(e)),this._clippingArea=e,this.updateVisibility();let r=n&&this._withinClippingArea,i=!n&&!t&&!this._withinClippingArea&&!this._intersectsClippingArea;return this.renderData&&!(r||i)&&this.setPendingUpdate(8),!0}updateVisibility(){this._dirty=!0,this._surface.setTileTreeDirty(!1)}getLayerInfo(e,t){return this.layerInfo[t][e]}hasLayerData(e,t){let n=this.layerInfo[t][e];return!(!n?.data||n.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(let e of E){let t=this.layerInfo[e];for(let e of t)if(e.loadingAgent&&e.loadingAgent!==H&&e.loadingAgent.updating)return!0}return!1}_isSuspended(e){return this.hasPendingUpdate(1)?!0:e!==0&&!this._loadable}get hasPendingUpdates(){return this._pendingUpdates!==0}hasPendingUpdate(e){return(this._pendingUpdates&e)===e}setPendingUpdate(e){let t=this._pendingUpdates;return this._pendingUpdates|=e,e===1||e===4?this._surface.setTileTreeDirty(!0):this._surface.requestUpdate(),t!==this._pendingUpdates}resetPendingUpdate(e){return this.hasPendingUpdate(e)?(this._pendingUpdates&=~e,!0):!1}requestLayerData(e,t,r){let i=this.layerInfo[t][e];if(i.waitingAgents.has(r))return console.warn(`agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)`,this._lij.toString(),r.tile.lij.toString(),t,e),!0;if(i.waitingAgents.push(r),i.data&&!i.dataInvalidated){console.warn(`agent requested existing data (tile %s, agent tile %s, layer: %d/%d)`,this._lij.toString(),r.tile.lij.toString(),t,e);let n=O(i.data);return r.dataArrived(this,n),!0}if(i.requestPromise)return!0;n(i.requestAbort),i.requestAbort=new AbortController;let a=this._surface.requestTileData(this,e,t,{signal:i.requestAbort.signal});if(!a)return i.requestAbort=null,!1;let o=()=>{i.requestPromise===a&&(i.requestPromise=null,i.requestAbort=null)};return i.requestPromise=a,a.then(o,o),!0}get leaf(){return this._children[0]==null}hasLij(e){return this._lij[0]===e[0]&&this._lij[1]===e[1]&&this._lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;let t=this._children;return t[0]?t[0].findByLij(e)||t[1].findByLij(e)||t[2].findByLij(e)||t[3].findByLij(e):null}distanceToSquared(e){return a(i($,this._center[1].center,e))}containsPoint(e){let t=this.extent;return e[0]>=t[0]&&e[1]>=t[1]&&e[0]<=t[2]&&e[1]<=t[3]}containsPointXY(e,t){let n=this.extent;return e>=n[0]&&t>=n[1]&&e<=n[2]&&t<=n[3]}unrequestLayerData(e,t,n){let r=this.layerInfo[t][e],i=r.waitingAgents,a=i.removeUnordered(n)!=null;k(a,`agent has not requested this piece of map data`),i.length<1&&(r.abortRequest(),this.setMemoryDirty())}dataArrived(e,t,n){let r=O(n),i=this.layerInfo[t][e];i.data=n,i.dataInvalidated=!1,i.waitingAgents.forAll(e=>e.dataArrived(this,r)),i.waitingAgents.clear(),this.setMemoryDirty()}dataMissing(e,t){let n=this.layerInfo[t][e];n.dataMissing=!0,n.waitingAgents.forAll(e=>e.dataMissing()),n.waitingAgents.clear(),this.setMemoryDirty()}updateRenderData(e,t,n){switch(n&&this.forEachLoadedNeighbor(n=>n.updateRenderData(e,t)),e){case 1:return this._updateTexture(t);case 0:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(e===0?16:32),this.setPendingUpdate(e===0?32:16))}_updateGeometry(){this.setPendingUpdate(8);for(let e of this.layerInfo[0])e.pendingUpdates|=8}invalidateLayerData(e,t){this.layerInfo[t][e].invalidateSourceData()}computeElevationBounds(){let e=this._elevationBoundsMin,t=this._elevationBoundsMax,n=1/0,r=-1/0,i=this.layerInfo[0],a=!0;for(let e of i)e.elevationBounds!=null&&(n=Math.min(n,e.elevationBounds.minElevation),r=Math.max(r,e.elevationBounds.maxElevation),e.elevationBounds.hasNoDataValues||(a=!1));a&&(n=Math.min(n,0),r=Math.max(r,0)),(e!==n||t!==r)&&(this._elevationBoundsMin=n,this._elevationBoundsMax=r,this.updateRadiusAndCenter(),this._surface.setTileTreeDirty(!1))}_updateCenter(){let e=this._elevationBoundsMin,t=this._elevationBoundsMax,n=.5*(e+t),r=this._center;s($,this.up,n),c(r[1].center,this.centerAtSeaLevel,$),s($,this.up,e),c(r[0],this.centerAtSeaLevel,$),s($,this.up,t),c(r[2],this.centerAtSeaLevel,$)}_closestCenterOnElevationRange(e,t){if(this._surface.viewingMode===1){if(this.level===0)return u(t,this._center[1].center);let n=o(this.up,e),r=Math.max(this.ellipsoid.radius+this._elevationBoundsMin,Math.min(this.ellipsoid.radius+this._elevationBoundsMax,n));return s(t,this.up,r)}let n=Math.max(this._elevationBoundsMin,Math.min(this._elevationBoundsMax,e[2]));return t[0]=this.centerAtSeaLevel[0],t[1]=this.centerAtSeaLevel[1],t[2]=n,t}findElevationBoundsForLayer(e,t){let n=this.layerInfo[0][e],r=this.elevationLevelDelta,i=Math.max(this.elevationLevel-r,0),a=n.elevationBounds;if(a!=null&&a.level>t&&a.level<=i)return;let o=this._surface.layerViewByIndex(e,0);if(!W(this,o))return;let s=ue,c=!1,l=n.data;if(l&&l.level<=i){let e=n.data;s.minElevation=e.samplerData.data.minValue,s.maxElevation=e.samplerData.data.maxValue,s.hasNoDataValues=e.samplerData.data.hasNoDataValues,s.level=this.level,c=!0}else{let t=0,n,a;for(let o=this._parent;o&&(!a||t<r)&&(t=this.elevationLevel-o.level,n=a||n,a=o.layerInfo[0][e].data,!(!a&&n&&o.level<=i));o=o.parent);a||=n,a&&(a.computeMinMaxValue(this._lij[0],this._lij[1],this._lij[2],s),s.minElevation!==1/0&&(s.level=a.level,c=!0))}c&&(n.elevationBounds??=new C,n.elevationBounds.copyFrom(s))}modifyLayers(e,t,n){let r=this.layerInfo[n];for(let e of r)e.loadingAgent&&e.loadingAgent!==H&&(G(e.loadingAgent),e.loadingAgent=null),e.waitingAgents.clear();for(let t=0;t<r.length;++t)e[t]===void 0&&r[t].release();let i=new Array(...r),a=t.length;r.length=a;for(let e=0;e<a;e++){let n=t[e];r[e]=n>-1?i[n]:U.acquire(this._surface.upsampleInfoPool)}this.setMemoryDirty()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,0))}updateAgents(e){if(this.renderData){let t=this.layerInfo[e];for(let e of t)e.loadingAgent===H&&(e.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(let e of E){let t=this._isSuspended(e);for(let n of this.layerInfo[e])n.loadingAgent&&n.loadingAgent!==H&&(n.loadingAgent.setSuspension(t),n.loadingAgent===H&&this.updateRenderData(e,0))}}removeLayerAgent(e,t){let n=this.layerInfo[t][e];n.loadingAgent&&n.loadingAgent!==H&&n.loadingAgent.dispose(),n.loadingAgent=null}agentDone(e,t){let n=this.layerInfo[t][e];n.loadingAgent=H,!n.data&&n.upsampleInfo==null&&this._createOrUpdateAgents(e+1,t)}_hasBlendableAncestor(e){return e.blendMode!==`normal`||x(e.parent)&&this._hasBlendableAncestor(e.parent)}_hasBlendModes(e,t,n){for(let r=e;r<t;++r){let e=this._surface.layerViewByIndex(r,n);if(oe(e)&&e?.layer?.blendMode!==`normal`||x(e?.layer?.parent)&&this._hasBlendableAncestor(e?.layer?.parent))return!0}return!1}_createOrUpdateAgents(e,t){let n=this.layerInfo[t];if(n.length===0)return;let r=this._isSuspended(t),i=!1;for(let a=e;a<n.length;++a){let o=n[a],s=this._surface.layerViewByIndex(a,t),c=!1;(!i||S(s))&&(o.loadingAgent?W(this,s)?(o.loadingAgent!==H&&o.loadingAgent.setSuspension(r),o.loadingAgent!==H&&(c=o.loadingAgent.update())):o.dispose():W(this,s)&&(o.loadingAgent=le(this,a,t,r),c=o.loadingAgent.startLoading(),c?o.loadingAgent===H&&this.setPendingUpdate(8):(G(o.loadingAgent),o.loadingAgent=H)),o.loadingAgent===H&&this.updateRenderData(t,0),!s.destroyed&&!this._hasBlendModes(e,n.length,t)&&c&&s.isOpaque&&(i||=!0))}}_isWithinExtent(e){let t=this.extent;return t[0]>=e[0]&&e[2]>=t[2]&&t[1]>=e[1]&&e[3]>=t[3]}intersectsExtent(e){let t=this.extent;return t[2]>=e[0]&&e[2]>=t[0]&&t[3]>=e[1]&&e[3]>=t[1]}getElevationVerticesPerSide(e){let n=this.elevationLevel-this.level,r=Math.max(this.level-e,this.elevationLevelDelta-n),i=t((this._maxTesselation>>r)+1,2,this._maxTesselation+1),a=this.minimumVerticesPerSide;return Math.max(i,a)}_findLIJ(e,t){if(!e)return null;let{rootTiles:n}=this.surface;if(n!=null){for(let r of n)if(de(r,e)){let n=r,i=e[0]-n.level-1;for(;i>=0&&!n.leaf&&!t(n);){let t=e[1]>>i&1,r=e[2]>>i&1;n=n.children[t*2+r],i--}return t(n)?n:null}}return null}findNeighborTile(e,t){let n=this._lij,r=this._getNeighborLIJ(n,e);return r?J(n,r)?t(this)?this:null:this._findLIJ(r,t):null}findCorner(e,t){let n=e===1?1:e===7?0:e===5?2:3,r=this;for(;r.children[0]&&(!t||!t(r));)r=r.children[n];return r}findNeighborCornerTileExact(e,t){return this.findNeighborTile(e,e=>t(e)||e.level===this.level)?.findCorner(A(e),t)||null}forAllSubtreeOnSide(e,t){let n=e===0?[0,1]:e===1?[1]:e===2?[1,3]:e===3?[3]:e===4?[2,3]:e===5?[2]:e===6?[0,2]:[0],r=e=>{let i=e.children;!t(e)&&i[0]&&n.forEach(e=>r(i[e]))};r(this)}getNeighborEdgeStartVertexIndex(e,t){if(!t)return 0;let n=this.level-t.level;if(j(!M||n>=0),n===0)return 0;let r=2**n,i=(e&1)==1,a=+!i,o=t.lij[a+1]*r,s=this._lij[a+1],c=s-o,l=i?r-1-c:c;return M&&(j(o<=s&&s<o+r),j(0<=l&&l<r)),l}forEachLoadedNeighbor(e){let t=this.level,n=e=>e.level===t||e.loaded;N.forEach(t=>{let r=this.findNeighborTile(t,n);r!=null&&r!==this&&r.forAllSubtreeOnSide(P(t),n=>n.loaded?(e(n,t),!0):!1)}),F.forEach(t=>{let r=this.findNeighborTile(t,n)?.findCorner(A(t),e=>e.loaded);j(!r||Y(this,r,t)),r?.loaded&&e(r,t)})}_getNeighborLIJ(e,t){let n=L(t)?-1:+!!R(t),r=z(t)?-1:+!!B(t),i=[e[0],e[1]+n,e[2]+r];return i[1]<0?null:this.surface.isGlobal?this._wrapLIJ(i):i[2]<0?null:i}_wrapLIJ(e){return!e||e[1]<0||e[1]>=2**e[0]?null:this.surface.wrapEastWest(e)}isEdgeNeighbor(e,t){if(e==null)return!1;if(this.level===0&&e.level===0&&(this._eastEnd&&e._westEnd&&t===2||this._westEnd&&e._eastEnd&&t===6))return!0;let n=Math.max((this.extent[2]-this.extent[0])*1e-6,1);switch(t){case 0:return I(this.extent[3],e.extent[1],n);case 4:return I(this.extent[1],e.extent[3],n);case 2:return I(this.extent[2],e.extent[0],n)||I(this.extent[2],-e.extent[0],n);case 6:return I(this.extent[0],e.extent[2],n)||I(this.extent[0],-e.extent[2],n)}}get _eastEnd(){return this._lij[2]===this.surface.lijEastEnd(this.level)-1}get _westEnd(){return this._lij[2]===0}checkGeometryWaterproofness(){}shouldHaveNeighbor(e){let t=this.extent,{rootTilesExtent:n}=this._surface,r=(t[2]-t[0])*.25;if(L(e)&&t[3]+r>=n[3]||R(e)&&t[1]-r<=n[1])return!1;let i=this.surface.isGlobal;return!(!i&&z(e)&&t[0]-r<=n[0]||!i&&B(e)&&t[2]+r>=n[2])}updateDistanceToPOI(e){let t=this._lastPOI;if(this.distanceToPOI>=0&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return;u(this._lastPOI,e);let n=this._center[1].center,r=e[0]-n[0],i=e[1]-n[1],a=e[2]-n[2];this.distanceToPOI=r*r+i*i+a*a}updateOverlayParameters(e){let{renderData:t}=this;if(!t)return;let{overlays:n,longitudeCyclical:r}=e,i=t.overlay;if(n.length===0)this._clearTileOverlayData(0,i),this._clearTileOverlayData(1,i);else{let[e,t]=n,a=this.extent;g(e.extent,a,r)||_(a,e.extent,r)||_(a,t.extent,r)?(this._setOverlayData(n,r,a,0,i),this._setOverlayData(n,r,a,1,i)):(this._clearTileOverlayData(0,i),this._clearTileOverlayData(1,i))}}_setOverlayData(e,t,n,r,i){let a=e[r].extent,o=v(a),s=y(a),c=n[0];if(t){c=t.minimalMonotonic(a[0],c);let e=t.minimalMonotonic(a[0],n[2]);c>e&&(c=e-(n[2]-n[0]))}if(o===0||s===0){i.setOffsetAndScale(r,0,0,1,1);return}let l=v(n)/o,u=y(n)/s,d=(c-a[0])/o,f=(n[1]-a[1])/s;i.setOffsetAndScale(r,d,f,l,u)}_clearTileOverlayData(e,t){t.setOffsetAndScale(e,-1,-1,-1,-1)}}function le(e,t,n,r){let i=n===0?q.acquire():K.acquire();return i.init(e,t,n,r),i}function G(e){e.dispose(),T(e)?q.release(e):te(e)&&K.release(e)}const K=new r(()=>new ee),q=new r(()=>new w),ue=new C;function de(e,t){let n=e.lij,r=t[0]-n[0];return r<0?!1:t[1]>>r===n[1]&&t[2]>>r===n[2]}function J(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Y(e,t,n){return e==null||t==null||t===e?!1:e.level>=t.level?X(e,t,n):X(t,e,A(n))}function X(e,t,n){j(e.level>=t.level);let r=V(n),i=se(n),a=e.extent,o=t.extent,s=[r?a[0]:a[2],i?a[3]:a[1]],c=[r?o[2]:o[0],i?o[1]:o[3]],l=(a[2]-a[0])*1e-5,u=I(s[0],c[0],l)||e.surface.isGlobal&&I(s[0],-c[0],l),d=I(s[1],c[1],l);if(u&&d)return!0;if(e.level===t.level||!u&&!d)return j(!1),!1;let f=u?Z(o[1],o[3],a[1],a[3],l):Z(o[0],o[2],a[0],a[2],l);return j(f),f}function Z(e,t,n,r,i){return e-i<=n&&n<=r&&r<=t+i}const Q=d(),fe=d(),pe=d(),$=d();export{ce as Tile,Y as isCornerNeighbor,J as lijEquals};
2
+ import{toConst as e}from"../../../core/compilerUtils.js";import"../../../core/has.js";import{clamp as t}from"../../../core/mathUtils.js";import{abortMaybe as n}from"../../../core/maybe.js";import r from"../../../core/ObjectPool.js";import{subtract as i,squaredLength as a,dot as o,scale as s,add as c,length as l,copy as u}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d,unitZ as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../geometry/ellipsoidUtils.js";import{create as m,equals as h,rectangleContainsRectangleCyclicalAware as g,rectanglesIntersectCyclicalAware as _,width as v,height as y}from"../../../geometry/support/aaBoundingRect.js";import{Sphere as b}from"../../../geometry/support/sphere.js";import{isGroupLayer as x}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as S}from"../support/flowUtils.js";import{ElevationBounds as C}from"./ElevationBounds.js";import{ElevationTileAgent as w,isElevationTileAgent as T}from"./ElevationTileAgent.js";import{LayerClasses as E}from"./LayerClass.js";import{MapDataCacheItem as D}from"./MapDataCacheItem.js";import{MapTileAgent as O,isMapTileAgent as ee}from"./MapTileAgent.js";import{maxPatchTesselation as te}from"./TerrainConst.js";import{isVectorTile as k,isTileTexture as ne,isRasterTile as re,isCreateBitmapResult as ie}from"./TerrainData.js";import{weakAssert as A,isBlendableLayerView as ae,oppositeCorner as j,internalAssert as M,enableTerrainInternalChecks as N,neighborEdgeIndices as P,oppositeEdge as F,neighborCornerIndices as I,almostEquals as L,isNorth as R,isSouth as z,isWest as B,isEast as V,isWestCorner as oe,isNorthCorner as se}from"./terrainUtils.js";import{tileAgentDone as H}from"./TileAgent.js";import{TilePerLayerInfo as U}from"./TilePerLayerInfo.js";import{fallsWithinLayerView as W}from"./tileUtils.js";class ce{constructor(){this._lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this._dirty=!0,this._previouslyRendered=!1,this._lastElevationSourceUpdateRequestSignature=null,this.extent=m(),this._elevationBoundsMin=NaN,this._elevationBoundsMax=0,this.layerInfo=[[],[]],this.extentInRadians=m(),this.centerAtSeaLevel=d(),this._center=[d(),new b,d()],this.up=f(),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=0,this._rasterTileMemory=0,this._vectorTileMemory=0,this._mapDataRefCount=0,this.screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0,this.onCompressionFinished=()=>{this.setPendingUpdate(16),this.setMemoryDirty()},this.extentMidX=0,this.extentMidY=0,this.distanceToPOI=-1,this._lastPOI=d(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0}get lij(){return this._lij}get spatialReference(){return this._surface.spatialReference??this._surface.tilingScheme.spatialReference}get isDisposed(){return this._surface==null}get elevationLevelDelta(){return this._surface.getElevationLevelDelta(this.level)}_setPendingUpdateForDescendants(){let e=this._children;if(e[0])for(let t of e)t.renderData&&(t.setPendingUpdate(16),t.setMemoryDirty()),t._setPendingUpdateForDescendants()}static prune(){K.prune(0),q.prune(0),U.prune()}get _cached(){return!this.leaf&&this._mapDataRefCount<=0}get withinClippingArea(){return this._withinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBoundsMin(){return this._elevationBoundsMin}get elevationBoundsMax(){return this._elevationBoundsMax}get level(){return this._lij[0]}get key(){return`${this._lij[0]}/${this._lij[1]}/${this._lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[1].radius}get visible(){return this._dirty&&this.computeVisibility(),this._visible}get frustumVisibility(){return this._dirty&&this.computeVisibility(),this._frustumVisibility}checkVisibility(e){if(this._dirty)return null;let t=this._calculateVisibility(e);if(this._frustumVisibility!==t||this._visible!==(t!==2&&this._intersectsClippingArea))throw Error(`Assertion failed: waterproof.visibility-cache-mismatch: Tile[${this.lij}]`);return t}computeVisibility(){this._dirty=!1;let e=this.parent?.frustumVisibility??1;this._frustumVisibility=this._calculateVisibility(e);let t=this._frustumVisibility!==2&&this._intersectsClippingArea;t!==this._visible&&(this._visible=t,this._surface.emit(`tiles-visibility-changed`),this._surface.renderer.setDirty(),this.updateAgentSuspension())}_calculateVisibility(e){let t=this.parent;return e===0?0:t!=null&&e===2&&this._elevationBoundsMin>=t._elevationBoundsMin&&this._elevationBoundsMax<=t._elevationBoundsMax?2:this._calculateFrustumVisibility(this.surface.frustum,this._surface.view.frustum.boundingSphere)}get _loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){let e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit(`tiles-visibility-changed`),this._previouslyRendered=e,this._surface.renderer.setDirty()),e}init(e,t,n,r,i){this._lij[0]=e,this._lij[1]=t,this._lij[2]=n,this.ellipsoid=p(i.tilingScheme.spatialReference),i.tilingScheme.getExtent(e,t,n,this.extent),i.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this.extentMidX=.5*(this.extent[0]+this.extent[2]),this.extentMidY=.5*(this.extent[1]+this.extent[3]),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,i.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[1].radius=0,this.elevationLevel=e,this._lastElevationSourceUpdateRequestSignature=null,r&&!Number.isNaN(r.elevationBoundsMin)?(this._elevationBoundsMin=r.elevationBoundsMin,this._elevationBoundsMax=r.elevationBoundsMax):(this._elevationBoundsMin=0,this._elevationBoundsMax=0),this._pendingUpdates=0,this.renderData=null,this.screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=r,this.clearChildren(),this._surface=i,this.updateVisibility(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0;for(let e of E){let t=i.numLayers(e),n=this.layerInfo[e];for(let e of n)e.release();n.length=t;for(let r=0;r<t;r++)n[r]=U.acquire(this._surface.upsampleInfoPool),e===0&&this.findElevationBoundsForLayer(r,-1)}this.computeElevationBounds(),this._maxTesselation=Math.min(i.tilingScheme.pixelSize,te)}dispose(){A(!this.renderData,`tile.renderData was not unloaded`),this._surface?.upsampleMapCache.pop(this.key),this.layerInfo.forEach(e=>{e.forEach(e=>e.release()),e.length=0}),this._surface=this._parent=null,this.clearChildren(),this.setMemoryDirty()}refMapData(){++this._mapDataRefCount,this._cached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){--this._mapDataRefCount,this._cached&&this.cachedMemory>0&&this._surface.upsampleMapCache.put(this.key,new D(e(this)))}setMemoryDirty(){this._usedMemory=0}get usedMemory(){return this._ensureUsedMemory()+(this._cached?0:this.mapDataMemory)}get cachedMemory(){return this._ensureUsedMemory(),this._surface==null?this.usedMemory:this._cached?this.mapDataMemory:0}get mapDataMemory(){return this._rasterTileMemory+this._vectorTileMemory}get _cpuImageMemorySize(){let e=this._surface.tilingScheme.pixelSize;return e*e*4}_ensureUsedMemory(){if(this._usedMemory>0)return this._vectorTileMemory=this.layerInfo[1].reduce((e,{data:t})=>e+(k(t)?t.usedMemoryPerReference:0),0),this._usedMemory;this._usedMemory=this._baseUsedMemory,this._rasterTileMemory=0,this._vectorTileMemory=0;for(let{data:e}of this.layerInfo[1])k(e)?this._vectorTileMemory+=e.usedMemoryPerReference:this._rasterTileMemory+=this.getTerrainDataMemory(e);for(let e of this.layerInfo[0])this._usedMemory+=e.data?this._cpuImageMemorySize:0;return this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._rasterTileMemory+=this.renderData.texture?.usedMemory??0),this._cached&&this._surface.upsampleMapCache.updateSize(this.key),this._usedMemory}getUsedMemoryForLayer(e,t){let n=this.layerInfo[e][t];return n?.data?e===1?this._cached?0:this.getTerrainDataMemory(n.data):e===0?this._cpuImageMemorySize:0:0}getTerrainDataMemory(e){return ne(e)?e.texture.usedMemory:re(e)?e.memoryUsage:k(e)?e.usedMemoryPerReference:ie(e)?this._cpuImageMemorySize:0}updateScreenDepth(e){let[t,n,r]=this._center[1].center,i=e,a=i[2]*t+i[6]*n+i[10]*r+i[14];this.screenDepth=a<0?0:a/(i[3]*t+i[7]*n+i[11]*r+i[15])}shouldSplit(e,t,n){if(!this.visible||e.frustum&&!(this._intersectsClippingArea&&this._calculateFrustumVisibility(e.frustum)!==2))return 0;let r=this.level;i(Q,this._center[1].center,t);let u=a(Q),d=this._closestCenterOnElevationRange(t,fe),f=i(pe,d,t),p=Math.min(u,a(f));if(this._edgeLen2>p&&r<e.maxLod)return 1;let m=Math.sqrt(p),h=e.fovX*m*2,g=this._edgeLen/h,_=()=>{if(r<e.maxLod)return this.elevationLevel=r,0;let t=r+Math.ceil(-Math.log2(e.relativeWidthLimit/g));return t===this.elevationLevel?0:(this.elevationLevel=t,2)},v=n==null?1/0:n-r;if(v<=.5)return _();let y=o(this.up,Q),b=this._elevationBoundsMax-this._elevationBoundsMin,x=b/this.edgeLen;if(e.aboveGround&&y>0&&x<.001&&y/m-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-x>0)return _();let S=n==null?1:3-Math.min(v,2);if(g*S<e.relativeWidthLimit||r>=e.maxLod)return _();if(r<7)return 1;s($,this.up,y),i($,$,f);let C=a($);if(C<=this.radius*this.radius)return 1;s($,$,this.radius/Math.sqrt(C)),c($,$,d),i($,t,$);let w=Math.min(1,(Math.abs(o($,this.up))+.5*b+this._curvatureHeight)/l($)),T=.1/e.angledSplitBias,E=e.fovY*m*2;return w*(this._edgeLen/E*S)<T*e.relativeHeightLimit?_():1}needsElevationSourceUpdate(){let e=this.renderData?.geometryState.samplerDataSourceLevels;if(e==null)return!1;let t=Math.max(this.elevationLevel-this.elevationLevelDelta,0);return e.some(e=>e>t)&&this._lastElevationSourceUpdateRequestSignature!==this._elevationSourceUpdateRequestSignature(e)}markElevationSourceUpdateRequested(){let e=this.renderData?.geometryState.samplerDataSourceLevels;this._lastElevationSourceUpdateRequestSignature=e==null?null:this._elevationSourceUpdateRequestSignature(e)}_elevationSourceUpdateRequestSignature(e){return`${Math.max(this.elevationLevel-this.elevationLevelDelta,0)}:${e.join(`,`)}`}createChildren(){let e=this._children,t=this.lij[0]+1,n=this.lij[1]*2,r=this.lij[2]*2;return e[0]=this.surface.createTile(t,n,r,this),e[1]=this.surface.createTile(t,n,r+1,this),e[2]=this.surface.createTile(t,n+1,r,this),e[3]=this.surface.createTile(t,n+1,r+1,this),e}clearChildren(){this._children[0]=this._children[1]=this._children[2]=this._children[3]=null}get loaded(){return this.renderData?.hasGeometry??!1}get hasGeometryState(){return this.renderData?.geometryState!=null}load(){this.refMapData();for(let e of E)this._createOrUpdateAgents(0,e);this.surface.renderer.loadTile(this)}unload(){this.renderData&&this.unrefMapData(),this.surface.renderer.unloadTile(this);for(let e of E){let t=this.layerInfo[e];for(let e of t)e.loadingAgent&&e.loadingAgent!==H&&(G(e.loadingAgent),e.loadingAgent=null),e.pendingUpdates=0}this.resetPendingUpdate(8),this.resetPendingUpdate(16),this.resetPendingUpdate(32)}unloadMapData(){let e=this.layerInfo[1];for(let t of e)t.loadingAgent&&t.loadingAgent!==H&&(G(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0,t.invalidateSourceData();this.renderData?.releaseTexture(),this.setMemoryDirty()}updateClippingStatus(e){if(h(e,this._clippingArea))return!1;let t=this._intersectsClippingArea,n=this._withinClippingArea;e==null?(this._intersectsClippingArea=!0,this._withinClippingArea=!0):(this._intersectsClippingArea=this.intersectsExtent(e),this._withinClippingArea=this._isWithinExtent(e)),this._clippingArea=e,this.updateVisibility();let r=n&&this._withinClippingArea,i=!n&&!t&&!this._withinClippingArea&&!this._intersectsClippingArea;return this.renderData&&!(r||i)&&this.setPendingUpdate(8),!0}updateVisibility(){this._dirty=!0,this._surface.setTileTreeDirty(!1)}getLayerInfo(e,t){return this.layerInfo[t][e]}hasLayerData(e,t){let n=this.layerInfo[t][e];return!(!n?.data||n.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(let e of E){let t=this.layerInfo[e];for(let e of t)if(e.loadingAgent&&e.loadingAgent!==H&&e.loadingAgent.updating)return!0}return!1}_isSuspended(e){return this.hasPendingUpdate(1)?!0:e!==0&&!this._loadable}get hasPendingUpdates(){return this._pendingUpdates!==0}hasPendingUpdate(e){return(this._pendingUpdates&e)===e}setPendingUpdate(e){let t=this._pendingUpdates;return this._pendingUpdates|=e,e===1||e===4?this._surface.setTileTreeDirty(!0):this._surface.requestUpdate(),t!==this._pendingUpdates}resetPendingUpdate(e){return this.hasPendingUpdate(e)?(this._pendingUpdates&=~e,!0):!1}requestLayerData(e,t,r){let i=this.layerInfo[t][e];if(i.waitingAgents.has(r))return console.warn(`agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)`,this._lij.toString(),r.tile.lij.toString(),t,e),!0;if(i.waitingAgents.push(r),i.data&&!i.dataInvalidated){console.warn(`agent requested existing data (tile %s, agent tile %s, layer: %d/%d)`,this._lij.toString(),r.tile.lij.toString(),t,e);let n=k(i.data);return r.dataArrived(this,n),!0}if(i.requestPromise)return!0;n(i.requestAbort),i.requestAbort=new AbortController;let a=this._surface.requestTileData(this,e,t,{signal:i.requestAbort.signal});if(!a)return i.requestAbort=null,!1;let o=()=>{i.requestPromise===a&&(i.requestPromise=null,i.requestAbort=null)};return i.requestPromise=a,a.then(o,o),!0}get leaf(){return this._children[0]==null}hasLij(e){return this._lij[0]===e[0]&&this._lij[1]===e[1]&&this._lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;let t=this._children;return t[0]?t[0].findByLij(e)||t[1].findByLij(e)||t[2].findByLij(e)||t[3].findByLij(e):null}distanceToSquared(e){return a(i($,this._center[1].center,e))}containsPoint(e){let t=this.extent;return e[0]>=t[0]&&e[1]>=t[1]&&e[0]<=t[2]&&e[1]<=t[3]}containsPointXY(e,t){let n=this.extent;return e>=n[0]&&t>=n[1]&&e<=n[2]&&t<=n[3]}unrequestLayerData(e,t,n){let r=this.layerInfo[t][e],i=r.waitingAgents,a=i.removeUnordered(n)!=null;A(a,`agent has not requested this piece of map data`),i.length<1&&(r.abortRequest(),this.setMemoryDirty())}dataArrived(e,t,n){let r=k(n),i=this.layerInfo[t][e];i.data=n,i.dataInvalidated=!1,i.waitingAgents.forAll(e=>e.dataArrived(this,r)),i.waitingAgents.clear(),this.setMemoryDirty()}dataMissing(e,t){let n=this.layerInfo[t][e];n.dataMissing=!0,n.waitingAgents.forAll(e=>e.dataMissing()),n.waitingAgents.clear(),this.setMemoryDirty()}updateRenderData(e,t,n){switch(n&&this.forEachLoadedNeighbor(n=>n.updateRenderData(e,t)),e){case 1:return this._updateTexture(t);case 0:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(e===0?16:32),this.setPendingUpdate(e===0?32:16))}_updateGeometry(){this.setPendingUpdate(8);for(let e of this.layerInfo[0])e.pendingUpdates|=8}invalidateLayerData(e,t){this.layerInfo[t][e].invalidateSourceData()}computeElevationBounds(){let e=this._elevationBoundsMin,t=this._elevationBoundsMax,n=1/0,r=-1/0,i=this.layerInfo[0],a=!0;for(let e of i)e.elevationBounds!=null&&(n=Math.min(n,e.elevationBounds.minElevation),r=Math.max(r,e.elevationBounds.maxElevation),e.elevationBounds.hasNoDataValues||(a=!1));a&&(n=Math.min(n,0),r=Math.max(r,0)),(e!==n||t!==r)&&(this._elevationBoundsMin=n,this._elevationBoundsMax=r,this.updateRadiusAndCenter(),this._surface.setTileTreeDirty(!1))}_updateCenter(){let e=this._elevationBoundsMin,t=this._elevationBoundsMax,n=.5*(e+t),r=this._center;s($,this.up,n),c(r[1].center,this.centerAtSeaLevel,$),s($,this.up,e),c(r[0],this.centerAtSeaLevel,$),s($,this.up,t),c(r[2],this.centerAtSeaLevel,$)}_closestCenterOnElevationRange(e,t){if(this._surface.viewingMode===1){if(this.level===0)return u(t,this._center[1].center);let n=o(this.up,e),r=Math.max(this.ellipsoid.radius+this._elevationBoundsMin,Math.min(this.ellipsoid.radius+this._elevationBoundsMax,n));return s(t,this.up,r)}let n=Math.max(this._elevationBoundsMin,Math.min(this._elevationBoundsMax,e[2]));return t[0]=this.centerAtSeaLevel[0],t[1]=this.centerAtSeaLevel[1],t[2]=n,t}findElevationBoundsForLayer(e,t){let n=this.layerInfo[0][e],r=this.elevationLevelDelta,i=Math.max(this.elevationLevel-r,0),a=n.elevationBounds;if(a!=null&&a.level>t&&a.level<=i)return;let o=this._surface.layerViewByIndex(e,0);if(!W(this,o))return;let s=ue,c=!1,l=n.data;if(l&&l.level<=i){let e=n.data;s.minElevation=e.samplerData.data.minValue,s.maxElevation=e.samplerData.data.maxValue,s.hasNoDataValues=e.samplerData.data.hasNoDataValues,s.level=this.level,c=!0}else{let t=0,n,a;for(let o=this._parent;o&&(!a||t<r)&&(t=this.elevationLevel-o.level,n=a||n,a=o.layerInfo[0][e].data,!(!a&&n&&o.level<=i));o=o.parent);a||=n,a&&(a.computeMinMaxValue(this._lij[0],this._lij[1],this._lij[2],s),s.minElevation!==1/0&&(s.level=a.level,c=!0))}c&&(n.elevationBounds??=new C,n.elevationBounds.copyFrom(s))}modifyLayers(e,t,n){let r=this.layerInfo[n];for(let e of r)e.loadingAgent&&e.loadingAgent!==H&&(G(e.loadingAgent),e.loadingAgent=null),e.waitingAgents.clear();for(let t=0;t<r.length;++t)e[t]===void 0&&r[t].release();let i=new Array(...r),a=t.length;r.length=a;for(let e=0;e<a;e++){let n=t[e];r[e]=n>-1?i[n]:U.acquire(this._surface.upsampleInfoPool)}this.setMemoryDirty()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,0))}updateAgents(e){if(this.renderData){let t=this.layerInfo[e];for(let e of t)e.loadingAgent===H&&(e.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(let e of E){let t=this._isSuspended(e);for(let n of this.layerInfo[e])n.loadingAgent&&n.loadingAgent!==H&&(n.loadingAgent.setSuspension(t),n.loadingAgent===H&&this.updateRenderData(e,0))}}removeLayerAgent(e,t){let n=this.layerInfo[t][e];n.loadingAgent&&n.loadingAgent!==H&&n.loadingAgent.dispose(),n.loadingAgent=null}agentDone(e,t){let n=this.layerInfo[t][e];n.loadingAgent=H,!n.data&&n.upsampleInfo==null&&this._createOrUpdateAgents(e+1,t)}_hasBlendableAncestor(e){return e.blendMode!==`normal`||x(e.parent)&&this._hasBlendableAncestor(e.parent)}_hasBlendModes(e,t,n){for(let r=e;r<t;++r){let e=this._surface.layerViewByIndex(r,n);if(ae(e)&&e?.layer?.blendMode!==`normal`||x(e?.layer?.parent)&&this._hasBlendableAncestor(e?.layer?.parent))return!0}return!1}_createOrUpdateAgents(e,t){let n=this.layerInfo[t];if(n.length===0)return;let r=this._isSuspended(t),i=!1;for(let a=e;a<n.length;++a){let o=n[a],s=this._surface.layerViewByIndex(a,t),c=!1;(!i||S(s))&&(o.loadingAgent?W(this,s)?(o.loadingAgent!==H&&o.loadingAgent.setSuspension(r),o.loadingAgent!==H&&(c=o.loadingAgent.update())):o.dispose():W(this,s)&&(o.loadingAgent=le(this,a,t,r),c=o.loadingAgent.startLoading(),c?o.loadingAgent===H&&this.setPendingUpdate(8):(G(o.loadingAgent),o.loadingAgent=H)),o.loadingAgent===H&&this.updateRenderData(t,0),!s.destroyed&&!this._hasBlendModes(e,n.length,t)&&c&&s.isOpaque&&(i||=!0))}}_isWithinExtent(e){let t=this.extent;return t[0]>=e[0]&&e[2]>=t[2]&&t[1]>=e[1]&&e[3]>=t[3]}intersectsExtent(e){let t=this.extent;return t[2]>=e[0]&&e[2]>=t[0]&&t[3]>=e[1]&&e[3]>=t[1]}getElevationVerticesPerSide(e){let n=this.elevationLevel-this.level,r=Math.max(this.level-e,this.elevationLevelDelta-n),i=t((this._maxTesselation>>r)+1,2,this._maxTesselation+1),a=this.minimumVerticesPerSide;return Math.max(i,a)}_findLIJ(e,t){if(!e)return null;let{rootTiles:n}=this.surface;if(n!=null){for(let r of n)if(de(r,e)){let n=r,i=e[0]-n.level-1;for(;i>=0&&!n.leaf&&!t(n);){let t=e[1]>>i&1,r=e[2]>>i&1;n=n.children[t*2+r],i--}return t(n)?n:null}}return null}findNeighborTile(e,t){let n=this._lij,r=this._getNeighborLIJ(n,e);return r?J(n,r)?t(this)?this:null:this._findLIJ(r,t):null}findCorner(e,t){let n=e===1?1:e===7?0:e===5?2:3,r=this;for(;r.children[0]&&(!t||!t(r));)r=r.children[n];return r}findNeighborCornerTileExact(e,t){return this.findNeighborTile(e,e=>t(e)||e.level===this.level)?.findCorner(j(e),t)||null}forAllSubtreeOnSide(e,t){let n=e===0?[0,1]:e===1?[1]:e===2?[1,3]:e===3?[3]:e===4?[2,3]:e===5?[2]:e===6?[0,2]:[0],r=e=>{let i=e.children;!t(e)&&i[0]&&n.forEach(e=>r(i[e]))};r(this)}getNeighborEdgeStartVertexIndex(e,t){if(!t)return 0;let n=this.level-t.level;if(M(!N||n>=0),n===0)return 0;let r=2**n,i=(e&1)==1,a=+!i,o=t.lij[a+1]*r,s=this._lij[a+1],c=s-o,l=i?r-1-c:c;return N&&(M(o<=s&&s<o+r),M(0<=l&&l<r)),l}forEachLoadedNeighbor(e){let t=this.level,n=e=>e.level===t||e.loaded;P.forEach(t=>{let r=this.findNeighborTile(t,n);r!=null&&r!==this&&r.forAllSubtreeOnSide(F(t),n=>n.loaded?(e(n,t),!0):!1)}),I.forEach(t=>{let r=this.findNeighborTile(t,n)?.findCorner(j(t),e=>e.loaded);N&&M(!r||Y(this,r,t)),r?.loaded&&e(r,t)})}_getNeighborLIJ(e,t){let n=R(t)?-1:+!!z(t),r=B(t)?-1:+!!V(t),i=[e[0],e[1]+n,e[2]+r];return i[1]<0?null:this.surface.isGlobal?this._wrapLIJ(i):i[2]<0?null:i}_wrapLIJ(e){return!e||e[1]<0||e[1]>=2**e[0]?null:this.surface.wrapEastWest(e)}isEdgeNeighbor(e,t){if(e==null)return!1;if(this.level===0&&e.level===0&&(this._eastEnd&&e._westEnd&&t===2||this._westEnd&&e._eastEnd&&t===6))return!0;let n=Math.max((this.extent[2]-this.extent[0])*1e-6,1);switch(t){case 0:return L(this.extent[3],e.extent[1],n);case 4:return L(this.extent[1],e.extent[3],n);case 2:return L(this.extent[2],e.extent[0],n)||L(this.extent[2],-e.extent[0],n);case 6:return L(this.extent[0],e.extent[2],n)||L(this.extent[0],-e.extent[2],n)}}get _eastEnd(){return this._lij[2]===this.surface.lijEastEnd(this.level)-1}get _westEnd(){return this._lij[2]===0}checkGeometryWaterproofness(){}shouldHaveNeighbor(e){let t=this.extent,{rootTilesExtent:n}=this._surface,r=(t[2]-t[0])*.25;if(R(e)&&t[3]+r>=n[3]||z(e)&&t[1]-r<=n[1])return!1;let i=this.surface.isGlobal;return!(!i&&B(e)&&t[0]-r<=n[0]||!i&&V(e)&&t[2]+r>=n[2])}updateDistanceToPOI(e){let t=this._lastPOI;if(this.distanceToPOI>=0&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return;u(this._lastPOI,e);let n=this._center[1].center,r=e[0]-n[0],i=e[1]-n[1],a=e[2]-n[2];this.distanceToPOI=r*r+i*i+a*a}updateOverlayParameters(e){let{renderData:t}=this;if(!t)return;let{overlays:n,longitudeCyclical:r}=e,i=t.overlay;if(n.length===0)this._clearTileOverlayData(0,i),this._clearTileOverlayData(1,i);else{let[e,t]=n,a=this.extent;g(e.extent,a,r)||_(a,e.extent,r)||_(a,t.extent,r)?(this._setOverlayData(n,r,a,0,i),this._setOverlayData(n,r,a,1,i)):(this._clearTileOverlayData(0,i),this._clearTileOverlayData(1,i))}}_setOverlayData(e,t,n,r,i){let a=e[r].extent,o=v(a),s=y(a),c=n[0];if(t){c=t.minimalMonotonic(a[0],c);let e=t.minimalMonotonic(a[0],n[2]);c>e&&(c=e-(n[2]-n[0]))}if(o===0||s===0){i.setOffsetAndScale(r,0,0,1,1);return}let l=v(n)/o,u=y(n)/s,d=(c-a[0])/o,f=(n[1]-a[1])/s;i.setOffsetAndScale(r,d,f,l,u)}_clearTileOverlayData(e,t){t.setOffsetAndScale(e,-1,-1,-1,-1)}}function le(e,t,n,r){let i=n===0?q.acquire():K.acquire();return i.init(e,t,n,r),i}function G(e){e.dispose(),T(e)?q.release(e):ee(e)&&K.release(e)}const K=new r(()=>new O),q=new r(()=>new w),ue=new C;function de(e,t){let n=e.lij,r=t[0]-n[0];return r<0?!1:t[1]>>r===n[1]&&t[2]>>r===n[2]}function J(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Y(e,t,n){return e==null||t==null||t===e?!1:e.level>=t.level?X(e,t,n):X(t,e,j(n))}function X(e,t,n){M(e.level>=t.level);let r=oe(n),i=se(n),a=e.extent,o=t.extent,s=[r?a[0]:a[2],i?a[3]:a[1]],c=[r?o[2]:o[0],i?o[1]:o[3]],l=(a[2]-a[0])*1e-5,u=L(s[0],c[0],l)||e.surface.isGlobal&&L(s[0],-c[0],l),d=L(s[1],c[1],l);if(u&&d)return!0;if(e.level===t.level||!u&&!d)return M(!1),!1;let f=u?Z(o[1],o[3],a[1],a[3],l):Z(o[0],o[2],a[0],a[2],l);return M(f),f}function Z(e,t,n,r,i){return e-i<=n&&n<=r&&r<=t+i}const Q=d(),fe=d(),pe=d(),$=d();export{ce as Tile,Y as isCornerNeighbor,J as lijEquals};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../core/PooledArray.js";import{isImageryTileLayerView as t}from"./terrainUtils.js";class n{constructor(){this._queue=new e,this.remove=()=>{}}get done(){return this._queue.length===0&&(!this._last||this._last.leaf)}resetOne(e){this._queue.clear(),this._queue.push(e),this._last=void 0}reset(e=null){this._queue.clear(),e!=null&&this._queue.pushArray(e),this._last=void 0}skipSubtree(){this._last=void 0}next(){let e=this._last?.children;return e?.[0]&&this._queue.pushArray(e),this._last=this._queue.pop(),this._last}}class r{constructor(){this._q=new e}get done(){return this._q.length===0}reset(e){if(this._q.clear(),e!=null){this._q.pushArray(e);for(let e=0;e<this._q.length;++e){let t=this._q.data[e];t.leaf||this._q.pushArray(t.children)}}}next(){return this._q.pop()}}function i(e,t,n=()=>!0){if(Array.isArray(e))for(let r=0;r<e.length;r++)a(e[r],t,n);else a(e,t,n)}function a(e,t,n=()=>!0){if(t(e),!e.leaf&&n(e))for(let n of e.children)a(n,t)}function o(e,t){let n=e.extent;return!(t.xmin>n[2]||t.ymin>n[3]||t.xmax<n[0]||t.ymax<n[1])}function s(e,t,n){let r=e.surface.tilingScheme.levels[e.level].scale;return!(t&&t>0&&r>t*1.00000001||n&&n>0&&r<n*.99999999)}function c(e,t){if(t==null||t.destroyed)return!1;let n=l(t);return!(n?.fullExtent==null||!o(e,n.fullExtent)||!s(e,n.minScale,n.maxScale))}function l(e){return t(e)?{fullExtent:e.fullExtent,minScale:e.layer.minScale,maxScale:e.layer.maxScale}:e.layer}function u(e,t){let n=e.lij,r=t.lij;return n[0]-r[0]||n[1]-r[1]||n[2]-r[2]}function d(e,t=null){return t==null||t.length===0?e.sort(f):e.sort((e,n)=>m(e,n,t))}function f(e,t){let n=e.screenDepth-t.screenDepth;if(n!==0)return n;let r=e.lij,i=t.lij;return r[0]-i[0]||r[1]-i[1]||r[2]-i[2]}function p(e,t){let n=e.screenDepth,r=t.screenDepth;return n<r?-1:n>r?1:u(e,t)}function m(e,t,n){return h(e,n)===h(t,n)?p(e,t):e?1:-1}function h(e,t){for(let n of t)if(e.intersectsExtent(n))return!0;return!1}function g(e,t){let n=e.distanceToPOI-t.distanceToPOI;if(n!==0)return n;let r=e.lij,i=t.lij;return r[0]-i[0]||r[1]-i[1]||r[2]-i[2]}function _(e,t){let n=e.length;for(let r=0;r<n;++r)e.at(r).updateDistanceToPOI(t);e.sort(g)}function v(e,t,n){let r=1,i=0,a=0;for(;e!==t;)if(r*=.5,i*=.5,a*=.5,e.lij[2]&1&&(i+=.5),e.lij[1]&1||(a+=.5),e=e.parent,e==null)throw Error(`tile was not a descendant of upsampleTile`);n.init(t,i,a,r)}function y(e){for(let t=0;t<e.length;t++){let n=e[t],r=n.parent;if(r)for(let e=0;e<4;e++){let t=r.children[e];if(t&&t!==n)return!0}}return!1}function b(e,t){if(!e||!t||e[0]===t[0])return!1;let n=e[0]<t[0],r=n?e:t,i=n?t:e,a=1<<i[0]-r[0];return Math.floor(i[1]/a)===r[1]&&Math.floor(i[2]/a)===r[2]}function x(e,t){if(t<=e[0])return[[...e]];let n=1<<t-e[0],r=[],i=e[1]*n,a=e[2]*n;for(let e=0;e<n;++e)for(let o=0;o<n;++o)r.push([t,e+i,o+a]);return r}export{r as IteratorPostorder,n as IteratorPreorder,p as compareTiles,u as compareTilesByLij,m as compareTilesWithStencil,v as computeUpsampleInfo,x as descendantsAtLevel,c as fallsWithinLayerView,y as hasLoadableSiblings,d as sortTiles,_ as sortTilesByPOI,b as tilesAreRelated,i as traverseTilesPreorder};
2
+ import e from"../../../core/PooledArray.js";import{isImageryTileLayerView as t}from"./terrainUtils.js";class n{constructor(){this._queue=new e,this.remove=()=>{}}get done(){return this._queue.length===0&&(!this._last||this._last.leaf)}resetOne(e){this._queue.clear(),this._queue.push(e),this._last=void 0}reset(e=null){this._queue.clear(),e!=null&&this._queue.pushArray(e),this._last=void 0}skipSubtree(){this._last=void 0}next(){let e=this._last?.children;return e?.[0]&&this._queue.pushArray(e),this._last=this._queue.pop(),this._last}}class r{constructor(){this._q=new e}get done(){return this._q.length===0}reset(e){if(this._q.clear(),e!=null){this._q.pushArray(e);for(let e=0;e<this._q.length;++e){let t=this._q.data[e];t.leaf||this._q.pushArray(t.children)}}}next(){return this._q.pop()}}function i(e,t,n=()=>!0){if(Array.isArray(e))for(let r=0;r<e.length;r++)a(e[r],t,n);else a(e,t,n)}function a(e,t,n=()=>!0){if(t(e),!e.leaf&&n(e))for(let n of e.children)a(n,t)}function o(e,t){let n=e.extent;return!(t.xmin>n[2]||t.ymin>n[3]||t.xmax<n[0]||t.ymax<n[1])}function s(e,t,n){let r=e.surface.tilingScheme.levels[e.level].scale;return!(t&&t>0&&r>t*1.00000001||n&&n>0&&r<n*.99999999)}function c(e,t){if(t==null||t.destroyed)return!1;let n=l(t);return!(n?.fullExtent==null||!o(e,n.fullExtent)||!s(e,n.minScale,n.maxScale))}function l(e){return t(e)||e.type===`wmts-3d`?{fullExtent:e.fullExtent,minScale:e.layer.minScale,maxScale:e.layer.maxScale}:e.layer}function u(e,t){let n=e.lij,r=t.lij;return n[0]-r[0]||n[1]-r[1]||n[2]-r[2]}function d(e,t=null){return t==null||t.length===0?e.sort(f):e.sort((e,n)=>m(e,n,t))}function f(e,t){let n=e.screenDepth-t.screenDepth;if(n!==0)return n;let r=e.lij,i=t.lij;return r[0]-i[0]||r[1]-i[1]||r[2]-i[2]}function p(e,t){let n=e.screenDepth,r=t.screenDepth;return n<r?-1:n>r?1:u(e,t)}function m(e,t,n){return h(e,n)===h(t,n)?p(e,t):e?1:-1}function h(e,t){return t?.some(t=>e.intersectsExtent(t))??!1}function g(e,t){let n=e.distanceToPOI-t.distanceToPOI;if(n!==0)return n;let r=e.lij,i=t.lij;return r[0]-i[0]||r[1]-i[1]||r[2]-i[2]}function _(e,t){let n=e.length;for(let r=0;r<n;++r)e.at(r).updateDistanceToPOI(t);e.sort(g)}function v(e,t,n){let r=1,i=0,a=0;for(;e!==t;)if(r*=.5,i*=.5,a*=.5,e.lij[2]&1&&(i+=.5),e.lij[1]&1||(a+=.5),e=e.parent,e==null)throw Error(`tile was not a descendant of upsampleTile`);n.init(t,i,a,r)}function y(e){for(let t=0;t<e.length;t++){let n=e[t],r=n.parent;if(r)for(let e=0;e<4;e++){let t=r.children[e];if(t&&t!==n)return!0}}return!1}function b(e,t){if(!e||!t||e[0]===t[0])return!1;let n=e[0]<t[0],r=n?e:t,i=n?t:e,a=1<<i[0]-r[0];return Math.floor(i[1]/a)===r[1]&&Math.floor(i[2]/a)===r[2]}function x(e,t){if(t<=e[0])return[[...e]];let n=1<<t-e[0],r=[],i=e[1]*n,a=e[2]*n;for(let e=0;e<n;++e)for(let o=0;o<n;++o)r.push([t,e+i,o+a]);return r}export{r as IteratorPostorder,n as IteratorPreorder,p as compareTiles,u as compareTilesByLij,m as compareTilesWithStencil,v as computeUpsampleInfo,x as descendantsAtLevel,c as fallsWithinLayerView,y as hasLoadableSiblings,d as sortTiles,_ as sortTilesByPOI,b as tilesAreRelated,i as traverseTilesPreorder,h as usesStencil};
@@ -15,6 +15,7 @@ import type StreamLayerView from "../layers/StreamLayerView.js";
15
15
  import type VectorTileLayerView from "../layers/VectorTileLayerView.js";
16
16
  import type ViewshedLayerView from "../layers/ViewshedLayerView.js";
17
17
  import type WFSLayerView from "../layers/WFSLayerView.js";
18
+ import type WMTSLayerView from "../layers/WMTSLayerView.js";
18
19
  import type { PointCloudLayerView } from "../layers/PointCloudLayerView.js";
19
20
 
20
21
  /** @since 5.0 */
@@ -100,7 +101,7 @@ export interface LayerView3DMap {
100
101
  /** @since 5.0 */
101
102
  wms: never;
102
103
  /** @since 5.0 */
103
- wmts: never;
104
+ wmts: WMTSLayerView;
104
105
  /** @since 5.1 */
105
106
  "dimension-feature": never;
106
107
  /** @since 5.0 */
@@ -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{removeUnordered as n}from"../../../core/arrayUtils.js";import{toConst as r}from"../../../core/compilerUtils.js";import"../../../core/has.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{isPromiseLike as a}from"../../../core/promiseUtils.js";import{signal as o}from"../../../core/signal.js";import{property as s,subclass as c}from"../../../core/accessorSupport/decorators.js";import{isIntersectionHandler as l}from"../state/helpers/SceneIntersectionHelper.js";import{debugFlags as u}from"../support/debugFlags.js";import{TextureCollection as d}from"../support/TextureCollection.js";import{ChangeSet as f}from"./lib/ChangeSet.js";import{Model as p}from"./parts/Model.js";import{RenderView as m}from"./parts/RenderView.js";import{TaskPriority as h,noBudget as g}from"../../support/Scheduler.js";import{Yield as _}from"../../support/Yield.js";let v=class extends t{constructor(e){super(e),this._model=new p,this._canCompact=o(!1),this._layers=[],this._asyncChangeSet=new f,this._syncChangeSet=new f,this._layerSyncSet=new Set,this._textures=new d(this,e.view.resourceController.scheduler),this._frameTask=e.view.resourceController.scheduler.registerTask(h.STAGE,this),this.addHandles(this._frameTask)}initialize(){try{this._renderView=new m({view:this.view},this)}catch(e){console.error(`Failed to initialize render view`,e);return}}destroy(){this.removeAllHandles(),this._textures.destroy(),this._set(`textures`,null),this._renderView=i(this._renderView),this._set(`renderView`,null),this._layers.length=0,this._model=null,this._set(`renderer`,null),this.options.canvas=null,this._set(`options`,null)}get viewingMode(){return this.view.state.viewingMode}get updating(){if(this.destroyed||this.destroying)return!1;let e=this.readyToRun||this.renderView.updating||this._frameTask.updating||this.textures.updating;return e&&u.UPDATING&&console.log(` Stage:`,this.readyToRun,this.renderView.updating,this._frameTask.updating,this.textures.updating),e}get renderView(){return this._renderView}get renderer(){return this.renderView?.renderer}get textures(){return this._textures}addTexture(e){this._model.addTexture(e),this.renderView.requestRender()}removeTexture(e){e!=null&&!this.destroyed&&this._model.hasTexture(e)&&(this._model.removeTexture(e),this.renderView.requestRender())}addTextures(e){e!=null&&(this._model.addTextures(e),this.renderView.requestRender())}removeTextures(e){e!=null&&(this._model?.removeTextures(e),this.renderView.requestRender())}forEachTexture(e){this._model.forEachTexture(e)}getTexture(e){return this._model.getTexture(e)}addLayer(e){this._layers.includes(e)||(this._model.addLayer(e),this._layers.push(e),this._model.dirtySet.layerAdded(e),this.renderView.requestRender())}removeLayer(e){e!=null&&!this.destroyed&&this._model.hasLayer(r(e))&&(this._model.dirtySet.layerRemoved(e),this.commitLayer(e),n(this._layers,e),this._model.dirtySet.assertLayerClean(e.id),this._model.removeLayer(e),this.renderView.requestRender())}getLayer(e){return this._model.getLayer(e)}handleEvent(e,t){this.destroyed||(this._model.dirtySet[e](t),this.renderView.requestRender())}get readyToRun(){return this._model.dirtySet.dirty||!this._asyncChangeSet.empty||this._canCompact.value}runTask(e){if(this._frameTask.processQueue(e),this._commit(e),this.renderer.compact(e),this._canCompact.value=this.renderer.canCompact,!e.hasProgressed)return _}compact(e){return this._canCompact.value=!1,this.renderer.compact(e)}_commit(e){let t=this._model.dirtySet;!this._asyncChangeSet.empty&&!e.done&&(this.renderer.commit(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()),this._layers.forEach(n=>{if(e.done)return;let r=this._layerSyncSet.has(n.id)||n.updatePolicy===1,i=r?this._syncChangeSet:this._asyncChangeSet;t.commitLayer(n.id,i),this._layerSyncSet.delete(n.id),i.empty||(this.renderer.commit(i,r?g:e),this.renderView.requestRender(),e.madeProgress())}),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,g),this.renderView.requestRender(),e.madeProgress()),this._layers.forEach(n=>{e.done||!this._layerSyncSet.has(n.id)&&n.updatePolicy===0&&(t.commitLayer(n.id,this._asyncChangeSet),this._asyncChangeSet.empty||(this.renderer.commit(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()))}),this._layerSyncSet.clear(),this.notifyChange(`readyToRun`)}commitSyncLayers(){let e=this._model.dirtySet;this._layers.forEach(t=>{this._layerSyncSet.has(t.id)||t.updatePolicy===1?(e.commitLayer(t.id,this._syncChangeSet),this._layerSyncSet.delete(t.id)):e.commitSyncUpdates(t.id,this._syncChangeSet)});for(let t of this._layerSyncSet)e.commitLayer(t,this._syncChangeSet);this._layerSyncSet.clear(),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,g),this.renderView.requestRender())}commitLayer(e){this._model.dirtySet.commitLayer(e.id,this._syncChangeSet),this._layerSyncSet.delete(e.id),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,g),this.renderView.requestRender())}schedule(e,t){return this._frameTask.schedule(e,t)}reschedule(e,t){return this._frameTask.reschedule(e,t)}scheduleGenerator(e,t){return this._frameTask.scheduleGenerator(e,t)}syncLayer(e){this._layerSyncSet.add(e),this.renderView.requestRender()}get layers(){return this._layers}addRenderPlugin(e,t){let n=this.renderer.plugins.add(e,t),r=()=>{l(e)&&this.view.sceneIntersectionHelper.addIntersectionHandler(e)};if(a(n))return n.then(r);r()}removeRenderPlugin(e){this.destroyed||(l(e)&&this.view.sceneIntersectionHelper.removeIntersectionHandler(e),this.renderer.plugins.remove(e))}get test(){}};e([s({constructOnly:!0})],v.prototype,`view`,void 0),e([s({constructOnly:!0})],v.prototype,`options`,void 0),e([s({constructOnly:!0})],v.prototype,`container`,void 0),e([s()],v.prototype,`viewingMode`,null),e([s()],v.prototype,`updating`,null),e([s()],v.prototype,`renderView`,null),e([s()],v.prototype,`renderer`,null),e([s()],v.prototype,`textures`,null),e([s()],v.prototype,`readyToRun`,null),v=e([c(`esri.views.3d.webgl-engine.Stage`)],v);export{v as Stage};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{removeUnordered as n}from"../../../core/arrayUtils.js";import{toConst as r}from"../../../core/compilerUtils.js";import"../../../core/has.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{isPromiseLike as a}from"../../../core/promiseUtils.js";import{signal as o}from"../../../core/signal.js";import{property as s,subclass as c}from"../../../core/accessorSupport/decorators.js";import{isIntersectionHandler as l}from"../state/helpers/SceneIntersectionHelper.js";import{debugFlags as u}from"../support/debugFlags.js";import{TextureCollection as d}from"../support/TextureCollection.js";import{ChangeSet as f}from"./lib/ChangeSet.js";import{Model as p}from"./parts/Model.js";import{RenderView as m}from"./parts/RenderView.js";import{TaskPriority as h,noBudget as g}from"../../support/Scheduler.js";import{Yield as _}from"../../support/Yield.js";let v=class extends t{constructor(e){super(e),this._model=new p,this._canCompact=o(!1),this._layers=[],this._asyncChangeSet=new f,this._syncChangeSet=new f,this._layerSyncSet=new Set,this._textures=new d(this,e.view.resourceController.scheduler),this._frameTask=e.view.resourceController.scheduler.registerTask(h.STAGE,this),this.addHandles(this._frameTask)}initialize(){try{this._renderView=new m({view:this.view},this)}catch(e){console.error(`Failed to initialize render view`,e);return}}destroy(){this.removeAllHandles(),this._textures.destroy(),this._set(`textures`,null),this._renderView=i(this._renderView),this._set(`renderView`,null),this._layers.length=0,this._model=null,this._set(`renderer`,null),this.options.canvas=null,this._set(`options`,null)}get viewingMode(){return this.view.state.viewingMode}get updating(){if(this.destroyed||this.destroying)return!1;let e=this.readyToRun||this.renderView.updating||this._frameTask.updating||this.textures.updating;return e&&u.UPDATING&&console.log(` Stage:`,this.readyToRun,this.renderView.updating,this._frameTask.updating,this.textures.updating),e}get localOriginFactory(){return this._model.localOriginFactory}get renderView(){return this._renderView}get renderer(){return this.renderView?.renderer}get textures(){return this._textures}addTexture(e){this._model.addTexture(e),this.renderView.requestRender()}removeTexture(e){e!=null&&!this.destroyed&&this._model.hasTexture(e)&&(this._model.removeTexture(e),this.renderView.requestRender())}addTextures(e){e!=null&&(this._model.addTextures(e),this.renderView.requestRender())}removeTextures(e){e!=null&&(this._model?.removeTextures(e),this.renderView.requestRender())}forEachTexture(e){this._model.forEachTexture(e)}getTexture(e){return this._model.getTexture(e)}addLayer(e){this._layers.includes(e)||(this._model.addLayer(e),this._layers.push(e),this._model.dirtySet.layerAdded(e),this.renderView.requestRender())}removeLayer(e){e!=null&&!this.destroyed&&this._model.hasLayer(r(e))&&(this._model.dirtySet.layerRemoved(e),this.commitLayer(e),n(this._layers,e),this._model.dirtySet.assertLayerClean(e.id),this._model.removeLayer(e),this.renderView.requestRender())}getLayer(e){return this._model.getLayer(e)}handleEvent(e,t){this.destroyed||(this._model.dirtySet[e](t),this.renderView.requestRender())}get readyToRun(){return this._model.dirtySet.dirty||!this._asyncChangeSet.empty||this._canCompact.value}runTask(e){if(this._frameTask.processQueue(e),this._commit(e),this.renderer.compact(e),this._canCompact.value=this.renderer.canCompact,!e.hasProgressed)return _}compact(e){return this._canCompact.value=!1,this.renderer.compact(e)}_commit(e){let t=this._model.dirtySet;!this._asyncChangeSet.empty&&!e.done&&(this.renderer.commit(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()),this._layers.forEach(n=>{if(e.done)return;let r=this._layerSyncSet.has(n.id)||n.updatePolicy===1,i=r?this._syncChangeSet:this._asyncChangeSet;t.commitLayer(n.id,i),this._layerSyncSet.delete(n.id),i.empty||(this.renderer.commit(i,r?g:e),this.renderView.requestRender(),e.madeProgress())}),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,g),this.renderView.requestRender(),e.madeProgress()),this._layers.forEach(n=>{e.done||!this._layerSyncSet.has(n.id)&&n.updatePolicy===0&&(t.commitLayer(n.id,this._asyncChangeSet),this._asyncChangeSet.empty||(this.renderer.commit(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()))}),this._layerSyncSet.clear(),this.notifyChange(`readyToRun`)}commitSyncLayers(){let e=this._model.dirtySet;this._layers.forEach(t=>{this._layerSyncSet.has(t.id)||t.updatePolicy===1?(e.commitLayer(t.id,this._syncChangeSet),this._layerSyncSet.delete(t.id)):e.commitSyncUpdates(t.id,this._syncChangeSet)});for(let t of this._layerSyncSet)e.commitLayer(t,this._syncChangeSet);this._layerSyncSet.clear(),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,g),this.renderView.requestRender())}commitLayer(e){this._model.dirtySet.commitLayer(e.id,this._syncChangeSet),this._layerSyncSet.delete(e.id),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,g),this.renderView.requestRender())}schedule(e,t){return this._frameTask.schedule(e,t)}reschedule(e,t){return this._frameTask.reschedule(e,t)}scheduleGenerator(e,t){return this._frameTask.scheduleGenerator(e,t)}syncLayer(e){this._layerSyncSet.add(e),this.renderView.requestRender()}get layers(){return this._layers}addRenderPlugin(e,t){let n=this.renderer.plugins.add(e,t),r=()=>{l(e)&&this.view.sceneIntersectionHelper.addIntersectionHandler(e)};if(a(n))return n.then(r);r()}removeRenderPlugin(e){this.destroyed||(l(e)&&this.view.sceneIntersectionHelper.removeIntersectionHandler(e),this.renderer.plugins.remove(e))}get test(){}};e([s({constructOnly:!0})],v.prototype,`view`,void 0),e([s({constructOnly:!0})],v.prototype,`options`,void 0),e([s({constructOnly:!0})],v.prototype,`container`,void 0),e([s()],v.prototype,`viewingMode`,null),e([s()],v.prototype,`updating`,null),e([s()],v.prototype,`renderView`,null),e([s()],v.prototype,`renderer`,null),e([s()],v.prototype,`textures`,null),e([s()],v.prototype,`readyToRun`,null),v=e([c(`esri.views.3d.webgl-engine.Stage`)],v);export{v as Stage};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{If as e,glsl as t}from"../../shaderModules/glsl.js";import{sourceIndexMask as n,descriptorDataShift as r,descriptorDataMask as i,descriptorTypeShift as a,descriptorCapSideShift as o,descriptorCapSubdivisionMask as s,descriptorShift as c,frameIndexMask as l}from"../../../lib/PathVertexInfo.js";function u(u,d){let{attributes:f,vertex:p}=u;f.add(`pathVertexInfo`,`uint`),p.constants.add(`pathVertexDescriptorSourceIndexMask`,`uint`,n),p.constants.add(`pathVertexDescriptorDataShift`,`uint`,r),p.constants.add(`pathVertexDescriptorDataMask`,`uint`,i),p.constants.add(`pathVertexDescriptorTypeShift`,`uint`,a),p.constants.add(`pathVertexDescriptorCapSideShift`,`uint`,o),p.constants.add(`pathVertexDescriptorCapSubdivisionMask`,`uint`,s),p.constants.add(`pathVertexInfoDescriptorShift`,`uint`,c),p.constants.add(`pathVertexInfoFrameIndexMask`,`uint`,l),p.constants.add(`pathVertexCapSideEnd`,`uint`,1),p.constants.add(`pathVertexTypeJoin`,`uint`,0),p.constants.add(`pathVertexTypeCapConnectingProfile`,`uint`,1),p.constants.add(`pathVertexTypeCapProfile`,`uint`,2),d.pathCapType===3&&p.constants.add(`pathVertexTypeRoundCapInnerProfile`,`uint`,3),p.code.add(t`
2
+ import{getPackedUint32Field as e}from"../util/PackedUint32.glsl.js";import{glsl as t,If as n}from"../../shaderModules/glsl.js";import{pathVertexInfoPacking as r,pathVertexCapDataPacking as i}from"../../../lib/PathVertexInfo.js";function a(a,o){let{attributes:s,vertex:c}=a;s.add(`pathVertexInfo`,`uint`),c.constants.add(`pathVertexCapSideEnd`,`uint`,1),c.constants.add(`pathVertexTypeJoin`,`uint`,0),c.constants.add(`pathVertexTypeCapConnectingProfile`,`uint`,1),c.constants.add(`pathVertexTypeCapProfile`,`uint`,2),o.pathCapType===3&&c.constants.add(`pathVertexTypeRoundCapInnerProfile`,`uint`,3),c.code.add(t`
3
3
  struct PathVertexDescriptor {
4
4
  uint sourceIndex;
5
5
  uint subdivision;
@@ -8,14 +8,13 @@ import{If as e,glsl as t}from"../../shaderModules/glsl.js";import{sourceIndexMas
8
8
  };
9
9
 
10
10
  uint getFrameIndex() {
11
- return pathVertexInfo & pathVertexInfoFrameIndexMask;
11
+ return ${e(r,0,t`pathVertexInfo`)};
12
12
  }
13
13
 
14
14
  PathVertexDescriptor getDescriptor() {
15
- uint descriptor = pathVertexInfo >> pathVertexInfoDescriptorShift;
16
- uint sourceIndex = descriptor & pathVertexDescriptorSourceIndexMask;
17
- uint descriptorData = (descriptor >> pathVertexDescriptorDataShift) & pathVertexDescriptorDataMask;
18
- uint type = descriptor >> pathVertexDescriptorTypeShift;
15
+ uint sourceIndex = ${e(r,1,t`pathVertexInfo`)};
16
+ uint descriptorData = ${e(r,2,t`pathVertexInfo`)};
17
+ uint type = ${e(r,3,t`pathVertexInfo`)};
19
18
  uint subdivision = 0u;
20
19
  bool isEnd = false;
21
20
 
@@ -24,15 +23,15 @@ import{If as e,glsl as t}from"../../shaderModules/glsl.js";import{sourceIndexMas
24
23
  subdivision = descriptorData;
25
24
  break;
26
25
 
27
- ${e(d.pathCapType===3,t`
26
+ ${n(o.pathCapType===3,t`
28
27
  case pathVertexTypeRoundCapInnerProfile:
29
- subdivision = descriptorData & pathVertexDescriptorCapSubdivisionMask;
28
+ subdivision = ${e(i,0,t`descriptorData`)};
30
29
  `)}
31
30
  case pathVertexTypeCapConnectingProfile:
32
- ${e(d.pathCapType!==0,t`
31
+ ${n(o.pathCapType!==0,t`
33
32
  case pathVertexTypeCapProfile:
34
33
  `)}
35
- isEnd = (descriptorData >> pathVertexDescriptorCapSideShift) == pathVertexCapSideEnd;
34
+ isEnd = ${e(i,1,t`descriptorData`)} == pathVertexCapSideEnd;
36
35
  break;
37
36
 
38
37
  }
@@ -44,4 +43,4 @@ import{If as e,glsl as t}from"../../shaderModules/glsl.js";import{sourceIndexMas
44
43
  isEnd
45
44
  );
46
45
  }
47
- `)}export{u as PathVertexInfo};
46
+ `)}export{a as PathVertexInfo};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{glsl as e}from"../../shaderModules/glsl.js";function t(t,n,r){let i=t.getField(n);return e`(((${r}) >> ${e.uint(i.shift)}) & ${e.hexuint(i.max)})`}export{t as getPackedUint32Field};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import"../../core/shaderLibrary/shading/lightingUniforms.js";import"../../core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderLibrary/util/cameraUniforms.js";import"../../core/shaderModules/FloatBindUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Matrix4BindUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./GlobalIlluminationColorQuantization.glsl.js";import"../../shaders/floatBlendScale.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/enums.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationPassParameters,b as build}from"../../../../../chunks/GlobalIllumination.glsl.js";
2
+ import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import"../../core/shaderLibrary/shading/lightingUniforms.js";import"../../core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderLibrary/util/cameraUniforms.js";import"../../core/shaderModules/FloatBindUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Matrix4BindUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./GlobalIlluminationColorQuantization.glsl.js";import"./globalIlluminationUniforms.js";import"../../shaders/floatBlendScale.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/enums.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationPassParameters,b as build}from"../../../../../chunks/GlobalIllumination.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{releaseMaybe as t}from"../../../../../core/maybe.js";import{watch as n,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{waitRender as i}from"../../../../../core/scheduling.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as o}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{UNIT_W as s,ZEROS as c}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as l}from"../../../webgl.js";import{AmbientIllumination as u}from"../AmbientIllumination.js";import{G as d}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as f}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as p}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as m}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as h}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as g}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as _}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as v,ColorAttachment1 as y}from"../../../../webgl/enums.js";let b=class extends u{constructor(e){super(e),this._passParameters=new d,this._drawParameters=new f,this._drawParametersUpscale=new g,this._configuration=new h,this._lastOutput=null,this._isGlobalIlluminationUpdate=!1,this._lowQualityResolutionScale=.35,this._maxFrames=256}initialize(){this.addHandles(n(()=>this._mode,e=>{e===0?this._disable():this._enable()},r))}destroy(){this._lastOutput=t(this._lastOutput)}_disable(){super._disable(),this._resetAccumulation(),this._passParameters.temporalSampleFrame=0}get hasHighQuality(){return this._mode===2}resetAccumulation(){!this._isGlobalIlluminationUpdate&&(this._passParameters.accumulatedFrames>100||!this._configuration.hasEmission)&&this._resetAccumulation()}_resetAccumulation(){this._passParameters.accumulatedFrames=0,this._lastOutput=t(this._lastOutput)}get isAccumulating(){return this.enabled&&this._passParameters.accumulatedFrames<this._maxFrames}precompile(){this.techniques.getCompiled(_)}render(e){if(this.bindParameters.frameRendererTarget===3)return null;let t=this.bindParameters.frameRendererTarget!==0;if(this._passParameters.accumulatedFrames>=this._maxFrames&&!t)return this._lastOutput?.retain(),this._lastOutput;let n=e.find(({name:e})=>e===`normals`),r=n?.getTexture(),i=n?.getTexture(v);return!r||!i||this._mode===0?this._emptyOutput:(this._configuration.hasEmission=!!this.bindParameters.reprojection.lastFrameEmission,t?this._renderOffscreen(r,i):this._renderInteractive(r,i))}_renderOffscreen(e,t){let n=this._emptyOutput,r=this._passParameters.accumulatedFrames,i=this._passParameters.temporalSampleFrame;this._passParameters.accumulatedFrames=0,this._passParameters.temporalSampleFrame=0;let a=this.techniques.get(m,this._configuration),o=this.techniques.get(p);for(;this._passParameters.accumulatedFrames<this._maxFrames;){this._passParameters.globalIllumination=n.getTexture(),this._passParameters.globalIlluminationWeights=n.getTexture(y);let r=this._renderAccumulationFrame(e,t,a,o);++this._passParameters.accumulatedFrames,n.release(),n=r}return this._passParameters.globalIllumination=null,this._passParameters.globalIlluminationWeights=null,this._passParameters.accumulatedFrames=r,this._passParameters.temporalSampleFrame=i,n}_renderInteractive(e,t){if(!this._canRender)return this._requestRender(),this._emptyOutput;let n=this._mode===1?this._lowQualityResolutionScale*this.bindParameters.camera.pixelScale:1,r=n>=.99?1:n,i=this.techniques.getCompiled(m,this._configuration),a=this.techniques.getCompiled(p),o=r<1,s=o?this.techniques.getCompiled(_):null;if(!i||!a||o&&!s)return this._requestRender(),this._emptyOutput;let c=this._renderAccumulationFrame(e,t,i,a,s,r);return++this._passParameters.accumulatedFrames,this._passParameters.accumulatedFrames<this._maxFrames&&this._requestRender(),this._storeOutput(c),c}_renderAccumulationFrame(e,t,n,r,i,a=1){let s=this.bindParameters,c=this.renderingContext,{camera:u}=s;this._passParameters.normalTexture=e,this._passParameters.depthTexture=t,this._passParameters.projScale=1/u.computeScreenPixelSizeAtDistance(1),this._passParameters.resolutionScale=a,this._passParameters.glowBoost=this._glowBoost;let{fullWidth:d,fullHeight:f}=u,p=Math.max(1,Math.floor(d*a)),m=Math.max(1,Math.floor(f*a)),h=this.fboCache.acquire(p,m,`global illumination input`).acquireColor(y,2);c.bindFramebuffer(h.fbo),c.setViewport(0,0,p,m),c.bindTechnique(n,s,this._passParameters,this._drawParameters),c.screen.draw();let g=Math.max(1,Math.round(p)),_=Math.max(1,Math.round(m)),v=this.fboCache.acquire(g,_,`global illumination blur horizontal`);c.bindFramebuffer(v.fbo);let b=h.obtainAttachment(y);this._drawParameters.texture=h.getTexture(),this._drawParameters.weightTexture=b.attachment,o(this._drawParameters.blurSize,0,1/m),c.bindTechnique(r,s,this._passParameters,this._drawParameters),c.setViewport(0,0,g,_),c.screen.draw(),h.release();let x=this.fboCache.acquire(g,_,i?`global illumination blur vertical`:l.AMBIENT_ILLUMINATION);c.bindFramebuffer(x.fbo),c.setViewport(0,0,g,_),c.setClearColor(1,1,1,0),c.clear(16384),this._drawParameters.texture=v.getTexture(),this._drawParameters.weightTexture=b.attachment,o(this._drawParameters.blurSize,1/g,0),c.bindTechnique(r,s,this._passParameters,this._drawParameters),c.setViewport(0,0,g,_),c.screen.draw(),v.release(),x.attachColor(b,y),b.release();let S=x;return i&&(S=this.fboCache.acquire(d,f,l.AMBIENT_ILLUMINATION).acquireColor(y,2),c.bindFramebuffer(S.fbo),c.setViewport(0,0,d,f),c.setClearColor(1,1,1,0),c.clear(16384),this._drawParametersUpscale.colorTexture=x.getTexture(),this._drawParametersUpscale.weightTexture=x.getTexture(y),c.bindTechnique(i,s,this._passParameters,this._drawParametersUpscale),c.screen.draw(),x.release()),c.setViewport4fv(u.fullViewport),this._passParameters.temporalSampleFrame=(this._passParameters.temporalSampleFrame+1)%64,S}_requestRender(){this._isGlobalIlluminationUpdate=!0,this.requestRender(1),this._isGlobalIlluminationUpdate=!1}_storeOutput(e){this._lastOutput!==e&&(this._lastOutput=t(this._lastOutput),this._lastOutput=e,this._lastOutput.retain())}get _emptyOutput(){let e=this.renderingContext,{fullWidth:t,fullHeight:n}=this.bindParameters.camera,r=this.fboCache.acquire(t,n,l.AMBIENT_ILLUMINATION).acquireColor(y,2);return e.bindFramebuffer(r.fbo),e.setViewport(0,0,t,n),e.clearBuffer(0,s),e.clearBuffer(1,c),r}get _canRender(){let{reprojection:e,hasEmission:t,globalIllumination:n}=this.bindParameters;return(!t||!!e.lastFrameEmission)&&!!e.lastFrameDepth&&!!n}get _glowBoost(){let e=this.view.environment.lighting.glow;return e==null?0:2+3*e.intensity}get _mode(){return this._useGlobalIllumination?this.view.stage.renderer.isFeatureEnabled(10)?2:1:0}get test(){let e=this;return{get maxFrames(){return e._maxFrames},set maxFrames(t){e._maxFrames=t},get lowQualityResolutionScale(){return e._lowQualityResolutionScale},set lowQualityResolutionScale(t){e._lowQualityResolutionScale=t},passParameters:this._passParameters,configuration:this._configuration,get mode(){return e._mode},async restartAccumulation(){e.produces!==`disabled`&&(e._disable(),await i(),e._enable())}}}};b=e([a(`esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination`)],b);export{b as GlobalIllumination};
2
+ import{__decorate as e}from"tslib";import{releaseMaybe as t}from"../../../../../core/maybe.js";import{watch as n,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{waitRender as i}from"../../../../../core/scheduling.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as o}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{UNIT_W as s,ZEROS as c}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as l}from"../../../webgl.js";import{AmbientIllumination as u}from"../AmbientIllumination.js";import{G as d}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as f}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as p}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as m}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as h}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as g}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as _}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as v,ColorAttachment1 as y}from"../../../../webgl/enums.js";let b=class extends u{constructor(e){super(e),this._passParameters=new d,this._blurDrawParameters=new f,this._upscaleDrawParameters=new g,this._configuration=new h,this._lastOutput=null,this._isGlobalIlluminationUpdate=!1,this._lowQualityResolutionScale=.35,this._maxFrames=256}initialize(){this.addHandles(n(()=>this._mode,e=>{e===0?this._disable():this._enable()},r))}destroy(){this._lastOutput=t(this._lastOutput)}_disable(){super._disable(),this._resetAccumulation(),this._passParameters.temporalSampleFrame=0}get hasHighQuality(){return this._mode===2}resetAccumulation(){!this._isGlobalIlluminationUpdate&&(this._passParameters.accumulatedFrames>100||!this._configuration.hasEmission)&&this._resetAccumulation()}_resetAccumulation(){this._passParameters.accumulatedFrames=0,this._lastOutput=t(this._lastOutput)}get isAccumulating(){return this.enabled&&this._passParameters.accumulatedFrames<this._maxFrames}precompile(){this.techniques.getCompiled(_)}render(e){if(this.bindParameters.frameRendererTarget===3)return null;let t=this.bindParameters.frameRendererTarget!==0;if(this._passParameters.accumulatedFrames>=this._maxFrames&&!t)return this._lastOutput?.retain(),this._lastOutput;let n=e.find(({name:e})=>e===`normals`),r=n?.getTexture(),i=n?.getTexture(v);return!r||!i||this._mode===0?this._createEmptyOutput():(this._configuration.hasEmission=!!this.bindParameters.reprojection.lastFrameEmission,t?this._renderOffscreen(r,i):this._renderInteractive(r,i))}_renderOffscreen(e,t){let n=this._createEmptyOutput(),r=this._passParameters.accumulatedFrames,i=this._passParameters.temporalSampleFrame;this._passParameters.accumulatedFrames=0,this._passParameters.temporalSampleFrame=0;let a=this.techniques.get(m,this._configuration),o=this.techniques.get(p);for(;this._passParameters.accumulatedFrames<this._maxFrames;){this._passParameters.globalIllumination=n.getTexture(),this._passParameters.globalIlluminationWeights=n.getTexture(y);let r=this._renderAccumulationFrame(e,t,a,o);++this._passParameters.accumulatedFrames,n.release(),n=r}return this._passParameters.globalIllumination=null,this._passParameters.globalIlluminationWeights=null,this._passParameters.accumulatedFrames=r,this._passParameters.temporalSampleFrame=i,n}_renderInteractive(e,t){if(!this._canRender)return this._requestRender(),this._createEmptyOutput();let n=this._mode===1?this._lowQualityResolutionScale*this.bindParameters.camera.pixelScale:1,r=n>=.99?1:n,i=this.techniques.getCompiled(m,this._configuration),a=this.techniques.getCompiled(p),o=r<1,s=o?this.techniques.getCompiled(_):null;if(!i||!a||o&&!s)return this._requestRender(),this._createEmptyOutput();let c=this._renderAccumulationFrame(e,t,i,a,s,r);return++this._passParameters.accumulatedFrames,this._passParameters.accumulatedFrames<this._maxFrames&&this._requestRender(),this._storeOutput(c),c}_renderAccumulationFrame(e,t,n,r,i,a=1){let o=this.bindParameters,s=this.renderingContext,{camera:c}=o;this._passParameters.normalTexture=e,this._passParameters.depthTexture=t,this._passParameters.projScale=1/c.computeScreenPixelSizeAtDistance(1),this._passParameters.resolutionScale=a,this._passParameters.glowBoost=this._glowBoost;let{fullWidth:l,fullHeight:u}=c,d=Math.max(1,Math.floor(l*a)),f=Math.max(1,Math.floor(u*a)),p=this.fboCache.acquire(d,f,`global illumination input`).acquireColor(y,2);s.bindFramebuffer(p.fbo),s.setViewport(0,0,d,f),s.bindTechnique(n,o,this._passParameters,this._blurDrawParameters),s.screen.draw();let m=this._blur(p,r,d,f,!!i),h=i?this._upscale(m,i,l,u):m;return this._passParameters.temporalSampleFrame=(this._passParameters.temporalSampleFrame+1)%64,h}_blur(e,t,n,r,i){let a=this.bindParameters,s=this.renderingContext,c=Math.max(1,Math.round(n)),u=Math.max(1,Math.round(r)),d=this.fboCache.acquire(c,u,`global illumination blur horizontal`);s.bindFramebuffer(d.fbo);let f=e.obtainAttachment(y);this._blurDrawParameters.texture=e.getTexture(),this._blurDrawParameters.weightTexture=f.attachment,o(this._blurDrawParameters.blurSize,0,1/r),s.bindTechnique(t,a,this._passParameters,this._blurDrawParameters),s.setViewport(0,0,c,u),s.screen.draw(),e.release();let p=this.fboCache.acquire(c,u,i?`global illumination blur vertical`:l.AMBIENT_ILLUMINATION);return s.bindFramebuffer(p.fbo),s.setViewport(0,0,c,u),s.setClearColor(1,1,1,0),s.clear(16384),this._blurDrawParameters.texture=d.getTexture(),this._blurDrawParameters.weightTexture=f.attachment,o(this._blurDrawParameters.blurSize,1/c,0),s.bindTechnique(t,a,this._passParameters,this._blurDrawParameters),s.setViewport(0,0,c,u),s.screen.draw(),d.release(),p.attachColor(f,y),f.release(),p}_upscale(e,t,n,r){let i=this.bindParameters,a=this.renderingContext,o=this.fboCache.acquire(n,r,l.AMBIENT_ILLUMINATION).acquireColor(y,2);return a.bindFramebuffer(o.fbo),a.setViewport(0,0,n,r),a.setClearColor(1,1,1,0),a.clear(16384),this._upscaleDrawParameters.colorTexture=e.getTexture(),this._upscaleDrawParameters.weightTexture=e.getTexture(y),a.bindTechnique(t,i,this._passParameters,this._upscaleDrawParameters),a.screen.draw(),e.release(),o}_requestRender(){this._isGlobalIlluminationUpdate=!0,this.requestRender(1),this._isGlobalIlluminationUpdate=!1}_storeOutput(e){this._lastOutput!==e&&(this._lastOutput=t(this._lastOutput),this._lastOutput=e,this._lastOutput.retain())}_createEmptyOutput(){let e=this.renderingContext,{fullWidth:t,fullHeight:n}=this.bindParameters.camera,r=this.fboCache.acquire(t,n,l.AMBIENT_ILLUMINATION).acquireColor(y,2);return e.bindFramebuffer(r.fbo),e.setViewport(0,0,t,n),e.clearBuffer(0,s),e.clearBuffer(1,c),r}get _canRender(){let{reprojection:e,hasEmission:t,globalIllumination:n}=this.bindParameters;return(!t||!!e.lastFrameEmission)&&!!e.lastFrameDepth&&!!n}get _glowBoost(){let e=this.view.environment.lighting.glow;return e==null?0:2+3*e.intensity}get _mode(){return this._useGlobalIllumination?this.view.stage.renderer.isFeatureEnabled(10)?2:1:0}get test(){let e=this;return{get maxFrames(){return e._maxFrames},set maxFrames(t){e._maxFrames=t},get lowQualityResolutionScale(){return e._lowQualityResolutionScale},set lowQualityResolutionScale(t){e._lowQualityResolutionScale=t},passParameters:this._passParameters,configuration:this._configuration,get mode(){return e._mode},async restartAccumulation(){e.produces!==`disabled`&&(e._disable(),await i(),e._enable())}}}};b=e([a(`esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination`)],b);export{b as GlobalIllumination};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderModules/BooleanBindUniform.js";import"../../core/shaderModules/Float2DrawUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DDrawUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./GlobalIlluminationColorQuantization.glsl.js";import"../../shaders/ditherNoise.glsl.js";import"../../shaders/floatBlendScale.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationBlurDrawParameters,b as build}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";
2
+ import"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderModules/BooleanBindUniform.js";import"../../core/shaderModules/Float2DrawUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DDrawUniform.js";import"./GlobalIlluminationColorQuantization.glsl.js";import"./globalIlluminationUniforms.js";import"../../shaders/ditherNoise.glsl.js";import"../../shaders/floatBlendScale.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationBlurDrawParameters,b as build}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DDrawUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./GlobalIlluminationColorQuantization.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationUpscaleDrawParameters,b as build}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";
2
+ import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DDrawUniform.js";import"./GlobalIlluminationColorQuantization.glsl.js";import"./globalIlluminationUniforms.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationUpscaleDrawParameters,b as build}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{FloatPassUniform as e}from"../../core/shaderModules/FloatPassUniform.js";import{Texture2DPassUniform as t}from"../../core/shaderModules/Texture2DPassUniform.js";const n=5e4,r=new t(`depthMap`,e=>e.depthTexture),i=new t(`normalMap`,e=>e.normalTexture),a=new e(`resolutionScale`,e=>e.resolutionScale),o=new e(`projScale`,(e,t)=>{let r=t.camera.distance;return r>n?Math.max(0,e.projScale-(r-n)):e.projScale});export{r as depthMap,i as normalMap,o as projScale,a as resolutionScale};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{fetchAsset as t}from"../../../../../assets.js";import{createTask as n}from"../../../../../core/asyncUtils.js";import r from"../../../../../core/Error.js";import i from"../../../../../core/Logger.js";import{abortMaybe as a,disposeMaybe as o}from"../../../../../core/maybe.js";import{isAbortError as s,throwIfAborted as c}from"../../../../../core/promiseUtils.js";import{watch as l,initial as u,syncAndInitial as d}from"../../../../../core/reactiveUtils.js";import{subclass as f}from"../../../../../core/accessorSupport/decorators.js";import{copy as p,rotateZ as m,multiply as h,invertOrIdentity as g}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{squaredLength as _}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{getReferenceEllipsoid as v}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as y}from"../../../webgl.js";import{glLayout as b}from"../../../support/buffer/glUtil.js";import{OpaqueEnvironment as x}from"../OpaqueEnvironment.js";import{DeepSkyPassParameters as S,DeepSkyTechnique as C}from"./DeepSkyTechnique.js";import{StarPassParameters as w,StarsTechnique as T,layout as E}from"./StarsTechnique.js";import{getDailyRotationCoefficient as D,computeDayDuration as O,eq2ec as k,ec2eq as A}from"./starsUtils.js";import{createTextureKTX2 as j}from"../../lib/BasisUtil.js";import{VertexArrayObject as M}from"../../lib/VertexArrayObject.js";import{ColorAttachment0 as N,PrimitiveType as P}from"../../../../webgl/enums.js";import{TextureDescriptor as F}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as I}from"../../../../webgl/VertexBuffer.js";let L=class extends x{constructor(){super(...arguments),this._numPoints=0,this._passParameters=new w,this._deepSkyPassParameters=new S}initialize(){this.addHandles([l(()=>this.view.environment.starsEnabled,e=>e?this._enable():this._disable(),u),l(()=>this.view.environment.lighting.type===`virtual`?null:this.view.environment.lighting.date,e=>this._update(e),d)])}_enable(){super._enable(),this._bandTextureTask=this._createLoadBandTextureTask(),this._loadDataTask=this._createLoadDataTask()}get loading(){return!!this._loadDataTask&&!this._loadDataTask.finished||!!this._bandTextureTask&&!this._bandTextureTask.finished}destroy(){this._bandTextureTask=a(this._bandTextureTask),this._bandTexture=o(this._bandTexture),this._loadDataTask=a(this._loadDataTask),this._numPoints=0,this._vao=o(this._vao),this._starData=null}render(e){let t=e.find(({name:e})=>e===y.OPAQUE_ENVIRONMENT),n=this.techniques.getCompiled(T),r=this.techniques.getCompiled(C);if(this.loading||!n||!r)return this.requestRender(1),t;let i=this.renderingContext;return this._bandTexture&&(this._deepSkyPassParameters.bandTexture=this._bandTexture,this._deepSkyPassParameters.heightAboveSeaLevelSquared=_(this.bindParameters.camera.eye),i.bindTechnique(r,this.bindParameters,this._deepSkyPassParameters),i.setDrawBuffers([N]),i.screen.draw()),this._starData&&(this._vao??=this._ensureResources(this._starData),i.bindTechnique(n,this.bindParameters,this._passParameters),i.setDrawBuffers([N]),i.bindVAO(this._vao),i.drawArrays(P.POINTS,0,this._numPoints)),t}_ensureResources(e){this._numPoints=e.byteLength/G;let t=new Float32Array(e,0,this._numPoints*2),n=new Uint8Array(e,this._numPoints*2*4,this._numPoints);return R(this.renderingContext,t,n,this._numPoints)}_update(e){let t=v(this.view.spatialReference).radius,n=t*.05,r=t*.3;if(this._deepSkyPassParameters.radiusCloseToGround=(t+r)**2,this._deepSkyPassParameters.radiusBrightnessTransitionEnd=(t+r+n)**2,!e)return;let i=D(e),a=2*O(e),o=p(this._passParameters.modelMatrix,k);m(o,o,-a*Math.PI),h(o,A,o),m(o,o,-i*Math.PI),g(this._deepSkyPassParameters.inverseModelMatrix,o),this.requestRender(1)}_createLoadDataTask(){if(this._starData)return null;let e=n(async e=>{let{data:n}=await t(H,{responseType:`array-buffer`,signal:e});z(n),this._starData=n});return e.promise.catch(e=>{s(e)||i.getLogger(this).error(e)}).then(()=>{this.destroyed||this.requestRender(1)}),e}_createLoadBandTextureTask(){if(this._bandTexture)return null;let e=n(async e=>{let{data:n}=await t(U,{responseType:`array-buffer`,signal:e});c(e);let i=new F;i.wrapMode=33071,i.maxAnisotropy=8;let a=await j(this.renderingContext,i,n);if(e.aborted&&(a?.dispose(),c(e)),!a)throw new r(`stars:invalid-band-texture`,`Failed to transcode Milky Way band texture.`);this._bandTexture=a});return e.promise.catch(e=>{s(e)||i.getLogger(this).warn(`Failed to load Milky Way band texture.`,e)}).then(()=>{this.destroyed||this.requestRender(1)}),e}};L=e([f(`esri.views.3d.webgl-engine.effects.stars.Stars`)],L);function R(e,t,n,r){let i=E.createBuffer(r),a=i.position,o=i.color,s=i.size;for(let e=0;e<r;e++){let r=t[e*2],i=t[e*2+1];a.set(e,0,-Math.cos(r)*Math.sin(i)),a.set(e,1,-Math.sin(r)*Math.sin(i)),a.set(e,2,-Math.cos(i));let c=V(n[e]),l=B(W[c[1]]);o.set(e,0,l[0]),o.set(e,1,l[1]),o.set(e,2,l[2]),o.set(e,3,255),s.set(e,c[0])}return new M(e,new I(e,b(E),i.buffer))}function z(e){if(!e)throw new r(`stars:no-data-received`,`Failed to create stars because star catalogue is missing`);let t=e.byteLength/G;if(t%1!=0||t>5e4||t<5e3)throw new r(`stars:invalid-data`,`Failed to create stars because star catalogue data is invalid`)}function B(e){return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}function V(e){return e>=192?[2.9,e-192]:e>=160?[2.5,e-160]:e>=128?[2,e-128]:e>=96?[1.5,e-96]:e>=64?[1,e-64]:e>=32?[.7,e-32]:[.4,e]}const H=`esri/views/3d/environment/resources/stars.wsv`,U=`esri/views/3d/environment/resources/milkyway-band.ktx2`,W=[`9bb2ff`,`9eb5ff`,`aabfff`,`bbccff`,`ccd8ff `,`dae2ff`,`e4e9ff`,`eeefff`,`f8f6ff`,`fff9fb`,`fff5ef`,`fff1e5`,`ffeddb`,`ffe9d2`,`ffe6ca`,`ffe3c3`,`ffe0bb`,`ffddb4`,`ffdaad`,`ffd6a5`,`ffd29c`,`ffcc8f`,`ffc178`,`ffa94b`,`ff7b00`],G=9;export{L as Stars};
2
+ import{__decorate as e}from"tslib";import{fetchAsset as t}from"../../../../../assets.js";import{createTask as n}from"../../../../../core/asyncUtils.js";import r from"../../../../../core/Error.js";import i from"../../../../../core/Logger.js";import{abortMaybe as a,disposeMaybe as o}from"../../../../../core/maybe.js";import{isAbortError as s,throwIfAborted as c}from"../../../../../core/promiseUtils.js";import{watch as l,initial as u,syncAndInitial as d}from"../../../../../core/reactiveUtils.js";import{subclass as f}from"../../../../../core/accessorSupport/decorators.js";import{copy as p,rotateZ as m,multiply as h,invertOrIdentity as g}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{squaredLength as _}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{getReferenceEllipsoid as v}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as y}from"../../../webgl.js";import{glLayout as b}from"../../../support/buffer/glUtil.js";import{OpaqueEnvironment as x}from"../OpaqueEnvironment.js";import{DeepSkyPassParameters as S,DeepSkyTechnique as C}from"./DeepSkyTechnique.js";import{StarPassParameters as w,StarsTechnique as T,layout as E}from"./StarsTechnique.js";import{getDailyRotationCoefficient as D,computeDayDuration as O,eq2ec as k,ec2eq as A}from"./starsUtils.js";import{VertexArrayObject as j}from"../../lib/VertexArrayObject.js";import{ColorAttachment0 as M,PrimitiveType as N}from"../../../../webgl/enums.js";import P from"../../../../webgl/Texture.js";import{TextureDescriptor as F}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as I}from"../../../../webgl/VertexBuffer.js";let L=class extends x{constructor(){super(...arguments),this._numPoints=0,this._passParameters=new w,this._deepSkyPassParameters=new S}initialize(){this.addHandles([l(()=>this.view.environment.starsEnabled,e=>e?this._enable():this._disable(),u),l(()=>this.view.environment.lighting.type===`virtual`?null:this.view.environment.lighting.date,e=>this._update(e),d)])}_enable(){super._enable(),this._bandTextureTask=this._createLoadBandTextureTask(),this._loadDataTask=this._createLoadDataTask()}get loading(){return!!this._loadDataTask&&!this._loadDataTask.finished||!!this._bandTextureTask&&!this._bandTextureTask.finished}destroy(){this._bandTextureTask=a(this._bandTextureTask),this._bandTexture=o(this._bandTexture),this._loadDataTask=a(this._loadDataTask),this._numPoints=0,this._vao=o(this._vao),this._starData=null}render(e){let t=e.find(({name:e})=>e===y.OPAQUE_ENVIRONMENT),n=this.techniques.getCompiled(T),r=this.techniques.getCompiled(C);if(this.loading||!n||!r)return this.requestRender(1),t;let i=this.renderingContext;return this._bandTexture&&(this._deepSkyPassParameters.bandTexture=this._bandTexture,this._deepSkyPassParameters.heightAboveSeaLevelSquared=_(this.bindParameters.camera.eye),i.bindTechnique(r,this.bindParameters,this._deepSkyPassParameters),i.setDrawBuffers([M]),i.screen.draw()),this._starData&&(this._vao??=this._ensureResources(this._starData),i.bindTechnique(n,this.bindParameters,this._passParameters),i.setDrawBuffers([M]),i.bindVAO(this._vao),i.drawArrays(N.POINTS,0,this._numPoints)),t}_ensureResources(e){this._numPoints=e.byteLength/G;let t=new Float32Array(e,0,this._numPoints*2),n=new Uint8Array(e,this._numPoints*2*4,this._numPoints);return R(this.renderingContext,t,n,this._numPoints)}_update(e){let t=v(this.view.spatialReference).radius,n=t*.05,r=t*.3;if(this._deepSkyPassParameters.radiusCloseToGround=(t+r)**2,this._deepSkyPassParameters.radiusBrightnessTransitionEnd=(t+r+n)**2,!e)return;let i=D(e),a=2*O(e),o=p(this._passParameters.modelMatrix,k);m(o,o,-a*Math.PI),h(o,A,o),m(o,o,-i*Math.PI),g(this._deepSkyPassParameters.inverseModelMatrix,o),this.requestRender(1)}_createLoadDataTask(){if(this._starData)return null;let e=n(async e=>{let{data:n}=await t(H,{responseType:`array-buffer`,signal:e});z(n),this._starData=n});return e.promise.catch(e=>{s(e)||i.getLogger(this).error(e)}).then(()=>{this.destroyed||this.requestRender(1)}),e}_createLoadBandTextureTask(){if(this._bandTexture)return null;let e=n(async e=>{let{data:n}=await t(U,{responseType:`blob`,signal:e});c(e);let r=await createImageBitmap(n,{colorSpaceConversion:`none`,premultiplyAlpha:`none`});try{c(e);let t=new F(r.width,r.height);t.wrapMode=33071,t.maxAnisotropy=8,t.pixelFormat=6407,this._bandTexture=new P(this.renderingContext,t,r)}finally{r.close()}});return e.promise.catch(e=>{s(e)||i.getLogger(this).warn(`Failed to load Milky Way band texture.`,e)}).then(()=>{this.destroyed||this.requestRender(1)}),e}};L=e([f(`esri.views.3d.webgl-engine.effects.stars.Stars`)],L);function R(e,t,n,r){let i=E.createBuffer(r),a=i.position,o=i.color,s=i.size;for(let e=0;e<r;e++){let r=t[e*2],i=t[e*2+1];a.set(e,0,-Math.cos(r)*Math.sin(i)),a.set(e,1,-Math.sin(r)*Math.sin(i)),a.set(e,2,-Math.cos(i));let c=V(n[e]),l=B(W[c[1]]);o.set(e,0,l[0]),o.set(e,1,l[1]),o.set(e,2,l[2]),o.set(e,3,255),s.set(e,c[0])}return new j(e,new I(e,b(E),i.buffer))}function z(e){if(!e)throw new r(`stars:no-data-received`,`Failed to create stars because star catalogue is missing`);let t=e.byteLength/G;if(t%1!=0||t>5e4||t<5e3)throw new r(`stars:invalid-data`,`Failed to create stars because star catalogue data is invalid`)}function B(e){return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}function V(e){return e>=192?[2.9,e-192]:e>=160?[2.5,e-160]:e>=128?[2,e-128]:e>=96?[1.5,e-96]:e>=64?[1,e-64]:e>=32?[.7,e-32]:[.4,e]}const H=`esri/views/3d/environment/resources/stars.wsv`,U=`esri/views/3d/environment/resources/milkyway-band.avif`,W=[`9bb2ff`,`9eb5ff`,`aabfff`,`bbccff`,`ccd8ff `,`dae2ff`,`e4e9ff`,`eeefff`,`f8f6ff`,`fff9fb`,`fff5ef`,`fff1e5`,`ffeddb`,`ffe9d2`,`ffe6ca`,`ffe3c3`,`ffe0bb`,`ffddb4`,`ffdaad`,`ffd6a5`,`ffd29c`,`ffcc8f`,`ffc178`,`ffa94b`,`ff7b00`],G=9;export{L as Stars};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{set as e,transformMat4 as t,normalize as n,scale as r,add as i,dot as a,cross as o,subtract as s,copy as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as l,fromValues as u,create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{clone as f,create as p,fromValues as m,ZEROS as h,UNIT_Z as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as _}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as v,floatArrayFrom as y}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as b,getZeroIndexArray as x}from"../../../../geometry/support/Indices.js";import{create as S,fromPositionAndNormal as C,intersectRay as w}from"../../../../geometry/support/plane.js";import{wrap as T}from"../../../../geometry/support/ray.js";import{addOlidAttribute as E}from"../../layers/graphics/olidUtils.js";import{timeStampsToAttribute as D,numTimeStampValuesPerVertex as O}from"../../support/engineContent/line.js";import{Attribute as k}from"./Attribute.js";import{BufferGeometry as A}from"./BufferGeometry.js";import{Buffers as j}from"./Buffers.js";import{scale as M,length as N,normalize as P,add as F}from"./bufferVectorMath.js";import{Geometry as I}from"./Geometry.js";import{assert as L}from"./Util.js";import{getHUDMaterialBaseInstance as R,getHUDMaterialBufferBaseInstance as z}from"../materials/HUDMaterialBaseInstance.js";import{getInstanceLayout as ee}from"../shaders/HUDMaterialTechnique.js";const B=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],te=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],ne=[0,0,1,0,1,1,0,1],V=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],re=Array(36);for(let e=0;e<6;e++)for(let t=0;t<6;t++)re[e*6+t]=e;const H=Array(36);for(let e=0;e<6;e++)H[e*6]=0,H[e*6+1]=1,H[e*6+2]=2,H[e*6+3]=2,H[e*6+4]=3,H[e*6+5]=0;function U(e,t){Array.isArray(t)||(t=[t,t,t]);let n=Array(24);for(let e=0;e<8;e++)n[e*3]=B[e][0]*t[0],n[e*3+1]=B[e][1]*t[1],n[e*3+2]=B[e][2]*t[2];return new I(e,[[`position`,new k(n,V,3,!0)],[`normal`,new k(te,re,3)],[`uv0`,new k(ne,H,2)]])}const W=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],ie=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],ae=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],oe=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function se(e,t){Array.isArray(t)||(t=[t,t,t]);let n=Array(18);for(let e=0;e<6;e++)n[e*3]=W[e][0]*t[0],n[e*3+1]=W[e][1]*t[1],n[e*3+2]=W[e][2]*t[2];return new I(e,[[`position`,new k(n,ae,3,!0)],[`normal`,new k(ie,oe,3)]])}const G=u(-.5,0,-.5),K=u(.5,0,-.5),q=u(0,0,.5),ce=u(0,.5,0),J=d(),Y=d(),X=d(),Z=d(),Q=d();s(J,G,ce),s(Y,G,K),o(X,J,Y),n(X,X),s(J,K,ce),s(Y,K,q),o(Z,J,Y),n(Z,Z),s(J,q,ce),s(Y,q,G),o(Q,J,Y),n(Q,Q);const le=[G,K,q,ce],ue=[0,-1,0,X[0],X[1],X[2],Z[0],Z[1],Z[2],Q[0],Q[1],Q[2]],de=[0,1,2,3,1,0,3,2,1,3,0,2],fe=[0,0,0,1,1,1,2,2,2,3,3,3];function pe(e,t){Array.isArray(t)||(t=[t,t,t]);let n=Array(12);for(let e=0;e<4;e++)n[e*3]=le[e][0]*t[0],n[e*3+1]=le[e][1]*t[1],n[e*3+2]=le[e][2]*t[2];return new I(e,[[`position`,new k(n,de,3,!0)],[`normal`,new k(ue,fe,3)]])}function me(e,t,n,r,i={uv:!0}){let a=-Math.PI,o=Math.PI*2,s=-Math.PI/2,c=Math.PI,l=Math.max(3,Math.floor(n)),u=Math.max(2,Math.floor(r)),d=(l+1)*(u+1),f=v(d*3),p=v(d*3),m=v(d*2),h=[],g=0;for(let e=0;e<=u;e++){let n=[],r=e/u,i=s+r*c,d=Math.cos(i);for(let e=0;e<=l;e++){let s=e/l,c=a+s*o,u=Math.cos(c)*d,h=Math.sin(i),_=-Math.sin(c)*d;f[3*g]=u*t,f[3*g+1]=h*t,f[3*g+2]=_*t,p[3*g]=u,p[3*g+1]=h,p[3*g+2]=_,m[2*g]=s,m[2*g+1]=r,n.push(g),++g}h.push(n)}let _=[];for(let e=0;e<u;e++)for(let t=0;t<l;t++){let n=h[e][t],r=h[e][t+1],i=h[e+1][t+1],a=h[e+1][t];e===0?(_.push(n),_.push(i),_.push(a)):e===u-1?(_.push(n),_.push(r),_.push(i)):(_.push(n),_.push(r),_.push(i),_.push(i),_.push(a),_.push(n))}let y=[[`position`,new k(f,_,3,!0)],[`normal`,new k(p,_,3,!0)]];return i.uv&&y.push([`uv0`,new k(m,_,2,!0)]),i.offset&&(y[0][0]=`offset`,y.push([`position`,new k(Float64Array.from(i.offset),x(_.length),3,!0)])),new I(e,y)}function he(e,t,n,r){let i=ge(t,n,r);return new I(e,i)}function ge(e,t,n){let r=e,i,a;if(n)i=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],a=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{let e=r*(1+Math.sqrt(5))/2;i=[-r,e,0,r,e,0,-r,-e,0,r,-e,0,0,-r,e,0,r,e,0,-r,-e,0,r,-e,e,0,-r,e,0,r,-e,0,-r,-e,0,r],a=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let t=0;t<i.length;t+=3)M(i,t,e/N(i,t));let o={};function s(t,n){t>n&&([t,n]=[n,t]);let r=t.toString()+`.`+n.toString();if(o[r])return o[r];let a=i.length;return i.length+=3,F(i,t*3,i,n*3,i,a),M(i,a,e/N(i,a)),a/=3,o[r]=a,a}for(let e=0;e<t;e++){let e=a.length,t=Array(e*4);for(let n=0;n<e;n+=3){let e=a[n],r=a[n+1],i=a[n+2],o=s(e,r),c=s(r,i),l=s(i,e),u=n*4;t[u]=e,t[u+1]=o,t[u+2]=l,t[u+3]=r,t[u+4]=c,t[u+5]=o,t[u+6]=i,t[u+7]=l,t[u+8]=c,t[u+9]=o,t[u+10]=c,t[u+11]=l}a=t,o={}}let c=y(i);for(let e=0;e<c.length;e+=3)P(c,e);return[[`position`,new k(y(i),a,3,!0)],[`normal`,new k(c,a,3,!0)]]}function _e(e,{normal:t,position:n,color:r,rotation:i,size:a,centerOffset:o,groundDistance:s,uvi:c,featureAttribute:l,olidColor:u=null}={}){let d=n?f(n):p(),h=t?f(t):m(0,0,1),g=s==null?[1]:[s],_=x(1),v=[[`position`,new k(d,_,3,!0)],[`normal`,new k(h,_,3,!0)]],y=a!=null&&a.length===2?a:null;if(y&&v.push([`size`,new k(y,_,2)]),i!=null&&v.push([`rotation`,new k([i],_,1,!0)]),r){let e=[r[0],r[1],r[2],r.length>3?r[3]:255];v.push([`color`,new k(e,_,4,!0)])}if(c&&v.push([`uvi`,new k(c,_,c.length)]),o&&v.push([`centerOffset`,new k(o,_,3)]),v.push([`groundDistance`,new k(g,_,1)]),l){let e=[l[0],l[1],l[2],l[3]];v.push([`featureAttribute`,new k(e,_,4)])}return u!=null&&E(v,u,_),new I(e,v,null,void 0,R())}function ve(e,t,{position:n,normal:r,groundDistance:i,size:a,rotation:o,color:c,uvi:l,centerOffset:u,featureAttribute:d,olidColor:f}={}){let p=ee(e.parameters).createBuffer(1);return s($,n??h,t.vec3),p.position.setVec(0,$),p.normal.setVec(0,r??g),p.groundDistance.set(0,i??1),a!=null&&p.size?.setVec(0,a),o!=null&&p.rotation?.set(0,o),c!=null&&p.color?.setVec(0,c),l!=null&&p.uvi?.setVec(0,l),u!=null&&p.centerOffset?.setVec(0,u),d!=null&&p.featureAttribute?.setVec(0,d),f!=null&&p.olidColor?.setVec(0,f),new A(e,new j(p),t,null,z())}const ye=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function be(e,t=ye){let n=Array(12);for(let e=0;e<4;e++)for(let r=0;r<3;r++)n[e*3+r]=t[e][r];let r=[0,1,2,2,3,0],i=[0,0,1],a=[0,0,0,0,0,0],o=[[`position`,new k(n,r,3,!0)],[`normal`,new k(i,a,3,!0)],[`uv0`,new k([0,0,1,0,1,1,0,1],r,2,!0)],[`color`,new k([255,255,255,255],a,4,!0)]];return new I(e,o)}function xe(e,t,n,r,i=!0,a=!0){let o=0,s=t,c=e,l=u(0,o,0),d=u(0,o+c,0),f=u(0,-1,0),p=u(0,1,0);r&&(o=c,d=u(0,0,0),l=u(0,o,0),f=u(0,1,0),p=u(0,-1,0));let m=[d,l],h=[f,p],g=n+2,_=Math.sqrt(c*c+s*s);if(r)for(let e=n-1;e>=0;e--){let t=2*Math.PI/n*e,r=u(Math.cos(t)*s,o,Math.sin(t)*s);m.push(r);let i=u(c*Math.cos(t)/_,-s/_,c*Math.sin(t)/_);h.push(i)}else for(let e=0;e<n;e++){let t=2*Math.PI/n*e,r=u(Math.cos(t)*s,o,Math.sin(t)*s);m.push(r);let i=u(c*Math.cos(t)/_,s/_,c*Math.sin(t)/_);h.push(i)}let y=[],b=[];if(i){for(let e=3;e<m.length;e++)y.push(1),y.push(e-1),y.push(e),b.push(0),b.push(0),b.push(0);y.push(m.length-1),y.push(2),y.push(1),b.push(0),b.push(0),b.push(0)}if(a){for(let e=3;e<m.length;e++)y.push(e),y.push(e-1),y.push(0),b.push(e),b.push(e-1),b.push(1);y.push(0),y.push(2),y.push(m.length-1),b.push(1),b.push(2),b.push(h.length-1)}let x=v(g*3);for(let e=0;e<g;e++)x[e*3]=m[e][0],x[e*3+1]=m[e][1],x[e*3+2]=m[e][2];let S=v(g*3);for(let e=0;e<g;e++)S[e*3]=h[e][0],S[e*3+1]=h[e][1],S[e*3+2]=h[e][2];return[[`position`,new k(x,y,3,!0)],[`normal`,new k(S,b,3,!0)]]}function Se(e,t,n,r,i,a=!0,o=!0){return new I(e,xe(t,n,r,i,a,o))}function Ce(t,s,c,f,p,m,h){let g=p?l(p):u(1,0,0),_=m?l(m):u(0,0,0);h??=!0;let y=d();n(y,g);let b=d();r(b,y,Math.abs(s));let x=d();r(x,b,-.5),i(x,x,_);let S=u(0,1,0);Math.abs(1-a(y,S))<.2&&e(S,0,0,1);let C=d();o(C,y,S),n(C,C),o(S,C,y);let w=f*2+(h?2:0),T=f+(h?2:0),E=v(w*3),D=v(T*3),O=v(w*2),A=Array(f*3*(h?4:2)),j=Array(f*3*(h?4:2));h&&(E[(w-2)*3]=x[0],E[(w-2)*3+1]=x[1],E[(w-2)*3+2]=x[2],O[(w-2)*2]=0,O[(w-2)*2+1]=0,E[(w-1)*3]=E[(w-2)*3]+b[0],E[(w-1)*3+1]=E[(w-2)*3+1]+b[1],E[(w-1)*3+2]=E[(w-2)*3+2]+b[2],O[(w-1)*2]=1,O[(w-1)*2+1]=1,D[(T-2)*3]=-y[0],D[(T-2)*3+1]=-y[1],D[(T-2)*3+2]=-y[2],D[(T-1)*3]=y[0],D[(T-1)*3+1]=y[1],D[(T-1)*3+2]=y[2]);let M=(e,t,n)=>{A[e]=t,j[e]=n},N=0,P=d(),F=d();for(let e=0;e<f;e++){let t=2*Math.PI/f*e;r(P,S,Math.sin(t)),r(F,C,Math.cos(t)),i(P,P,F),D[e*3]=P[0],D[e*3+1]=P[1],D[e*3+2]=P[2],r(P,P,c),i(P,P,x),E[e*3]=P[0],E[e*3+1]=P[1],E[e*3+2]=P[2],O[e*2]=e/f,O[e*2+1]=0,E[(e+f)*3]=E[e*3]+b[0],E[(e+f)*3+1]=E[e*3+1]+b[1],E[(e+f)*3+2]=E[e*3+2]+b[2],O[(e+f)*2]=e/f,O[e*2+1]=1;let n=(e+1)%f;M(N++,e,e),M(N++,e+f,e),M(N++,n,n),M(N++,n,n),M(N++,e+f,e),M(N++,n+f,n)}if(h){for(let e=0;e<f;e++){let t=(e+1)%f;M(N++,w-2,T-2),M(N++,e,T-2),M(N++,t,T-2)}for(let e=0;e<f;e++){let t=(e+1)%f;M(N++,e+f,T-1),M(N++,w-1,T-1),M(N++,t+f,T-1)}}let L=[[`position`,new k(E,A,3,!0)],[`normal`,new k(D,j,3,!0)],[`uv0`,new k(O,A,2,!0)]];return new I(t,L)}function we(e,t,n,r,i,a){r||=10,i??=!0,L(t.length>1);let o=[[0,0,0]],s=[],c=[];for(let e=0;e<r;e++){s.push([0,-e-1,-((e+1)%r)-1]);let t=e/r*2*Math.PI;c.push([Math.cos(t)*n,Math.sin(t)*n])}return Te(e,c,t,o,s,i,a)}function Te(t,a,l,d,f,m,h=u(0,0,0)){let g=a.length,_=v(l.length*g*3+(d.length*6||0)),y=v(l.length*g*3+(d?6:0)),b=[],x=[],E=0,D=0,O=p(),A=p(),j=p(),M=p(),N=p(),P=p(),F=p(),L=p(),R=p(),z=p(),ee=p(),B=p(),te=p(),ne=S();e(R,0,1,0),s(A,l[1],l[0]),n(A,A),m?(i(L,l[0],h),n(j,L)):e(j,0,0,1),je(A,j,R,R,N,j,Me),c(M,j),c(B,N);for(let e=0;e<d.length;e++)r(P,N,d[e][0]),r(L,j,d[e][2]),i(P,P,L),i(P,P,l[0]),_[E++]=P[0],_[E++]=P[1],_[E++]=P[2];y[D++]=-A[0],y[D++]=-A[1],y[D++]=-A[2];for(let e=0;e<f.length;e++)b.push(f[e][0]>0?f[e][0]:-f[e][0]-1+d.length),b.push(f[e][1]>0?f[e][1]:-f[e][1]-1+d.length),b.push(f[e][2]>0?f[e][2]:-f[e][2]-1+d.length),x.push(0),x.push(0),x.push(0);let V=d.length,re=d.length-1;for(let e=0;e<l.length;e++){let t=!1;e>0&&(c(O,A),e<l.length-1?(s(A,l[e+1],l[e]),n(A,A)):t=!0,i(z,O,A),n(z,z),i(ee,l[e-1],M),C(l[e],z,ne),w(ne,T(ee,O),L)?(s(L,L,l[e]),n(j,L),o(N,z,j),n(N,N)):je(z,M,B,R,N,j,Me),c(M,j),c(B,N)),m&&(i(L,l[e],h),n(te,L));for(let o=0;o<g;o++)if(r(P,N,a[o][0]),r(L,j,a[o][1]),i(P,P,L),n(F,P),y[D++]=F[0],y[D++]=F[1],y[D++]=F[2],i(P,P,l[e]),_[E++]=P[0],_[E++]=P[1],_[E++]=P[2],!t){let e=(o+1)%g;b.push(V+o),b.push(V+g+o),b.push(V+e),b.push(V+e),b.push(V+g+o),b.push(V+g+e);for(let e=0;e<6;e++){let t=b.length-6;x.push(b[t+e]-re)}}V+=g}let H=l[l.length-1];for(let e=0;e<d.length;e++)r(P,N,d[e][0]),r(L,j,d[e][1]),i(P,P,L),i(P,P,H),_[E++]=P[0],_[E++]=P[1],_[E++]=P[2];let U=D/3;y[D++]=A[0],y[D++]=A[1],y[D++]=A[2];let W=V-g;for(let e=0;e<f.length;e++)b.push(f[e][0]>=0?V+f[e][0]:-f[e][0]-1+W),b.push(f[e][2]>=0?V+f[e][2]:-f[e][2]-1+W),b.push(f[e][1]>=0?V+f[e][1]:-f[e][1]-1+W),x.push(U),x.push(U),x.push(U);let ie=[[`position`,new k(_,b,3,!0)],[`normal`,new k(y,x,3,!0)]];return new I(t,ie)}function Ee(e,t,n,r,i){let a=_(t.length*3),o=Array(2*(t.length-1)),s=0,c=0;for(let e=0;e<t.length;e++){for(let n=0;n<3;n++)a[s++]=t[e][n];e>0&&(o[c++]=e-1,o[c++]=e)}let l=[[`position`,new k(a,o,3,!0)]];if(n?.length===t.length&&n[0].length===3){let e=v(n.length*3),r=0;for(let i=0;i<t.length;i++)for(let t=0;t<3;t++)e[r++]=n[i][t];l.push([`normal`,new k(e,o,3,!0)])}if(r&&l.push([`color`,new k(r,b(r.length/4),4)]),i?.length===t.length){let e=D(i,1);l.push([`timeStamps`,new k(e,o,O,!0)])}return new I(e,l,null)}function De(e,t,n,r,i,a=0){let o=Array(18),s=[[-n,a,i/2],[r,a,i/2],[0,t+a,i/2],[-n,a,-i/2],[r,a,-i/2],[0,t+a,-i/2]],c=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let e=0;e<6;e++)o[e*3]=s[e][0],o[e*3+1]=s[e][1],o[e*3+2]=s[e][2];return new I(e,[[`position`,new k(o,c,3,!0)]])}function Oe(n,r){let i=n.getMutableAttribute(`position`).data;for(let n=0;n<i.length;n+=3){let a=i[n],o=i[n+1],s=i[n+2];e($,a,o,s),t($,$,r),i[n]=$[0],i[n+1]=$[1],i[n+2]=$[2]}}function ke(e,t=e){let n=e.attributes,r=n.get(`position`).data,i=n.get(`normal`).data;if(i){let e=t.getMutableAttribute(`normal`).data;for(let t=0;t<i.length;t+=3){let n=i[t+1];e[t+1]=-i[t+2],e[t+2]=n}}if(r){let e=t.getMutableAttribute(`position`).data;for(let t=0;t<r.length;t+=3){let n=r[t+1];e[t+1]=-r[t+2],e[t+2]=n}}}function Ae(e,t,r,i,s){return Math.abs(a(t,e))>s?!1:(o(r,e,t),n(r,r),o(i,r,e),n(i,i),!0)}function je(e,t,n,r,i,a,o){return Ae(e,t,i,a,o)||Ae(e,n,i,a,o)||Ae(e,r,i,a,o)}const Me=.99619469809,$=p();export{ke as cgToGIS,U as createBoxGeometry,Se as createConeGeometry,xe as createConeGeometryData,Ce as createCylinderGeometry,se as createDiamondGeometry,De as createExtrudedTriangle,Te as createPathExtrusionGeometry,ve as createPointBufferGeometry,_e as createPointGeometry,ge as createPolySphereData,he as createPolySphereGeometry,Ee as createPolylineGeometry,me as createSphereGeometry,be as createSquareGeometry,pe as createTetrahedronGeometry,we as createTubeGeometry,je as makeOrthoBasisDirUpFallback,Oe as transformInPlace};
2
+ import{set as e,transformMat4 as t,subtract as n,normalize as r,scale as i,add as a,dot as o,cross as s,copy as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as l,fromValues as u,create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{ZEROS as f,UNIT_Z as p,create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as h}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as g,floatArrayFrom as _}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as v,getZeroIndexArray as y}from"../../../../geometry/support/Indices.js";import{create as b,fromPositionAndNormal as x,intersectRay as S}from"../../../../geometry/support/plane.js";import{wrap as C}from"../../../../geometry/support/ray.js";import{timeStampsToAttribute as w,numTimeStampValuesPerVertex as T}from"../../support/engineContent/line.js";import{Attribute as E}from"./Attribute.js";import{BufferGeometry as D}from"./BufferGeometry.js";import{Buffers as O}from"./Buffers.js";import{scale as k,length as A,normalize as j,add as M}from"./bufferVectorMath.js";import{Geometry as N}from"./Geometry.js";import{assert as P}from"./Util.js";import{getHUDMaterialBufferBaseInstance as F}from"../materials/HUDMaterialBaseInstance.js";import{getInstanceLayout as I}from"../shaders/HUDMaterialTechnique.js";const L=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],R=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],z=[0,0,1,0,1,1,0,1],ee=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],B=Array(36);for(let e=0;e<6;e++)for(let t=0;t<6;t++)B[e*6+t]=e;const V=Array(36);for(let e=0;e<6;e++)V[e*6]=0,V[e*6+1]=1,V[e*6+2]=2,V[e*6+3]=2,V[e*6+4]=3,V[e*6+5]=0;function te(e,t){Array.isArray(t)||(t=[t,t,t]);let n=Array(24);for(let e=0;e<8;e++)n[e*3]=L[e][0]*t[0],n[e*3+1]=L[e][1]*t[1],n[e*3+2]=L[e][2]*t[2];return new N(e,[[`position`,new E(n,ee,3,!0)],[`normal`,new E(R,B,3)],[`uv0`,new E(z,V,2)]])}const H=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],ne=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],re=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],U=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function W(e,t){Array.isArray(t)||(t=[t,t,t]);let n=Array(18);for(let e=0;e<6;e++)n[e*3]=H[e][0]*t[0],n[e*3+1]=H[e][1]*t[1],n[e*3+2]=H[e][2]*t[2];return new N(e,[[`position`,new E(n,re,3,!0)],[`normal`,new E(ne,U,3)]])}const G=u(-.5,0,-.5),ie=u(.5,0,-.5),K=u(0,0,.5),q=u(0,.5,0),J=d(),Y=d(),X=d(),Z=d(),Q=d();n(J,G,q),n(Y,G,ie),s(X,J,Y),r(X,X),n(J,ie,q),n(Y,ie,K),s(Z,J,Y),r(Z,Z),n(J,K,q),n(Y,K,G),s(Q,J,Y),r(Q,Q);const ae=[G,ie,K,q],oe=[0,-1,0,X[0],X[1],X[2],Z[0],Z[1],Z[2],Q[0],Q[1],Q[2]],se=[0,1,2,3,1,0,3,2,1,3,0,2],ce=[0,0,0,1,1,1,2,2,2,3,3,3];function le(e,t){Array.isArray(t)||(t=[t,t,t]);let n=Array(12);for(let e=0;e<4;e++)n[e*3]=ae[e][0]*t[0],n[e*3+1]=ae[e][1]*t[1],n[e*3+2]=ae[e][2]*t[2];return new N(e,[[`position`,new E(n,se,3,!0)],[`normal`,new E(oe,ce,3)]])}function ue(e,t,n,r,i={uv:!0}){let a=-Math.PI,o=Math.PI*2,s=-Math.PI/2,c=Math.PI,l=Math.max(3,Math.floor(n)),u=Math.max(2,Math.floor(r)),d=(l+1)*(u+1),f=g(d*3),p=g(d*3),m=g(d*2),h=[],_=0;for(let e=0;e<=u;e++){let n=[],r=e/u,i=s+r*c,d=Math.cos(i);for(let e=0;e<=l;e++){let s=e/l,c=a+s*o,u=Math.cos(c)*d,h=Math.sin(i),g=-Math.sin(c)*d;f[3*_]=u*t,f[3*_+1]=h*t,f[3*_+2]=g*t,p[3*_]=u,p[3*_+1]=h,p[3*_+2]=g,m[2*_]=s,m[2*_+1]=r,n.push(_),++_}h.push(n)}let v=[];for(let e=0;e<u;e++)for(let t=0;t<l;t++){let n=h[e][t],r=h[e][t+1],i=h[e+1][t+1],a=h[e+1][t];e===0?(v.push(n),v.push(i),v.push(a)):e===u-1?(v.push(n),v.push(r),v.push(i)):(v.push(n),v.push(r),v.push(i),v.push(i),v.push(a),v.push(n))}let b=[[`position`,new E(f,v,3,!0)],[`normal`,new E(p,v,3,!0)]];return i.uv&&b.push([`uv0`,new E(m,v,2,!0)]),i.offset&&(b[0][0]=`offset`,b.push([`position`,new E(Float64Array.from(i.offset),y(v.length),3,!0)])),new N(e,b)}function de(e,t,n,r){let i=fe(t,n,r);return new N(e,i)}function fe(e,t,n){let r=e,i,a;if(n)i=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],a=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{let e=r*(1+Math.sqrt(5))/2;i=[-r,e,0,r,e,0,-r,-e,0,r,-e,0,0,-r,e,0,r,e,0,-r,-e,0,r,-e,e,0,-r,e,0,r,-e,0,-r,-e,0,r],a=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let t=0;t<i.length;t+=3)k(i,t,e/A(i,t));let o={};function s(t,n){t>n&&([t,n]=[n,t]);let r=t.toString()+`.`+n.toString();if(o[r])return o[r];let a=i.length;return i.length+=3,M(i,t*3,i,n*3,i,a),k(i,a,e/A(i,a)),a/=3,o[r]=a,a}for(let e=0;e<t;e++){let e=a.length,t=Array(e*4);for(let n=0;n<e;n+=3){let e=a[n],r=a[n+1],i=a[n+2],o=s(e,r),c=s(r,i),l=s(i,e),u=n*4;t[u]=e,t[u+1]=o,t[u+2]=l,t[u+3]=r,t[u+4]=c,t[u+5]=o,t[u+6]=i,t[u+7]=l,t[u+8]=c,t[u+9]=o,t[u+10]=c,t[u+11]=l}a=t,o={}}let c=_(i);for(let e=0;e<c.length;e+=3)j(c,e);return[[`position`,new E(_(i),a,3,!0)],[`normal`,new E(c,a,3,!0)]]}function pe(e,t,{position:r,normal:i,groundDistance:a,size:o,rotation:s,color:c,uvi:l,centerOffset:u,featureAttribute:d,olidColor:m}={}){let h=I(e.parameters).createBuffer(1);return n($,r??f,t.vec3),h.position.setVec(0,$),h.normal.setVec(0,i??p),h.groundDistance.set(0,a??1),o!=null&&h.size?.setVec(0,o),s!=null&&h.rotation?.set(0,s),c!=null&&h.color?.setVec(0,c),l!=null&&h.uvi?.setVec(0,l),u!=null&&h.centerOffset?.setVec(0,u),d!=null&&h.featureAttribute?.setVec(0,d),m!=null&&h.olidColor?.setVec(0,m),new D(e,new O(h),t,null,F())}const me=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function he(e,t=me){let n=Array(12);for(let e=0;e<4;e++)for(let r=0;r<3;r++)n[e*3+r]=t[e][r];let r=[0,1,2,2,3,0],i=[0,0,1],a=[0,0,0,0,0,0],o=[[`position`,new E(n,r,3,!0)],[`normal`,new E(i,a,3,!0)],[`uv0`,new E([0,0,1,0,1,1,0,1],r,2,!0)],[`color`,new E([255,255,255,255],a,4,!0)]];return new N(e,o)}function ge(e,t,n,r,i=!0,a=!0){let o=0,s=t,c=e,l=u(0,o,0),d=u(0,o+c,0),f=u(0,-1,0),p=u(0,1,0);r&&(o=c,d=u(0,0,0),l=u(0,o,0),f=u(0,1,0),p=u(0,-1,0));let m=[d,l],h=[f,p],_=n+2,v=Math.sqrt(c*c+s*s);if(r)for(let e=n-1;e>=0;e--){let t=2*Math.PI/n*e,r=u(Math.cos(t)*s,o,Math.sin(t)*s);m.push(r);let i=u(c*Math.cos(t)/v,-s/v,c*Math.sin(t)/v);h.push(i)}else for(let e=0;e<n;e++){let t=2*Math.PI/n*e,r=u(Math.cos(t)*s,o,Math.sin(t)*s);m.push(r);let i=u(c*Math.cos(t)/v,s/v,c*Math.sin(t)/v);h.push(i)}let y=[],b=[];if(i){for(let e=3;e<m.length;e++)y.push(1),y.push(e-1),y.push(e),b.push(0),b.push(0),b.push(0);y.push(m.length-1),y.push(2),y.push(1),b.push(0),b.push(0),b.push(0)}if(a){for(let e=3;e<m.length;e++)y.push(e),y.push(e-1),y.push(0),b.push(e),b.push(e-1),b.push(1);y.push(0),y.push(2),y.push(m.length-1),b.push(1),b.push(2),b.push(h.length-1)}let x=g(_*3);for(let e=0;e<_;e++)x[e*3]=m[e][0],x[e*3+1]=m[e][1],x[e*3+2]=m[e][2];let S=g(_*3);for(let e=0;e<_;e++)S[e*3]=h[e][0],S[e*3+1]=h[e][1],S[e*3+2]=h[e][2];return[[`position`,new E(x,y,3,!0)],[`normal`,new E(S,b,3,!0)]]}function _e(e,t,n,r,i,a=!0,o=!0){return new N(e,ge(t,n,r,i,a,o))}function ve(t,n,c,f,p,m,h){let _=p?l(p):u(1,0,0),v=m?l(m):u(0,0,0);h??=!0;let y=d();r(y,_);let b=d();i(b,y,Math.abs(n));let x=d();i(x,b,-.5),a(x,x,v);let S=u(0,1,0);Math.abs(1-o(y,S))<.2&&e(S,0,0,1);let C=d();s(C,y,S),r(C,C),s(S,C,y);let w=f*2+(h?2:0),T=f+(h?2:0),D=g(w*3),O=g(T*3),k=g(w*2),A=Array(f*3*(h?4:2)),j=Array(f*3*(h?4:2));h&&(D[(w-2)*3]=x[0],D[(w-2)*3+1]=x[1],D[(w-2)*3+2]=x[2],k[(w-2)*2]=0,k[(w-2)*2+1]=0,D[(w-1)*3]=D[(w-2)*3]+b[0],D[(w-1)*3+1]=D[(w-2)*3+1]+b[1],D[(w-1)*3+2]=D[(w-2)*3+2]+b[2],k[(w-1)*2]=1,k[(w-1)*2+1]=1,O[(T-2)*3]=-y[0],O[(T-2)*3+1]=-y[1],O[(T-2)*3+2]=-y[2],O[(T-1)*3]=y[0],O[(T-1)*3+1]=y[1],O[(T-1)*3+2]=y[2]);let M=(e,t,n)=>{A[e]=t,j[e]=n},P=0,F=d(),I=d();for(let e=0;e<f;e++){let t=2*Math.PI/f*e;i(F,S,Math.sin(t)),i(I,C,Math.cos(t)),a(F,F,I),O[e*3]=F[0],O[e*3+1]=F[1],O[e*3+2]=F[2],i(F,F,c),a(F,F,x),D[e*3]=F[0],D[e*3+1]=F[1],D[e*3+2]=F[2],k[e*2]=e/f,k[e*2+1]=0,D[(e+f)*3]=D[e*3]+b[0],D[(e+f)*3+1]=D[e*3+1]+b[1],D[(e+f)*3+2]=D[e*3+2]+b[2],k[(e+f)*2]=e/f,k[e*2+1]=1;let n=(e+1)%f;M(P++,e,e),M(P++,e+f,e),M(P++,n,n),M(P++,n,n),M(P++,e+f,e),M(P++,n+f,n)}if(h){for(let e=0;e<f;e++){let t=(e+1)%f;M(P++,w-2,T-2),M(P++,e,T-2),M(P++,t,T-2)}for(let e=0;e<f;e++){let t=(e+1)%f;M(P++,e+f,T-1),M(P++,w-1,T-1),M(P++,t+f,T-1)}}let L=[[`position`,new E(D,A,3,!0)],[`normal`,new E(O,j,3,!0)],[`uv0`,new E(k,A,2,!0)]];return new N(t,L)}function ye(e,t,n,r,i,a){r||=10,i??=!0,P(t.length>1);let o=[[0,0,0]],s=[],c=[];for(let e=0;e<r;e++){s.push([0,-e-1,-((e+1)%r)-1]);let t=e/r*2*Math.PI;c.push([Math.cos(t)*n,Math.sin(t)*n])}return be(e,c,t,o,s,i,a)}function be(t,o,l,d,f,p,h=u(0,0,0)){let _=o.length,v=g(l.length*_*3+(d.length*6||0)),y=g(l.length*_*3+(d?6:0)),w=[],T=[],D=0,O=0,k=m(),A=m(),j=m(),M=m(),P=m(),F=m(),I=m(),L=m(),R=m(),z=m(),ee=m(),B=m(),V=m(),te=b();e(R,0,1,0),n(A,l[1],l[0]),r(A,A),p?(a(L,l[0],h),r(j,L)):e(j,0,0,1),Ee(A,j,R,R,P,j,De),c(M,j),c(B,P);for(let e=0;e<d.length;e++)i(F,P,d[e][0]),i(L,j,d[e][2]),a(F,F,L),a(F,F,l[0]),v[D++]=F[0],v[D++]=F[1],v[D++]=F[2];y[O++]=-A[0],y[O++]=-A[1],y[O++]=-A[2];for(let e=0;e<f.length;e++)w.push(f[e][0]>0?f[e][0]:-f[e][0]-1+d.length),w.push(f[e][1]>0?f[e][1]:-f[e][1]-1+d.length),w.push(f[e][2]>0?f[e][2]:-f[e][2]-1+d.length),T.push(0),T.push(0),T.push(0);let H=d.length,ne=d.length-1;for(let e=0;e<l.length;e++){let t=!1;e>0&&(c(k,A),e<l.length-1?(n(A,l[e+1],l[e]),r(A,A)):t=!0,a(z,k,A),r(z,z),a(ee,l[e-1],M),x(l[e],z,te),S(te,C(ee,k),L)?(n(L,L,l[e]),r(j,L),s(P,z,j),r(P,P)):Ee(z,M,B,R,P,j,De),c(M,j),c(B,P)),p&&(a(L,l[e],h),r(V,L));for(let n=0;n<_;n++)if(i(F,P,o[n][0]),i(L,j,o[n][1]),a(F,F,L),r(I,F),y[O++]=I[0],y[O++]=I[1],y[O++]=I[2],a(F,F,l[e]),v[D++]=F[0],v[D++]=F[1],v[D++]=F[2],!t){let e=(n+1)%_;w.push(H+n),w.push(H+_+n),w.push(H+e),w.push(H+e),w.push(H+_+n),w.push(H+_+e);for(let e=0;e<6;e++){let t=w.length-6;T.push(w[t+e]-ne)}}H+=_}let re=l[l.length-1];for(let e=0;e<d.length;e++)i(F,P,d[e][0]),i(L,j,d[e][1]),a(F,F,L),a(F,F,re),v[D++]=F[0],v[D++]=F[1],v[D++]=F[2];let U=O/3;y[O++]=A[0],y[O++]=A[1],y[O++]=A[2];let W=H-_;for(let e=0;e<f.length;e++)w.push(f[e][0]>=0?H+f[e][0]:-f[e][0]-1+W),w.push(f[e][2]>=0?H+f[e][2]:-f[e][2]-1+W),w.push(f[e][1]>=0?H+f[e][1]:-f[e][1]-1+W),T.push(U),T.push(U),T.push(U);let G=[[`position`,new E(v,w,3,!0)],[`normal`,new E(y,T,3,!0)]];return new N(t,G)}function xe(e,t,n,r,i){let a=h(t.length*3),o=Array(2*(t.length-1)),s=0,c=0;for(let e=0;e<t.length;e++){for(let n=0;n<3;n++)a[s++]=t[e][n];e>0&&(o[c++]=e-1,o[c++]=e)}let l=[[`position`,new E(a,o,3,!0)]];if(n?.length===t.length&&n[0].length===3){let e=g(n.length*3),r=0;for(let i=0;i<t.length;i++)for(let t=0;t<3;t++)e[r++]=n[i][t];l.push([`normal`,new E(e,o,3,!0)])}if(r&&l.push([`color`,new E(r,v(r.length/4),4)]),i?.length===t.length){let e=w(i,1);l.push([`timeStamps`,new E(e,o,T,!0)])}return new N(e,l,null)}function Se(e,t,n,r,i,a=0){let o=Array(18),s=[[-n,a,i/2],[r,a,i/2],[0,t+a,i/2],[-n,a,-i/2],[r,a,-i/2],[0,t+a,-i/2]],c=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let e=0;e<6;e++)o[e*3]=s[e][0],o[e*3+1]=s[e][1],o[e*3+2]=s[e][2];return new N(e,[[`position`,new E(o,c,3,!0)]])}function Ce(n,r){let i=n.getMutableAttribute(`position`).data;for(let n=0;n<i.length;n+=3){let a=i[n],o=i[n+1],s=i[n+2];e($,a,o,s),t($,$,r),i[n]=$[0],i[n+1]=$[1],i[n+2]=$[2]}}function we(e,t=e){let n=e.attributes,r=n.get(`position`).data,i=n.get(`normal`).data;if(i){let e=t.getMutableAttribute(`normal`).data;for(let t=0;t<i.length;t+=3){let n=i[t+1];e[t+1]=-i[t+2],e[t+2]=n}}if(r){let e=t.getMutableAttribute(`position`).data;for(let t=0;t<r.length;t+=3){let n=r[t+1];e[t+1]=-r[t+2],e[t+2]=n}}}function Te(e,t,n,i,a){return Math.abs(o(t,e))>a?!1:(s(n,e,t),r(n,n),s(i,n,e),r(i,i),!0)}function Ee(e,t,n,r,i,a,o){return Te(e,t,i,a,o)||Te(e,n,i,a,o)||Te(e,r,i,a,o)}const De=.99619469809,$=m();export{we as cgToGIS,te as createBoxGeometry,_e as createConeGeometry,ge as createConeGeometryData,ve as createCylinderGeometry,W as createDiamondGeometry,Se as createExtrudedTriangle,be as createPathExtrusionGeometry,pe as createPointBufferGeometry,fe as createPolySphereData,de as createPolySphereGeometry,xe as createPolylineGeometry,ue as createSphereGeometry,he as createSquareGeometry,le as createTetrahedronGeometry,ye as createTubeGeometry,Ee as makeOrthoBasisDirUpFallback,Ce as transformInPlace};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"../../../../core/has.js";import{generateUID as e}from"../../../../core/uid.js";import{multiply as t,copy as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r,IDENTITY as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as a,distance as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as c,center as l}from"../../../../geometry/support/aaBoundingBox.js";import{maxScale as u}from"../../support/mathUtils.js";import{affectsGeometry as d}from"./affectsGeometry.js";import{BoundingVolume as f,expandWithTransformedBox as p}from"./BoundingVolume.js";import{Object3DOccludeeStateID as m,Object3DHighlightStateID as h}from"./Object3DStateID.js";import{assert as g}from"./Util.js";import{addObject3DStateID as _,removeObject3DStateID as v}from"../materials/renderers/utils.js";class y{constructor(t={}){this.id=e(),this.type=0,this._highlightIds=new Set,this._shaderTransformation=null,this._visible=!0,this.castShadow=t.castShadow??!0,this.usesVerticalDistanceToGround=t.usesVerticalDistanceToGround??!1,this.graphicUid=t.graphicUid,this.layerViewUid=t.layerViewUid,t.isElevationSource&&(this.lastValidElevationBB=c()),this._geometries=t.geometries?Array.from(t.geometries):[]}dispose(){this._geometries.length=0}get layer(){return this._layer}set layer(e){g(this._layer==null||e==null,`Object3D can only be added to a single Layer`),this._layer=e}addGeometry(e){e.visible=this._visible,this._geometries.push(e);for(let t of this._highlightIds)e.addHighlight(t);this._emit(`geometriesChanged`,{object:this,removed:[],added:[e]}),this._highlightIds.size&&this._emit(`highlightChanged`,this),this._invalidateBoundingVolume()}removeGeometry(e){let t=this._geometries.splice(e,1)[0];if(t){for(let e of this._highlightIds)t.removeHighlight(e);this._emit(`geometriesChanged`,{object:this,removed:[t],added:[]}),this._highlightIds.size&&this._emit(`highlightChanged`,this),this._invalidateBoundingVolume()}}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}replaceGeometries(e){let t=this._geometries,n=Array.from(e);for(let e of t)for(let t of this._highlightIds)e.removeHighlight(t);for(let e of n){e.visible=this._visible;for(let t of this._highlightIds)e.addHighlight(t)}this._geometries=n,this._invalidateBoundingVolume(),this._emit(`geometriesChanged`,{object:this,removed:t,added:n}),this._highlightIds.size&&this._emit(`highlightChanged`,this)}geometryVertexAttributeUpdated(e,t,n=!1){this._emit(`attributesChanged`,{object:this,geometry:e,attribute:t,sync:n}),d(t)&&this._invalidateBoundingVolume()}get visible(){return this._visible}set visible(e){if(this._visible!==e){this._visible=e;for(let e of this._geometries)e.visible=this._visible;this._emit(`visibilityChanged`,this)}}maskOccludee(){let e=new m;for(let t of this._geometries)t.occludees=_(t.occludees,e);return this._emit(`occlusionChanged`,this),e}removeOcclude(e){for(let t of this._geometries)t.occludees=v(t.occludees,e);this._emit(`occlusionChanged`,this)}highlight(e){let t=new h(e);for(let e of this._geometries)e.addHighlight(t);return this._emit(`highlightChanged`,this),this._highlightIds.add(t),t}removeHighlight(e){this._highlightIds.delete(e);for(let t of this._geometries)t.removeHighlight(e);this._emit(`highlightChanged`,this)}removeStateID(e){e.channel===0?this.removeHighlight(e):this.removeOcclude(e)}getCombinedStaticTransformation(e,n){return t(n,this.transformation,e.transformation)}getCombinedShaderTransformation(e,n=r()){return t(n,this.effectiveTransformation,e.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=new f,this._validateBoundingVolume(this._bvWorldSpace,0)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=new f,this._validateBoundingVolume(this._bvObjectSpace,1)),this._bvObjectSpace}_validateBoundingVolume(e,t){let n=t===1;for(let t of this._geometries){let r=t.boundingInfo;r&&p(e.box,r.box,n?t.transformation:this.getCombinedShaderTransformation(t))}l(e.box,e.sphere.center);for(let t of this._geometries){let r=t.boundingInfo;if(r==null)continue;let i=n?t.transformation:this.getCombinedShaderTransformation(t),s=u(i);a(b,r.sphere.center,i);let c=o(b,e.sphere.center),l=r.sphere.radius*s;e.sphere.radius=Math.max(e.sphere.radius,c+l)}}_invalidateBoundingVolume(){let e=this._bvWorldSpace?.sphere;this._bvObjectSpace=this._bvWorldSpace=void 0,this.layer&&e&&this.layer.notifyObjectBBChanged(this,e)}_emit(e,t){this.layer?.events.emit(e,t)}get geometries(){return this._geometries}get transformation(){return this._transformation??i}set transformation(e){this._transformation=n(this._transformation??r(),e),this._invalidateBoundingVolume(),this._emit(`transformationChanged`,this)}get shaderTransformation(){return this._shaderTransformation}set shaderTransformation(e){this._shaderTransformation=e?n(this._shaderTransformation??r(),e):null,this._invalidateBoundingVolume(),this._emit(`shaderTransformationChanged`,this)}get effectiveTransformation(){return this.shaderTransformation??this.transformation}get test(){}}const b=s();export{y as Object3D};
2
+ import"../../../../core/has.js";import{generateUID as e}from"../../../../core/uid.js";import{multiply as t,copy as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r,IDENTITY as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as a,distance as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as c,center as l}from"../../../../geometry/support/aaBoundingBox.js";import{maxScale as u}from"../../support/mathUtils.js";import{affectsGeometry as d}from"./affectsGeometry.js";import{BoundingVolume as f,expandWithTransformedBox as p}from"./BoundingVolume.js";import{Object3DOccludeeStateID as m,Object3DHighlightStateID as h}from"./Object3DStateID.js";import{assert as g}from"./Util.js";import{addObject3DStateID as _,removeObject3DStateID as v}from"../materials/renderers/utils.js";class y{constructor(t={}){this.id=e(),this.type=0,this._highlightIds=new Set,this._shaderTransformation=null,this._visible=!0,this.castShadow=t.castShadow??!0,this.graphicUid=t.graphicUid,this.layerViewUid=t.layerViewUid,t.isElevationSource&&(this.lastValidElevationBB=c()),this._geometries=t.geometries?Array.from(t.geometries):[]}dispose(){this._geometries.length=0}get layer(){return this._layer}set layer(e){g(this._layer==null||e==null,`Object3D can only be added to a single Layer`),this._layer=e}addGeometry(e){e.visible=this._visible,this._geometries.push(e);for(let t of this._highlightIds)e.addHighlight(t);this._emit(`geometriesChanged`,{object:this,removed:[],added:[e]}),this._highlightIds.size&&this._emit(`highlightChanged`,this),this._invalidateBoundingVolume()}removeGeometry(e){let t=this._geometries.splice(e,1)[0];if(t){for(let e of this._highlightIds)t.removeHighlight(e);this._emit(`geometriesChanged`,{object:this,removed:[t],added:[]}),this._highlightIds.size&&this._emit(`highlightChanged`,this),this._invalidateBoundingVolume()}}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}replaceGeometries(e){let t=this._geometries,n=Array.from(e);for(let e of t)for(let t of this._highlightIds)e.removeHighlight(t);for(let e of n){e.visible=this._visible;for(let t of this._highlightIds)e.addHighlight(t)}this._geometries=n,this._invalidateBoundingVolume(),this._emit(`geometriesChanged`,{object:this,removed:t,added:n}),this._highlightIds.size&&this._emit(`highlightChanged`,this)}geometryVertexAttributeUpdated(e,t,n=!1){this._emit(`attributesChanged`,{object:this,geometry:e,attribute:t,sync:n}),d(t)&&this._invalidateBoundingVolume()}get visible(){return this._visible}set visible(e){if(this._visible!==e){this._visible=e;for(let e of this._geometries)e.visible=this._visible;this._emit(`visibilityChanged`,this)}}maskOccludee(){let e=new m;for(let t of this._geometries)t.occludees=_(t.occludees,e);return this._emit(`occlusionChanged`,this),e}removeOcclude(e){for(let t of this._geometries)t.occludees=v(t.occludees,e);this._emit(`occlusionChanged`,this)}highlight(e){let t=new h(e);for(let e of this._geometries)e.addHighlight(t);return this._emit(`highlightChanged`,this),this._highlightIds.add(t),t}removeHighlight(e){this._highlightIds.delete(e);for(let t of this._geometries)t.removeHighlight(e);this._emit(`highlightChanged`,this)}removeStateID(e){e.channel===0?this.removeHighlight(e):this.removeOcclude(e)}getCombinedStaticTransformation(e,n){return t(n,this.transformation,e.transformation)}getCombinedShaderTransformation(e,n=r()){return t(n,this.effectiveTransformation,e.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=new f,this._validateBoundingVolume(this._bvWorldSpace,0)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=new f,this._validateBoundingVolume(this._bvObjectSpace,1)),this._bvObjectSpace}_validateBoundingVolume(e,t){let n=t===1;for(let t of this._geometries){let r=t.boundingInfo;r&&p(e.box,r.box,n?t.transformation:this.getCombinedShaderTransformation(t))}l(e.box,e.sphere.center);for(let t of this._geometries){let r=t.boundingInfo;if(r==null)continue;let i=n?t.transformation:this.getCombinedShaderTransformation(t),s=u(i);a(b,r.sphere.center,i);let c=o(b,e.sphere.center),l=r.sphere.radius*s;e.sphere.radius=Math.max(e.sphere.radius,c+l)}}_invalidateBoundingVolume(){let e=this._bvWorldSpace?.sphere;this._bvObjectSpace=this._bvWorldSpace=void 0,this.layer&&e&&this.layer.notifyObjectBBChanged(this,e)}_emit(e,t){this.layer?.events.emit(e,t)}get geometries(){return this._geometries}get transformation(){return this._transformation??i}set transformation(e){this._transformation=n(this._transformation??r(),e),this._invalidateBoundingVolume(),this._emit(`transformationChanged`,this)}get shaderTransformation(){return this._shaderTransformation}set shaderTransformation(e){this._shaderTransformation=e?n(this._shaderTransformation??r(),e):null,this._invalidateBoundingVolume(),this._emit(`shaderTransformationChanged`,this)}get effectiveTransformation(){return this.shaderTransformation??this.transformation}get test(){}}const b=s();export{y as Object3D};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{assert as e}from"./Util.js";class t{constructor(t){this._fields=[];let r=0;for(let e of t)this._fields.push(new n(e,r)),r+=e;e(r>0,`Empty U32 layout`)}encode(...t){e(t.length===this._fields.length,`Expected one value per U32 field`);let n=0;for(let e=0;e<t.length;e++)n|=this._fields[e].encode(t[e]);return n}getField(t){let n=this._fields[t];return e(n!=null,`Unknown U32 field`),n}}class n{constructor(t,n){this.bits=t,this.shift=n,e(Number.isInteger(t)&&t>0&&n+t<=32,`Invalid U32 field width`),this.max=2**t-1,this.mask=this.max*2**n}encode(t){return e(Number.isSafeInteger(t),`Invalid U32 field value`),(t&this.max)<<this.shift}get(e){return(e&this.mask)>>>this.shift}set(e,t){return e&~this.mask|this.encode(t)}}export{t as PackedUint32};
@@ -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,estimateFixedArrayMemory as n,integerArrayElementBytes as r,estimateArrayMemory as i}from"../../../../core/memoryEstimations.js";import{set as a,copy as o,exactEquals as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c,clone as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as d,getZeroIndexArray as f}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as p}from"../../layers/graphics/olidUtils.js";import{Attribute as m}from"./Attribute.js";import{Geometry as h}from"./Geometry.js";import{getPathVertexFrameIndex as g}from"./PathVertexInfo.js";import{createPositionReader as _}from"./PositionReader.js";class v extends h{constructor(e,r,i,a){let{vertexIndices:o,framePositionIndices:s,numExtrusionFrames:l}=r,u=d(l),h=f(l),g=[[`position`,new m(r.positions,s,3,!0)],[`profileRight`,new m(r.profileRightAxes,u,2,!0)],[`profileUp`,new m(r.profileUpAxes,u,2,!0)],[`profileRotation`,new m(r.profileRotations,u,1,!0)],[`pathMaxStretchDistance`,new m(r.pathMaxStretchDistances,u,1,!0)],[`pathVertexInfo`,new m(r.pathVertexInfos,o,1,!0)]];r.profileRotationFrameUpAxes&&g.push([`pathRotationUp`,new m(r.profileRotationFrameUpAxes,u,2,!0)]),i.sizeAttributeValue!=null&&g.push([`sizeFeatureAttribute`,new m([i.sizeAttributeValue],h,1,!0)]),i.size!=null&&g.push([`size`,new m([...i.size],h,2,!0)]),i.colorAttributeValue!=null&&g.push([`colorFeatureAttribute`,new m([i.colorAttributeValue],h,1,!0)]),i.color!=null&&g.push([`color`,new m([...i.color],h,4,!0)]),i.opacityAttributeValue!=null&&g.push([`opacityFeatureAttribute`,new m([i.opacityAttributeValue],h,1,!0)]),i.opacity!=null&&g.push([`opacity`,new m([i.opacity],h,1,!0)]),a!=null&&p(g,a,h),super(e,g,null,0),this.builder=r,this.visualVariablesState=i,this._positionCacheMemory=0,this._lastSize=c(),this._usedMemory=t+n(r.path.vertices,8)+r.path.vertices.length*(2*t)}computeBufferMemory(e){let t=super.computeBufferMemory(e),{builder:n}=this;t+=e.arrayMemory(n.framePositionIndices,r,!0),t+=e.arrayMemory(n.vertexIndices,r,!0);let{path:i}=n;t+=e.arrayMemory(i.positions)+e.arrayMemory(i.positionsES)+e.arrayMemory(i.origin);for(let n of i.vertices)t+=e.arrayMemory(n.vLeft)+e.arrayMemory(n.vRight),t+=e.arrayMemory(n.frame.up)+e.arrayMemory(n.frame.right);return 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:r,evaluator:a}=e,o=u(r*3);for(let e=0;e<r;++e)a.evaluateVertexPosition(o,t,e,e);this._readPrimitivePosition=_(o,n,3),this._positionCacheMemory=i(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(),a(this._lastSize,-1,-1),this._invalidateReadPrimitivePosition()}get size(){let{parameters:t}=this.material,n=l(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&&o(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;return r.map(t=>n[g(i[e.stride*t])])}return t?.indices??null}get boundingInfo(){return this._invalidateOnSizeChange(),super.boundingInfo}_invalidateOnSizeChange(){let{size:e}=this;s(e,this._lastSize)||(o(this._lastSize,e),this.invalidateBoundingInfo(),this._invalidateReadPrimitivePosition())}}function y(e){return e instanceof v}export{v as PathGeometry,y as isPathGeometry};
2
+ import{clamp as e}from"../../../../core/mathUtils.js";import{baseObjectMemory as t,estimateFixedArrayMemory as n,integerArrayElementBytes as r,estimateArrayMemory as i}from"../../../../core/memoryEstimations.js";import{set as a,copy as o,exactEquals as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c,clone as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as d,getZeroIndexArray as f}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as p}from"../../layers/graphics/olidUtils.js";import{Attribute as m}from"./Attribute.js";import{Geometry as h}from"./Geometry.js";import{pathVertexInfoPacking as g}from"./PathVertexInfo.js";import{createPositionReader as _}from"./PositionReader.js";class v extends h{constructor(e,r,i,a){let{vertexIndices:o,framePositionIndices:s,numExtrusionFrames:l}=r,u=d(l),h=f(l),g=[[`position`,new m(r.positions,s,3,!0)],[`profileRight`,new m(r.profileRightAxes,u,2,!0)],[`profileUp`,new m(r.profileUpAxes,u,2,!0)],[`profileRotation`,new m(r.profileRotations,u,1,!0)],[`pathMaxStretchDistance`,new m(r.pathMaxStretchDistances,u,1,!0)],[`pathVertexInfo`,new m(r.pathVertexInfos,o,1,!0)]];r.profileRotationFrameUpAxes&&g.push([`pathRotationUp`,new m(r.profileRotationFrameUpAxes,u,2,!0)]),i.sizeAttributeValue!=null&&g.push([`sizeFeatureAttribute`,new m([i.sizeAttributeValue],h,1,!0)]),i.size!=null&&g.push([`size`,new m([...i.size],h,2,!0)]),i.colorAttributeValue!=null&&g.push([`colorFeatureAttribute`,new m([i.colorAttributeValue],h,1,!0)]),i.color!=null&&g.push([`color`,new m([...i.color],h,4,!0)]),i.opacityAttributeValue!=null&&g.push([`opacityFeatureAttribute`,new m([i.opacityAttributeValue],h,1,!0)]),i.opacity!=null&&g.push([`opacity`,new m([i.opacity],h,1,!0)]),a!=null&&p(g,a,h),super(e,g,null,0),this.builder=r,this.visualVariablesState=i,this._positionCacheMemory=0,this._lastSize=c(),this._usedMemory=t+n(r.path.vertices,8)+r.path.vertices.length*(2*t)}computeBufferMemory(e){let t=super.computeBufferMemory(e),{builder:n}=this;t+=e.arrayMemory(n.framePositionIndices,r,!0),t+=e.arrayMemory(n.vertexIndices,r,!0);let{path:i}=n;t+=e.arrayMemory(i.positions)+e.arrayMemory(i.positionsES)+e.arrayMemory(i.origin);for(let n of i.vertices)t+=e.arrayMemory(n.vLeft)+e.arrayMemory(n.vRight),t+=e.arrayMemory(n.frame.up)+e.arrayMemory(n.frame.right);return 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:r,evaluator:a}=e,o=u(r*3);for(let e=0;e<r;++e)a.evaluateVertexPosition(o,t,e,e);this._readPrimitivePosition=_(o,n,3),this._positionCacheMemory=i(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(),a(this._lastSize,-1,-1),this._invalidateReadPrimitivePosition()}get size(){let{parameters:t}=this.material,n=l(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&&o(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=g.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;s(e,this._lastSize)||(o(this._lastSize,e),this.invalidateBoundingInfo(),this._invalidateReadPrimitivePosition())}}function y(e){return e instanceof v}export{v as PathGeometry,y as isPathGeometry};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{assert as e}from"./Util.js";const t=16777215,n=24,r=4278190080,i=15,a=4,o=3,s=6,c=1,l=1;function u({frameIndex:t,sourceIndex:n,subdivision:r,type:i,capSide:a}){e(n>=0&&n<=15,`invalid sourceIndex`);let o=0;switch(i){case 0:e(r>=0&&r<=3,`invalid subdivision`),o=r;break;case 1:case 2:e(r===0,`invalid subdivision`),o=a<<1;break;case 3:e(r>=0&&r<=1,`invalid subdivision`),o=r|a<<1;break;default:e(!1,`invalid vertex type`)}return f((n&15|(o&3)<<4|i<<6)<<24,t)}function d(e){return e&t}function f(n,i){return e(i>=0&&i<=t,`invalid frameIndex`),n&r|i&t}function p(e,t){return f(e,d(e)+t)}function m(e){return e>>>24}function h(t){let n=d(t),r=m(t),i=r&15,a=r>>>4&3,o=r>>>6,s=0,c=0;switch(o){case 0:c=a;break;case 1:case 2:s=a>>>1;break;case 3:s=a>>>1,c=a&1;break;default:e(!1,`invalid vertex type`)}return{frameIndex:n,sourceIndex:i,subdivision:c,type:o,capSide:s}}export{h as decodePathVertexInfo,r as descriptorBitMask,l as descriptorCapSideShift,c as descriptorCapSubdivisionMask,o as descriptorDataMask,a as descriptorDataShift,n as descriptorShift,s as descriptorTypeShift,u as encodePathVertexInfo,t as frameIndexMask,m as getPathVertexDescriptor,d as getPathVertexFrameIndex,p as offsetPathVertexInfoFrameIndex,f as setPathVertexInfoFrameIndex,i as sourceIndexMask};
2
+ import{PackedUint32 as e}from"./PackedUint32.js";import{assert as t}from"./Util.js";const n=new e([24,4,2,2]),r=new e([1,1]),i=n.getField(0),a=n.getField(1),o=n.getField(2),s=n.getField(3),c=r.getField(0),l=r.getField(1);function u({frameIndex:e,sourceIndex:i,subdivision:a,type:o,capSide:s}){let c=0;switch(o){case 0:c=a;break;case 1:case 2:t(a===0,`invalid subdivision`),c=r.encode(0,s);break;case 3:c=r.encode(a,s);break;default:t(!1,`invalid vertex type`)}return n.encode(e,i,c,o)}function d(e){let n=i.get(e),r=a.get(e),u=o.get(e),d=s.get(e),f=0,p=0;switch(d){case 0:p=u;break;case 1:case 2:f=l.get(u);break;case 3:f=l.get(u),p=c.get(u);break;default:t(!1,`invalid vertex type`)}return{frameIndex:n,sourceIndex:r,subdivision:p,type:d,capSide:f}}export{d as decodePathVertexInfo,u as encodePathVertexInfo,r as pathVertexCapDataPacking,n as pathVertexInfoPacking};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{PackedUint32 as e}from"./PackedUint32.js";import{assert as t}from"./Util.js";const n=new e([25,4,3]),r=n.getField(1),i=4,a=2**(r.bits-1),o=6;function s(e,r,i,o){let s=i*6;t(Number.isInteger(s)&&s>=0&&s<=6,`Unsupported ribbon-line subdivision factor`),t(!o||Math.abs(r)<=2,`Only join vertices can be marked inside a join`);let c=r+(o?Math.sign(r)*4:0);return t(Number.isInteger(c)&&c>=-a&&c<a,`Invalid ribbon vertex type`),n.encode(e,c,s)}export{s as encodeRibbonLineVertexInfo,i as ribbonInsideJoinOffset,n as ribbonLineVertexInfoPacking,o as ribbonSubdivisionScale,a as ribbonVertexTypeSignBit};