@arcgis/core 6.0.0-next.41 → 6.0.0-next.42

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 (203) hide show
  1. package/Camera.js +1 -1
  2. package/arcgisGlobal.d.ts +0 -2
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/075fe33152fd79fe6d72.js +1 -0
  5. package/assets/esri/core/workers/chunks/0d87cb6417672de95d53.js +1 -0
  6. package/assets/esri/core/workers/chunks/11877d4dc97f756e4711.js +1 -0
  7. package/assets/esri/core/workers/chunks/1860104c2b33f68785dd.js +1 -0
  8. package/assets/esri/core/workers/chunks/1980fd7ae1617ef4d19d.js +1 -0
  9. package/assets/esri/core/workers/chunks/{14d81280807a3d3c1b7e.js → 244ffdb91237d1cbade3.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{059cda6f11a91dbc9e28.js → 2690d5fcd9d5ca92ebf6.js} +1 -1
  11. package/assets/esri/core/workers/chunks/348f28d7ab46df878c6f.js +1 -0
  12. package/assets/esri/core/workers/chunks/{8b0efcc30184593a0812.js → 36bafcc29ac133a05558.js} +24 -24
  13. package/assets/esri/core/workers/chunks/36e5f070009b29b7ac3d.js +1 -0
  14. package/assets/esri/core/workers/chunks/39c23a52d7c3e1ee121c.js +1 -0
  15. package/assets/esri/core/workers/chunks/{5504ec9bd9ee4d10af07.js → 3f74c61359b4bd6dcf00.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{6738b3d6bce34a1e8be2.js → 446d172834f8675f1202.js} +1 -1
  17. package/assets/esri/core/workers/chunks/48c6230b8a6d3a8a7906.js +1 -0
  18. package/assets/esri/core/workers/chunks/4c73c493dabe949c2512.js +1 -0
  19. package/assets/esri/core/workers/chunks/{46504fc81f357bc7465a.js → 4d62877f521cc9663535.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{54de7dc0597fc80d7a52.js → 5dea74fe52583e77f3ce.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{1ec772eaa63eb6937231.js → 8140ed6e44c3d8536d3e.js} +1 -1
  22. package/assets/esri/core/workers/chunks/867502158997cb2d6406.js +1 -0
  23. package/assets/esri/core/workers/chunks/8ceb6697e8adbeffe019.js +1 -0
  24. package/assets/esri/core/workers/chunks/8fe22c2370219f25c15b.js +1 -0
  25. package/assets/esri/core/workers/chunks/91586bf29492735e692d.js +1 -0
  26. package/assets/esri/core/workers/chunks/{123541f79be7adff0818.js → a422a801e55fa125546e.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{fd967a9f3cf0e2890dbb.js → a91dc05a6a609d04ed04.js} +1 -1
  28. package/assets/esri/core/workers/chunks/a99c50b4e1c7568210e1.js +1 -0
  29. package/assets/esri/core/workers/chunks/ab48faea5432e2dbd45c.js +1 -0
  30. package/assets/esri/core/workers/chunks/bbddeb1c893ff8bbae5d.js +1 -0
  31. package/assets/esri/core/workers/chunks/bc2e2bdf1194e6e9eb5e.js +1 -0
  32. package/assets/esri/core/workers/chunks/c3ba1a3247e14f6b7b3a.js +1 -0
  33. package/assets/esri/core/workers/chunks/c5d0a034ff31d5954571.js +1 -0
  34. package/assets/esri/core/workers/chunks/{efc1a90742813b55602e.js → c8057b47c7c6c02a0bda.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{b386e921c273de3ac7a5.js → d4c8673ca65df874a7ce.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{947f3a1cad976bba9738.js → d5e251cddd41d643510c.js} +1 -1
  37. package/assets/esri/core/workers/chunks/fbe3a3b9d6c8c0b52f65.js +1 -0
  38. package/assets/esri/core/workers/chunks/fe7184993ef5713d13fb.js +1 -0
  39. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  40. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  41. package/assets/esri/themes/base/_core.scss +0 -2
  42. package/assets/esri/themes/dark/main.css +1 -1
  43. package/assets/esri/themes/light/main.css +1 -1
  44. package/assets/esri/themes/light/view.css +1 -1
  45. package/chunks/lyr3DMain.js +1 -1
  46. package/chunks/lyr3DWorker.js +1 -1
  47. package/config.js +1 -1
  48. package/core/Logger.js +1 -1
  49. package/core/deprecate.js +1 -1
  50. package/core/types.d.ts +0 -5
  51. package/interfaces.d.ts +0 -17
  52. package/kernel.js +1 -1
  53. package/layers/BuildingSceneLayer.js +1 -1
  54. package/layers/ElevationLayer.d.ts +1 -1
  55. package/layers/ElevationLayer.js +1 -1
  56. package/layers/FeatureLayer.js +1 -1
  57. package/layers/GeoRSSLayer.js +1 -1
  58. package/layers/ImageryLayer.js +1 -1
  59. package/layers/ImageryTileLayer.js +1 -1
  60. package/layers/IntegratedMesh3DTilesLayer.d.ts +4 -3
  61. package/layers/IntegratedMeshLayer.d.ts +4 -3
  62. package/layers/IntegratedMeshLayer.js +1 -1
  63. package/layers/KMLLayer.js +1 -1
  64. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  65. package/layers/MapImageLayer.js +1 -1
  66. package/layers/PointCloudLayer.js +1 -1
  67. package/layers/SceneLayer.js +1 -1
  68. package/layers/StreamLayer.js +1 -1
  69. package/layers/SubtypeGroupLayer.js +1 -1
  70. package/layers/TileLayer.js +1 -1
  71. package/layers/VectorTileLayer.js +1 -1
  72. package/layers/WCSLayer.js +1 -1
  73. package/layers/WMSLayer.js +1 -1
  74. package/layers/WMTSLayer.js +1 -1
  75. package/layers/WebTileLayer.js +1 -1
  76. package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
  77. package/layers/raster/datasets/ImageServerRaster.js +1 -1
  78. package/layers/raster/datasets/RasterFactory.js +1 -1
  79. package/layers/raster/datasets/ZarrRaster.js +2 -0
  80. package/layers/raster/datasets/datasetUtils.js +1 -1
  81. package/layers/raster/datasets/zarrParser.js +2 -0
  82. package/layers/raster/datasets/zarrUtils.js +2 -0
  83. package/layers/raster/formats/pixelRangeUtils.js +1 -1
  84. package/layers/support/SceneModifications.d.ts +1 -3
  85. package/layers/support/SceneModifications.js +1 -1
  86. package/legend/ActiveLayerInfo.js +1 -1
  87. package/package.json +3 -3
  88. package/portal/Portal.js +1 -1
  89. package/support/LayersMixin.d.ts +2 -2
  90. package/symbols/PictureFillSymbol.js +1 -1
  91. package/symbols/PictureMarkerSymbol.js +1 -1
  92. package/symbols/SimpleFillSymbol.js +1 -1
  93. package/symbols/SimpleLineSymbol.js +1 -1
  94. package/symbols/SimpleMarkerSymbol.js +1 -1
  95. package/symbols/Symbol3D.js +1 -1
  96. package/symbols/TextSymbol.js +1 -1
  97. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  98. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  99. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  100. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  101. package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
  102. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  103. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  104. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  105. package/views/3d/layers/support/Tiles3DLayerViewRegistration.js +2 -0
  106. package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
  107. package/views/3d/layers/support/createTileBVHForLayer.js +2 -0
  108. package/views/3d/layers/support/tileBoundingVolumeUtils.js +2 -0
  109. package/views/3d/support/GaussianSplatSortWorker.js +1 -1
  110. package/views/3d/support/engineContent/line.js +1 -1
  111. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  112. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  113. package/views/3d/support/gaussianSplatting/GaussianSplatSortCoordinator.js +2 -0
  114. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  115. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  116. package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
  117. package/views/3d/webgl-engine/lib/LineMaterial.js +1 -1
  118. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  119. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  120. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  121. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  122. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  123. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  124. package/views/3d/webgl-engine/materials/WaterTechniqueConfiguration.js +1 -1
  125. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  126. package/views/3d/webgl-engine/shaders/ShadedMaterialConfiguration.js +2 -0
  127. package/views/SceneView.d.ts +2 -4
  128. package/views/View.d.ts +1 -3
  129. package/views/View2D.d.ts +2 -2
  130. package/views/analysis/ElevationProfile/ElevationProfileChart.js +1 -1
  131. package/views/interactive/options/ViewOptions.d.ts +0 -2
  132. package/widgets/Editor/EditorViewModel.d.ts +0 -1
  133. package/widgets/Editor.d.ts +0 -1
  134. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  135. package/widgets/Sketch/SketchViewModel.d.ts +0 -1
  136. package/widgets/Sketch.d.ts +0 -1
  137. package/assets/esri/core/workers/chunks/073f0232135f71b6c7a5.js +0 -1
  138. package/assets/esri/core/workers/chunks/0bf43d80cb40c2b43333.js +0 -1
  139. package/assets/esri/core/workers/chunks/1866f832e5f52958bc97.js +0 -1
  140. package/assets/esri/core/workers/chunks/19e51cbb354954ddafbd.js +0 -1
  141. package/assets/esri/core/workers/chunks/1deca3de77b1a9a07da4.js +0 -1
  142. package/assets/esri/core/workers/chunks/1fd82fcba2758741996a.js +0 -1
  143. package/assets/esri/core/workers/chunks/23f3692c7426173e8352.js +0 -1
  144. package/assets/esri/core/workers/chunks/2dfe6af28cd1b29d5ebc.js +0 -1
  145. package/assets/esri/core/workers/chunks/305eeaac0b4d5b79ebde.js +0 -1
  146. package/assets/esri/core/workers/chunks/353976c812ebf0c98549.js +0 -1
  147. package/assets/esri/core/workers/chunks/4caebb64a365da18453f.js +0 -1
  148. package/assets/esri/core/workers/chunks/4d8833f48348cbbcc947.js +0 -1
  149. package/assets/esri/core/workers/chunks/598ba405e93ebccf7b2d.js +0 -1
  150. package/assets/esri/core/workers/chunks/8b0be232723424dda320.js +0 -1
  151. package/assets/esri/core/workers/chunks/8b38fad017c4c0d9e1ec.js +0 -1
  152. package/assets/esri/core/workers/chunks/8c3779de09291170497f.js +0 -1
  153. package/assets/esri/core/workers/chunks/98958203a5ca45b24d72.js +0 -1
  154. package/assets/esri/core/workers/chunks/af2087b75225d7d7dbd8.js +0 -1
  155. package/assets/esri/core/workers/chunks/b3aa29589dcfb5b93106.js +0 -1
  156. package/assets/esri/core/workers/chunks/c5364ff8dd1358af3603.js +0 -1
  157. package/assets/esri/core/workers/chunks/f6f5937a1308f28bb959.js +0 -1
  158. package/assets/esri/core/workers/chunks/fe24e039385473bf77f9.js +0 -1
  159. package/assets/esri/themes/base/widgets/_UtilityNetworkValidateTopology.scss +0 -46
  160. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.ar.json +0 -1
  161. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.bg.json +0 -1
  162. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.bs.json +0 -1
  163. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.ca.json +0 -1
  164. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.cs.json +0 -1
  165. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.da.json +0 -1
  166. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.de.json +0 -1
  167. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.el.json +0 -1
  168. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.en.json +0 -1
  169. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.es.json +0 -1
  170. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.et.json +0 -1
  171. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.fi.json +0 -1
  172. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.fr.json +0 -1
  173. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.he.json +0 -1
  174. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.hr.json +0 -1
  175. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.hu.json +0 -1
  176. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.id.json +0 -1
  177. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.it.json +0 -1
  178. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.ja.json +0 -1
  179. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.ko.json +0 -1
  180. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.lt.json +0 -1
  181. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.lv.json +0 -1
  182. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.nl.json +0 -1
  183. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.no.json +0 -1
  184. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.pl.json +0 -1
  185. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.pt-BR.json +0 -1
  186. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.pt-PT.json +0 -1
  187. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.ro.json +0 -1
  188. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.ru.json +0 -1
  189. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.sk.json +0 -1
  190. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.sl.json +0 -1
  191. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.sr.json +0 -1
  192. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.sv.json +0 -1
  193. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.th.json +0 -1
  194. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.tr.json +0 -1
  195. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.uk.json +0 -1
  196. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.vi.json +0 -1
  197. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.zh-CN.json +0 -1
  198. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.zh-HK.json +0 -1
  199. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.zh-TW.json +0 -1
  200. package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.d.ts +0 -72
  201. package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.js +0 -2
  202. package/widgets/UtilityNetworkValidateTopology.d.ts +0 -130
  203. package/widgets/UtilityNetworkValidateTopology.js +0 -2
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ function e(e,t,n,r,i,a,o){if(!e)return!0;let s=t-a[0],c=n-a[1],l=r-a[2],u=s*o[0]+c*o[1]+l*o[2],d=s*s+c*c+l*l-u*u;return(i<0||d<=i)&&e.intersectRay(a,o)}function t(e,t,n,r,i,a,o){if(i<0)return!0;let s=o.center,c=o.radius,l=i+c,u=t-s[0];if(u>l)return!1;let d=n-s[1];if(d>l)return!1;let f=r-s[2];if(f>l)return!1;let p=u*u+d*d+f*f;return p>l*l?!1:p<=(a+c)**2?!0:e?.intersectSphere(o)??!0}export{e as intersectsRay,t as intersectsSphere};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{estimateNumberArrayMemory as e,estimateNestedObjectMemory as t}from"../../../core/memoryEstimations.js";import{gaussiansPerPage as n}from"./gaussianSplatting/GaussianSplatAtlasPages.js";class r{constructor(e,t,n,r,i,a,o,s,c=!1){this.addedTiles=e,this.removedTileHandles=t,this.visibleTileHandles=n,this.sortedAtlasIndices=r,this.numGaussians=i,this.directionX=a,this.directionY=o,this.directionZ=s,this.preciseSort=c}}class i{constructor(e,t){this.sortedAtlasIndices=e,this.usedMemory=t}}let a=null,o=0,s=null,c=0,l=null,u=0;const d=new Map;function f(){let n=e(a,s,l);for(let e of d.values())n+=t(e);return n}function p(e,t){let n=Math.max(1,e);for(;n<t;)n=Math.ceil(n*1.5);return n}function m(e){e>o&&(o=p(o,e),a=new Uint32Array(o)),a.fill(0,0,e)}function h(e){e<=c||(c=p(c,e),s=new Float64Array(c))}function g(e){return e>u&&(u=p(u,e),l=new Uint32Array(u)),l}function _(e,t){let r=0;for(let i=0;i<e.length;i++){let a=d.get(e[i]);if(a==null)throw Error(`Gaussian splat sort worker is missing resident tile data`);let o=r+a.gaussianCount;for(let e=0;e<a.pageIds.length&&r<o;e++){let i=a.pageIds[e]*n,s=Math.min(o-r,n);for(let e=0;e<s;e++,r++)t[r]=i+e}}if(r!==t.length)throw Error(`Gaussian splat sort worker received inconsistent resident tile data`)}function v(e,t,r,i,o){let s=e.length,c=Math.max(10,Math.min(20,Math.round(Math.log2(s/.25)))),l=(1<<c)+1;m(l);let u=a,f=o-i,p=f>=1e-6,h=p?(1<<c)/f:0;if(p)for(let t=0;t<s;t++){let n=(e[t]-i)*h>>>0;u[n]++}else u[0]=s;let g=u[0];for(let e=1;e<l;e++)g+=u[e],u[e]=g;let _=0;for(let a=0;a<t.length;a++){let o=d.get(t[a]);if(o==null)throw Error(`Gaussian splat sort worker is missing resident tile data`);let s=_+o.gaussianCount;for(let t=0;t<o.pageIds.length&&_<s;t++){let a=o.pageIds[t]*n,c=Math.min(s-_,n);for(let t=0;t<c;t++,_++){let n=p?(e[_]-i)*h>>>0:0,o=--u[n];r[o]=a+t}}}if(_!==s)throw Error(`Gaussian splat sort worker received inconsistent resident tile data`)}async function y(e){let{addedTiles:t,removedTileHandles:n,visibleTileHandles:r,sortedAtlasIndices:a,numGaussians:o,directionX:c,directionY:l,directionZ:u,preciseSort:p}=e;for(let e=0;e<n.length;e++)d.delete(n[e]);for(let e=0;e<t.length;e++){let n=t[e];d.set(n.handle,n)}if(o===0)return{result:new i(a,f()),transferList:[a.buffer]};h(o);let m=s.subarray(0,o),y=a.subarray(0,o),b=0,x=1/0,S=-1/0;for(let e=0;e<r.length;e++){let t=d.get(r[e]);if(t==null)throw Error(`Gaussian splat sort worker is missing resident tile data`);let{relativePositions:n,gaussianCount:i,originX:a,originY:o,originZ:s}=t,f=b+i,p=c*a+l*o+u*s;for(let e=0;b<f;b++,e+=3){let t=n[e]*c+n[e+1]*l+n[e+2]*u+p;m[b]=t,x=Math.min(x,t),S=Math.max(S,t)}}if(b!==o)throw Error(`Gaussian splat sort worker received inconsistent resident tile data`);if(p){let e=g(o).subarray(0,o);_(r,e);let t=Array(o);for(let e=0;e<o;e++)t[e]=e;t.sort((e,t)=>m[e]-m[t]||e-t);for(let n=0;n<o;n++)y[n]=e[t[n]]}else o>0&&v(m,r,y,x,S);return{result:new i(a,f()),transferList:[a.buffer]}}function b(){x()}function x(){d.clear(),s=null,c=0,l=null,u=0,a=null,o=0}export{r as SplatSortWorkerInput,i as SplatSortWorkerOutput,x as clear,b as destroy,y as sort};
2
+ import{estimateNumberArrayMemory as e,estimateNestedObjectMemory as t}from"../../../core/memoryEstimations.js";import{gaussiansPerPage as n}from"./gaussianSplatting/GaussianSplatAtlasPages.js";class r{constructor({addedTiles:e,removedTileHandles:t,visibleTileHandles:n,sortedAtlasIndices:r,numGaussians:i,directionX:a,directionY:o,directionZ:s,preciseSort:c=!1}){this.addedTiles=e,this.removedTileHandles=t,this.visibleTileHandles=n,this.sortedAtlasIndices=r,this.numGaussians=i,this.directionX=a,this.directionY=o,this.directionZ=s,this.preciseSort=c}}class i{constructor(e,t){this.sortedAtlasIndices=e,this.usedMemory=t}}let a=null,o=0,s=null,c=0,l=null,u=0;const d=new Map;function f(){let n=e(a,s,l);for(let e of d.values())n+=t(e);return n}function p(e,t){let n=Math.max(1,e);for(;n<t;)n=Math.ceil(n*1.5);return n}function m(e){e>o&&(o=p(o,e),a=new Uint32Array(o)),a.fill(0,0,e)}function h(e){e<=c||(c=p(c,e),s=new Float64Array(c))}function g(e){return e>u&&(u=p(u,e),l=new Uint32Array(u)),l}function _(e,t){let r=0;for(let i=0;i<e.length;i++){let a=d.get(e[i]);if(a==null)throw Error(`Gaussian splat sort worker is missing resident tile data`);let o=r+a.gaussianCount;for(let e=0;e<a.pageIds.length&&r<o;e++){let i=a.pageIds[e]*n,s=Math.min(o-r,n);for(let e=0;e<s;e++,r++)t[r]=i+e}}if(r!==t.length)throw Error(`Gaussian splat sort worker received inconsistent resident tile data`)}function v(e,t,r,i,o){let s=e.length,c=Math.max(10,Math.min(20,Math.round(Math.log2(s/.25)))),l=(1<<c)+1;m(l);let u=a,f=o-i,p=f>=1e-6,h=p?(1<<c)/f:0;if(p)for(let t=0;t<s;t++){let n=(e[t]-i)*h>>>0;u[n]++}else u[0]=s;let g=u[0];for(let e=1;e<l;e++)g+=u[e],u[e]=g;let _=0;for(let a=0;a<t.length;a++){let o=d.get(t[a]);if(o==null)throw Error(`Gaussian splat sort worker is missing resident tile data`);let s=_+o.gaussianCount;for(let t=0;t<o.pageIds.length&&_<s;t++){let a=o.pageIds[t]*n,c=Math.min(s-_,n);for(let t=0;t<c;t++,_++){let n=p?(e[_]-i)*h>>>0:0,o=--u[n];r[o]=a+t}}}if(_!==s)throw Error(`Gaussian splat sort worker received inconsistent resident tile data`)}async function y(e){let{addedTiles:t,removedTileHandles:n,visibleTileHandles:r,sortedAtlasIndices:a,numGaussians:o,directionX:c,directionY:l,directionZ:u,preciseSort:p}=e;for(let e=0;e<n.length;e++)d.delete(n[e]);for(let e=0;e<t.length;e++){let n=t[e];d.set(n.handle,n)}if(o===0)return{result:new i(a,f()),transferList:[a.buffer]};h(o);let m=s.subarray(0,o),y=a.subarray(0,o),b=0,x=1/0,S=-1/0;for(let e=0;e<r.length;e++){let t=d.get(r[e]);if(t==null)throw Error(`Gaussian splat sort worker is missing resident tile data`);let{relativePositions:n,gaussianCount:i,originX:a,originY:o,originZ:s}=t,f=b+i,p=c*a+l*o+u*s;for(let e=0;b<f;b++,e+=3){let t=n[e]*c+n[e+1]*l+n[e+2]*u+p;m[b]=t,x=Math.min(x,t),S=Math.max(S,t)}}if(b!==o)throw Error(`Gaussian splat sort worker received inconsistent resident tile data`);if(p){let e=g(o).subarray(0,o);_(r,e);let t=Array(o);for(let e=0;e<o;e++)t[e]=e;t.sort((e,t)=>m[e]-m[t]||e-t);for(let n=0;n<o;n++)y[n]=e[t[n]]}else o>0&&v(m,r,y,x,S);return{result:new i(a,f()),transferList:[a.buffer]}}function b(){x()}function x(){d.clear(),s=null,c=0,l=null,u=0,a=null,o=0}export{r as SplatSortWorkerInput,i as SplatSortWorkerOutput,x as clear,b as destroy,y as sort};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{translateAffine as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t,IDENTITY as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as r,dist as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{negate as o,set as s,transformMat4 as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as d}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as f}from"../../../../geometry/projection/projectors.js";import{center as p,fromBuffer as m,setEmpty as h,expandWithVec3 as g,create as _}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as v}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as ee}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as y}from"../../../../geometry/support/HalfFloatArray.js";import{getZeroIndexArray as b}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as te}from"../../layers/graphics/olidUtils.js";import{getPlanarDistanceToGroundRatio as ne}from"../planarDistanceToGroundRatio.js";import{Attribute as x}from"../../webgl-engine/lib/Attribute.js";import{BufferGeometry as S}from"../../webgl-engine/lib/BufferGeometry.js";import{Buffers as C}from"../../webgl-engine/lib/Buffers.js";import{Geometry as w}from"../../webgl-engine/lib/Geometry.js";import{createVerticesView as T}from"../../webgl-engine/lib/VerticesView.js";import{isImagePattern as re}from"../../webgl-engine/materials/lineStippleUtils.js";import{isClosed as E,ribbonLineVertexCount as ie,writeRibbonLineTextureBuffer as D,writeRibbonLineVertices as ae}from"../../webgl-engine/materials/internal/ribbonLineBufferUtils.js";import{getLayout as oe,getTextureBufferLayout as O}from"../../webgl-engine/shaders/RibbonLineLayouts.js";function k(e,t,n=null){let r=[],i=t.mapPositions,a=P(t,r),o=a.data,s=a.indices.length,c=b(s);return F(t,r,c),R(t,r,c),I(t,r,c),L(t,r,a.indices,c),z(t,r,a.indices,c),B(t,r),V(t,r,a.indices,c),H(e,t,r,o),n!=null&&te(r,n,c),new w(e,r,i)}function A(t,r,i,a,s=null){let c=r.attributeData,l=T({data:c.position,size:3,stride:3},3),u=E(t.parameters,l.count),d=oe(t.parameters).createBuffer(ie(l.count,u,t.parameters)),f=O(t.parameters).createBuffer(l.count+(u?3:2)),p=f.layout.fields.has(`u0`)?U(t.parameters,r.overlayInfo,c.position):null;return o(Q,i.vec3),e($,s??n,Q),D({...c,position:l,distancesToStart:p,olidColor:a},u,{buffer:f,offset:0},$),ae(l.count,u,t.parameters,{buffer:d,offset:0},0),new S(t,new C(d,f),i,r.mapPositions)}function j(t,r,i,a=null){o(Q,t.localOrigin.vec3),e($,a??n,Q);let s=T({data:r,size:3,stride:3},3);D({position:s,color:i},E(t.material.parameters,s.count),{buffer:t.getMutableBuffers().storage,offset:0},$)}function M(e,t,n=null){let r=Y(X,e,n);return p(r,Z),t.getOrigin(Z)}function N(e,t,n,r=null){let i=Y(X,n,r);return p(i,Z),t.needsOriginUpdate(e,Z,0)}function P(e,t){let{attributeData:{position:n},removeDuplicateStartEnd:r}=e,i=n.length/3,a=i>2&&W(n)&&r,o=i-+!!a,s=Array(2*(o-1)),c=a?n.slice(0,-3):n,l=0;for(let e=0;e<o-1;e++)s[l++]=e,s[l++]=e+1;let u=new x(c,s,3,a);return t.push([`position`,u]),u}function F(e,t,n){if(e.attributeData.colorFeature!=null)return;let r=e.attributeData.color;t.push([`color`,new x(r??u,n,4)])}function I(e,t,n){e.attributeData.normal&&t.push([`normal`,new x(e.attributeData.normal,n,3)])}function L(e,t,n,r){let i=e.attributeData.colorFeature;i!=null&&(typeof i==`number`?t.push([`colorFeatureAttribute`,new x([i],r,1,!0)]):t.push([`colorFeatureAttribute`,new x(i,n,1,!0)]))}function R(e,t,n){e.attributeData.sizeFeature??t.push([`size`,new x([e.attributeData.size??1],n,1,!0)])}function z(e,t,n,r){let i=e.attributeData.sizeFeature;i!=null&&(typeof i==`number`?t.push([`sizeFeatureAttribute`,new x([i],r,1,!0)]):t.push([`sizeFeatureAttribute`,new x(i,n,1,!0)]))}function B(e,t){let{attributeData:{position:n,timeStamps:r}}=e;if(!r)return;let i=n.length/3,a=Array(2*(i-1)),o=0;for(let e=0;e<i-1;e++)a[o++]=e,a[o++]=e+1;t.push([`timeStamps`,new x(r,a,q,!0)])}function V(e,t,n,r){let i=e.attributeData.opacityFeature;i!=null&&(typeof i==`number`?t.push([`opacityFeatureAttribute`,new x([i],r,1,!0)]):t.push([`opacityFeatureAttribute`,new x(i,n,1,!0)]))}function H(e,{overlayInfo:t},n,r){let i=U(e.parameters,t,r);i!=null&&n.push([`distanceToStart`,new x(i,n[0][1].indices,1,!0)])}function U(e,t,n){if(t==null||!G(e)||e.stipplePattern==null)return null;let{renderCoordsHelper:a,spatialReference:o}=t,s=o.isGeographic&&a.viewingMode===1,c=e.worldSized||re(e.stipplePattern);if(!c&&!s)return null;let l=n;if(s){let e=v(n.length),t=d(o);for(let r=0;r<e.length;r+=3)f(n,r,e,r,t);l=e}let u=n.length/3,p=ee(u+1),m=a.viewingMode===1,h=K,g=se,_=0,y=0,b=0;r(h,l[y++],l[y++]),y++,p[0]=0;for(let e=1;e<u+1;++e){e===u&&(y=0);let t=y;r(g,l[y++],l[y++]),y++;let a=(n[b+1]+n[t+1])/2,s=c?ne(o,m,a):1;_+=i(h,g)*s,p[e]=_,[h,g]=[g,h],b=t}return p}function W(e){let t=e.length;return e[0]===e[t-3]&&e[1]===e[t-2]&&e[2]===e[t-1]}function G(e){return`stipplePattern`in e}const K=a(),se=a(),q=4;function ce(e,t,n,r,i,a){if(e==null||e.length===0)return[];let o=[];for(let s=0;s<e.length;s++){let c=e[s];if(c.length<2)continue;let l=c.length,u=v(l*3);for(let e=0;e<l;e++){let t=c[e];u[e*3]=t[0],u[e*3+1]=t[1],u[e*3+2]=t[2]}let d=a?.[s];o.push({attributeData:{position:u,normal:t,colorFeature:n?.[s],opacityFeature:r?.[s],sizeFeature:i?.[s],timeStamps:d==null?void 0:J(d.timeStamps,d.stage)},removeDuplicateStartEnd:!1})}return o}function le(e,t=0,n=.01){let r=y(e.length);r[0]=0;for(let t=1;t<e.length;t++){let n=e[t-1],i=e[t],a=Math.sqrt((i[0]-n[0])**2+(i[1]-n[1])**2+(i[2]-n[2])**2);r[t]=r[t-1]+a}let i=r.map(e=>e*n);if(t!==0&&t<i.length){let e=i[t];for(let t=0;t<i.length;t++)i[t]-=e}return i}function J(e,t){let n=y(e.length*4),r=e[0],i=e[e.length-1];for(let a=0;a<e.length;a++)n[a*4]=e[a],n[a*4+1]=r,n[a*4+2]=i,n[a*4+3]=t+.5;return n}function Y(e,t,n){if(n==null)return m(t,e);h(e);for(let r=0;r<t.length;r+=3)s(Z,t[r],t[r+1],t[r+2]),c(Z,Z,n),g(e,Z);return e}const X=_(),Z=l(),Q=l(),$=t();export{U as computeLineDistances,A as createBufferGeometry,k as createGeometry,le as getLinearTimeStamps,ce as lineStripsToParameters,N as needsBufferGeometryOriginUpdate,q as numTimeStampValuesPerVertex,M as selectLocalOrigin,J as timeStampsToAttribute,j as updateBufferGeometry};
2
+ import{translateAffine as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as t,create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as r,dist as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{negate as o,set as s,transformMat4 as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as d}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as f}from"../../../../geometry/projection/projectors.js";import{center as p,fromBuffer as m,setEmpty as h,expandWithVec3 as g,create as _}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as v}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as ee}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as y}from"../../../../geometry/support/HalfFloatArray.js";import{getZeroIndexArray as b}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as te}from"../../layers/graphics/olidUtils.js";import{getPlanarDistanceToGroundRatio as ne}from"../planarDistanceToGroundRatio.js";import{Attribute as x}from"../../webgl-engine/lib/Attribute.js";import{BufferGeometry as S}from"../../webgl-engine/lib/BufferGeometry.js";import{Buffers as C}from"../../webgl-engine/lib/Buffers.js";import{Geometry as w}from"../../webgl-engine/lib/Geometry.js";import{createVerticesView as T}from"../../webgl-engine/lib/VerticesView.js";import{isImagePattern as re}from"../../webgl-engine/materials/lineStippleUtils.js";import{writeRibbonLineTextureBuffer as E,isClosed as D,ribbonLineVertexCount as ie,writeRibbonLineVertices as ae}from"../../webgl-engine/materials/internal/ribbonLineBufferUtils.js";import{getLayout as oe,getTextureBufferLayout as O}from"../../webgl-engine/shaders/RibbonLineLayouts.js";function k(e,t,n=null){let r=[],i=t.mapPositions,a=P(t,r),o=a.data,s=a.indices.length,c=b(s);return F(t,r,c),R(t,r,c),I(t,r,c),L(t,r,a.indices,c),z(t,r,a.indices,c),B(t,r),V(t,r,a.indices,c),H(e,t,r,o),n!=null&&te(r,n,c),new w(e,r,i)}function A(n,r,i,a,s=null){let c=r.attributeData,l=T({data:c.position,size:3,stride:3},3),u=D(n.parameters,l.count),d=oe(n.parameters).createBuffer(ie(l.count,u,n.parameters)),f=O(n.parameters).createBuffer(l.count+(u?3:2)),p=f.layout.fields.has(`u0`)?U(n.parameters,r.overlayInfo,c.position):null;return o(Q,i.vec3),e($,s??t,Q),E({...c,position:l,distancesToStart:p,olidColor:a},u,{buffer:f,offset:0},$),ae(l.count,u,n.parameters,{buffer:d,offset:0},0),new S(n,new C(d,f),i,r.mapPositions)}function j(n,r,i,a=null){o(Q,n.localOrigin.vec3),e($,a??t,Q);let s=T({data:r,size:3,stride:3},3);E({position:s,color:i},D(n.material.parameters,s.count),{buffer:n.getMutableBuffers().storage,offset:0},$)}function M(e,t,n=null){let r=Y(X,e,n);return p(r,Z),t.getOrigin(Z)}function N(e,t,n,r=null){let i=Y(X,n,r);return p(i,Z),t.needsOriginUpdate(e,Z,0)}function P(e,t){let{attributeData:{position:n},removeDuplicateStartEnd:r}=e,i=n.length/3,a=i>2&&W(n)&&r,o=i-+!!a,s=Array(2*(o-1)),c=a?n.slice(0,-3):n,l=0;for(let e=0;e<o-1;e++)s[l++]=e,s[l++]=e+1;let u=new x(c,s,3,a);return t.push([`position`,u]),u}function F(e,t,n){if(e.attributeData.colorFeature!=null)return;let r=e.attributeData.color;t.push([`color`,new x(r??u,n,4)])}function I(e,t,n){e.attributeData.normal&&t.push([`normal`,new x(e.attributeData.normal,n,3)])}function L(e,t,n,r){let i=e.attributeData.colorFeature;i!=null&&(typeof i==`number`?t.push([`colorFeatureAttribute`,new x([i],r,1,!0)]):t.push([`colorFeatureAttribute`,new x(i,n,1,!0)]))}function R(e,t,n){e.attributeData.sizeFeature??t.push([`size`,new x([e.attributeData.size??1],n,1,!0)])}function z(e,t,n,r){let i=e.attributeData.sizeFeature;i!=null&&(typeof i==`number`?t.push([`sizeFeatureAttribute`,new x([i],r,1,!0)]):t.push([`sizeFeatureAttribute`,new x(i,n,1,!0)]))}function B(e,t){let{attributeData:{position:n,timeStamps:r}}=e;if(!r)return;let i=n.length/3,a=Array(2*(i-1)),o=0;for(let e=0;e<i-1;e++)a[o++]=e,a[o++]=e+1;t.push([`timeStamps`,new x(r,a,q,!0)])}function V(e,t,n,r){let i=e.attributeData.opacityFeature;i!=null&&(typeof i==`number`?t.push([`opacityFeatureAttribute`,new x([i],r,1,!0)]):t.push([`opacityFeatureAttribute`,new x(i,n,1,!0)]))}function H(e,{overlayInfo:t},n,r){let i=U(e.parameters,t,r);i!=null&&n.push([`distanceToStart`,new x(i,n[0][1].indices,1,!0)])}function U(e,t,n){if(t==null||!G(e)||e.stipplePattern==null)return null;let{renderCoordsHelper:a,spatialReference:o}=t,s=o.isGeographic&&a.viewingMode===1,c=e.worldSized||re(e.stipplePattern);if(!c&&!s)return null;let l=n;if(s){let e=v(n.length),t=d(o);for(let r=0;r<e.length;r+=3)f(n,r,e,r,t);l=e}let u=n.length/3,p=ee(u+1),m=a.viewingMode===1,h=K,g=se,_=0,y=0,b=0;r(h,l[y++],l[y++]),y++,p[0]=0;for(let e=1;e<u+1;++e){e===u&&(y=0);let t=y;r(g,l[y++],l[y++]),y++;let a=(n[b+1]+n[t+1])/2,s=c?ne(o,m,a):1;_+=i(h,g)*s,p[e]=_,[h,g]=[g,h],b=t}return p}function W(e){let t=e.length;return e[0]===e[t-3]&&e[1]===e[t-2]&&e[2]===e[t-1]}function G(e){return`stipplePattern`in e}const K=a(),se=a(),q=4;function ce(e,t,n,r,i,a){if(e==null||e.length===0)return[];let o=[];for(let s=0;s<e.length;s++){let c=e[s];if(c.length<2)continue;let l=c.length,u=v(l*3);for(let e=0;e<l;e++){let t=c[e];u[e*3]=t[0],u[e*3+1]=t[1],u[e*3+2]=t[2]}let d=a?.[s];o.push({attributeData:{position:u,normal:t,colorFeature:n?.[s],opacityFeature:r?.[s],sizeFeature:i?.[s],timeStamps:d==null?void 0:J(d.timeStamps,d.stage)},removeDuplicateStartEnd:!1})}return o}function le(e,t=0,n=.01){let r=y(e.length);r[0]=0;for(let t=1;t<e.length;t++){let n=e[t-1],i=e[t],a=Math.sqrt((i[0]-n[0])**2+(i[1]-n[1])**2+(i[2]-n[2])**2);r[t]=r[t-1]+a}let i=r.map(e=>e*n);if(t!==0&&t<i.length){let e=i[t];for(let t=0;t<i.length;t++)i[t]-=e}return i}function J(e,t){let n=y(e.length*4),r=e[0],i=e[e.length-1];for(let a=0;a<e.length;a++)n[a*4]=e[a],n[a*4+1]=r,n[a*4+2]=i,n[a*4+3]=t+.5;return n}function Y(e,t,n){if(n==null)return m(t,e);h(e);for(let r=0;r<t.length;r+=3)s(Z,t[r],t[r+1],t[r+2]),c(Z,Z,n),g(e,Z);return e}const X=_(),Z=l(),Q=l(),$=n();export{U as computeLineDistances,A as createBufferGeometry,k as createGeometry,le as getLinearTimeStamps,ce as lineStripsToParameters,N as needsBufferGeometryOriginUpdate,q as numTimeStampValuesPerVertex,M as selectLocalOrigin,J as timeStampsToAttribute,j as updateBufferGeometry};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as n}from"../../../../core/memoryEstimations.js";import{isAbortError as r}from"../../../../core/promiseUtils.js";import{signal as i}from"../../../../core/signal.js";import{Milliseconds as a,now as o}from"../../../../core/time.js";import{exactEquals as s,copy as c,normalize as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,exactEquals as f,intersects as p,copy as m}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as h}from"../../layers/support/makeScheduleFunction.js";import{SplatSortWorkerInput as g}from"../GaussianSplatSortWorker.js";import{GaussianSplatSortWorkerHandle as _}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as v}from"./GaussianSplatFadeTexture.js";import{GaussianSplatHeaderTexture as y}from"./GaussianSplatHeaderTexture.js";import{GaussianSplatOrderTexture as b}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as x}from"./GaussianSplatTextureAtlas.js";import{DepthRange as S}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as C}from"../../../support/Scheduler.js";class w{constructor(e,t,n){this._updating=i(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this._sortWorkerMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new S,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._sortBufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=[],this._latestSortedGaussianTiles=[],this._nextCommittedVisibleGaussianTiles=[],this._workerResidentTiles=new Map,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortReason=null,this._scheduledSortStartTimeout=null,this._lastSortStartTime=a(-1/0),this._viewSortInterval=a(80),this._dataSortInterval=a(160),this._renderer=e,this._onSortComplete=t,this._orderTexture=new b(this._renderer.renderingContext),this._fadingTexture=new v(this._renderer.renderingContext),this._headerTexture=new y(this._renderer.renderingContext),this._textureAtlas=new x(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache,n);let{resourceController:r}=this._renderer.view;this._workerHandle=new _(h(r)),this._frameTask=r.scheduler.registerTask(C.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get headerTexture(){return this._headerTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get headerTextureMemory(){return this._headerTexture.usedMemory}get sortBufferMemory(){return this._sortBufferMemory}get sortWorkerMemory(){return this._sortWorkerMemory}get usedMemory(){return this.textureAtlasMemory+this.headerTextureMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory+this.sortWorkerMemory}queryVisibleTileDepthRange(e,t){if(this.visibleGaussians===0)return null;let{eye:n,viewForward:r}=e,i=n[0],a=n[1],o=n[2],l=r[0],u=r[1],d=r[2],h=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&s(this._previousVisibleTileDepthRangeEye,n)&&s(this._previousVisibleTileDepthRangeViewForward,r)&&(t==null?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&f(this._previousVisibleTileDepthRangeClippingBox,t)))return h.near<=h.far?h:null;let g=1/0,_=-1/0,v=this._latestSortedGaussianTiles;for(let e=0;e<v.length;e++){let n=v[e];if(t!=null){let e=n.boundingBox;if(!p(e,t))continue}let r=l*(n.obbCenterX-i)+u*(n.obbCenterY-a)+d*(n.obbCenterZ-o),s=n.paddedMbsRadius,c=r-s;c<g&&(g=c);let f=r+s;f>_&&(_=f)}let y=g<=_;return y?h.set(g,_):h.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=t!=null,c(this._previousVisibleTileDepthRangeEye,n),c(this._previousVisibleTileDepthRangeViewForward,r),t!=null&&m(this._previousVisibleTileDepthRangeClippingBox,t),y?h:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort(`data`)}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortReason=null,this._updating.value=!1,this._scheduledSortStartTimeout!=null&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._sortWorkerMemory=0,this._textureAtlas.destroy(),this._headerTexture.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(e=`view`){this._updating.value=!0,this._pendingSortReason!==`view`&&this._pendingSortReason!==e&&(this._pendingSortReason=e,this._scheduledSortStartTimeout!=null&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._scheduleSortStart())}_scheduleSortStart(){if(this._isSorting)return;let e=o()-this._lastSortStartTime,t=(this._pendingSortReason===`view`?this._viewSortInterval:this._dataSortInterval)-e;t<=0?this._startSortIfRequired():this._scheduledSortStartTimeout??=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortReason!=null&&!this._isSorting&&this._scheduleSortStart()},t)}_startSortIfRequired(){if(this._isSorting||this._pendingSortReason==null)return;let e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortReason=null,this._lastSortStartTime=o(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortReason==null?this._updating.value=!1:this._scheduleSortStart()}_clearBuffersAndTextures(){this._sortedAtlasIndicesBuffer=void 0,this._sortBufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear(),this._headerTexture.clear()}_computeExpandedCapacity(t,n){let r=Math.max(1,t);for(;r<n;)r=Math.ceil(r*e);return r}_ensureSortBufferCapacity(e){if(this._sortBufferCapacity<e){let t=this._computeExpandedCapacity(this._sortBufferCapacity,e);this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._sortBufferMemory=n(this._sortedAtlasIndicesBuffer),this._sortBufferCapacity=t}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._workerResidentTiles.clear(),this._sortWorkerMemory=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(this._latestUpdatedGaussianTiles.length===0){this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1);return}this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);let t=this._latestUpdatedGaussianTiles,n=t.length,r=this._requestedLyr3dVisibilityChange,i=0;for(let e=0;e<n;e++)i+=t[e].gaussianCount;this._ensureSortBufferCapacity(i),this._textureAtlas.ensureTextureAtlas(),this._headerTexture.ensureCapacity(this._textureAtlas.pageAllocator.pageCount);let a=this._renderer.camera;l(this._cameraDirectionNormalized,a.ray.direction);let o=this._cameraDirectionNormalized[0],s=this._cameraDirectionNormalized[1],c=this._cameraDirectionNormalized[2],u=0,d=this._renderer.clippingBox,f=this._nextCommittedVisibleGaussianTiles;f.length=0;let m=0,{frustum:h}=a,_=this._renderer.tileCullingRevision,v=h[0],y=h[1],b=h[2],x=h[3],S=h[4],C=h[5];for(let e=0;e<n;e++){let n=t[e],{obbCenterX:r,obbCenterY:i,obbCenterZ:a,paddedMbsRadius:o}=n,s=n.gaussianCount;if(n.cullingRevision!==_){let e=d==null||p(n.boundingBox,d);if(e){let t=o*1.5;e=v[0]*r+v[1]*i+v[2]*a+v[3]<t&&y[0]*r+y[1]*i+y[2]*a+y[3]<t&&b[0]*r+b[1]*i+b[2]*a+b[3]<t&&x[0]*r+x[1]*i+x[2]*a+x[3]<t&&S[0]*r+S[1]*i+S[2]*a+S[3]<t&&C[0]*r+C[1]*i+C[2]*a+C[3]<t}n.cullingRevision=_,n.cullingVisible=e}n.cullingVisible&&(f[m++]=n,u+=s)}if(f.length=m,u===0){this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=r,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1);return}let w=new Map,T=[],E=new Uint32Array(m);for(let e=0;e<m;e++){let t=f[e],n=t.handle;w.set(n,t),E[e]=n,this._workerResidentTiles.get(n)!==t&&T.push({handle:n,relativePositions:t.relativePositions,pageIds:t.pageIds,gaussianCount:t.gaussianCount,originX:t.obbCenterX,originY:t.obbCenterY,originZ:t.obbCenterZ})}let D=[];for(let e of this._workerResidentTiles.keys())w.has(e)||D.push(e);let O=new g(T,Uint32Array.from(D),E,this._sortedAtlasIndicesBuffer,u,o,s,c,this._useDeterministicSort),k=await this._workerHandle?.sort(O,e);if(e.aborted)return;k&&(this._sortedAtlasIndicesBuffer=k.sortedAtlasIndices,this._sortWorkerMemory=k.usedMemory,this._workerResidentTiles=w),await this._frameTask.schedule(async e=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,u);let t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=f,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=r,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()},e)}catch(e){if(r(e))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{w as GaussianSplatDataStore};
2
+ import{exactEquals as e,copy as t}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as r,exactEquals as i,intersects as a,copy as o}from"../../../../geometry/support/aaBoundingBox.js";import{GaussianSplatFadeTexture as s}from"./GaussianSplatFadeTexture.js";import{GaussianSplatHeaderTexture as c}from"./GaussianSplatHeaderTexture.js";import{GaussianSplatOrderTexture as l}from"./GaussianSplatOrderTexture.js";import{GaussianSplatSortCoordinator as u}from"./GaussianSplatSortCoordinator.js";import{GaussianSplatTextureAtlas as d}from"./GaussianSplatTextureAtlas.js";import{DepthRange as f}from"../../webgl-engine/lib/DepthRange.js";class p{constructor(e,t,i){this._visibleTileDepthRange=new f,this._previousVisibleTileDepthRangeEye=n(),this._previousVisibleTileDepthRangeViewForward=n(),this._previousVisibleTileDepthRangeClippingBox=r(),this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._orderTexture=new l(e.renderingContext),this._fadingTexture=new s(e.renderingContext),this._headerTexture=new c(e.renderingContext),this._textureAtlas=new d(e.renderingContext,e.view.resourceController.memoryController,e.fboCache,i),this._sortCoordinator=new u(e,{ensureCapacity:()=>{this._textureAtlas.ensureTextureAtlas(),this._headerTexture.ensureCapacity(this._textureAtlas.pageAllocator.pageCount)},clear:()=>{this._orderTexture.clear(),this._textureAtlas.clear(),this._headerTexture.clear(),this._previousVisibleTileDepthRangeTilesVersion=-1},setOrder:(e,t)=>this._orderTexture.setData(e,t)},t)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get headerTexture(){return this._headerTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get headerTextureMemory(){return this._headerTexture.usedMemory}get sortBufferMemory(){return this._sortCoordinator.sortBufferMemory}get sortWorkerMemory(){return this._sortCoordinator.sortWorkerMemory}get usedMemory(){return this.textureAtlasMemory+this.headerTextureMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory+this.sortWorkerMemory}get visibleGaussians(){return this._sortCoordinator.visibleGaussians}get updating(){return this._sortCoordinator.updating}set useDeterministicSort(e){this._sortCoordinator.useDeterministicSort=e}queryVisibleTileDepthRange(n,r){if(this.visibleGaussians===0)return null;let{eye:s,viewForward:c}=n,l=s[0],u=s[1],d=s[2],f=c[0],p=c[1],m=c[2],h=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._sortCoordinator.visibleTilesVersion&&e(this._previousVisibleTileDepthRangeEye,s)&&e(this._previousVisibleTileDepthRangeViewForward,c)&&(r==null?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&i(this._previousVisibleTileDepthRangeClippingBox,r)))return h.near<=h.far?h:null;let g=1/0,_=-1/0,v=this._sortCoordinator.visibleTiles;for(let e=0;e<v.length;e++){let t=v[e];if(r!=null){let e=t.boundingBox;if(!a(e,r))continue}let n=f*(t.obbCenterX-l)+p*(t.obbCenterY-u)+m*(t.obbCenterZ-d),i=t.paddedMbsRadius,o=n-i;o<g&&(g=o);let s=n+i;s>_&&(_=s)}let y=g<=_;return y?h.set(g,_):h.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._sortCoordinator.visibleTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=r!=null,t(this._previousVisibleTileDepthRangeEye,s),t(this._previousVisibleTileDepthRangeViewForward,c),r!=null&&o(this._previousVisibleTileDepthRangeClippingBox,r),y?h:null}updateGaussianVisibility(e,t){this._sortCoordinator.updateGaussianVisibility(e,t)}requestSort(e=`view`){this._sortCoordinator.requestSort(e)}destroy(){this._sortCoordinator.destroy(),this._textureAtlas.destroy(),this._headerTexture.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}}export{p as GaussianSplatDataStore};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{subtract as e,length as t,scale as n,negate as r,dot as i,transformQuatValues as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as s}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{project as c}from"../../../../geometry/projectionUtils.js";import{intersects as l,contains as u}from"../../../../geometry/support/aaBoundingBox.js";import{fromExtent as d}from"../../../../geometry/support/aaBoundingRect.js";import{create as f}from"../../../../geometry/support/plane.js";import{fromPoints as p}from"../../../../geometry/support/ray.js";import{GaussianSplatTarget as m}from"../../layers/i3s/Intersector.js";import{createTileBVH as h}from"../../layers/support/Tiles3DBVH.js";import{ElevationRange as g}from"../ElevationRange.js";import{gaussianEllipsoidScaleMultiplier as _}from"./formatConstants.js";import{IntersectorResultRay as v}from"../../webgl-engine/lib/IntersectorResult.js";class y{constructor(e){this.layerView=e,this.type=0,this.slicePlaneEnabled=!1,this.isGround=!1,this._ellipsoidLocalRayOrigin=o(),this._ellipsoidLocalRayDir=o(),this.intersectionNormal=o(),this.intersectionRayDir=o(),this.intersectionPlane=f(),this.layerViewUid=e.uid;let t=e.view.viewingMode,n=(e.useEsriCrs?e.fullExtentInLocalViewSpatialReference:e.layer.fullExtent?c(e.layer.fullExtent,e.view.renderSpatialReference):void 0)??e.view.extent,r=d(n);this._bvh=h(t,r)}destroy(){this._bvh.destroy()}addTile(e){this._bvh.addTile(e)}removeTile(e){this._bvh.removeTile(e)}get elevationRange(){let e=this._bvh.elevationRange;return e!=null&&!e.isEmpty?new g(e.minElevation,e.maxElevation):null}intersectRay(a,c,d,f,h,g){let{intersectionRayDir:_,intersectionPlane:y,layerViewUid:S,intersectionNormal:C}=this,w=p(d,f);e(_,f,d);let T=1/t(_);n(_,_,T),r(C,_),s(y,_[0],_[1],_[2],-i(_,d));let E=new x,D=new x,O=a.options.store,k=O===0,A=O===2,j=O===1||A,M=A?[]:null,N=(e,t,n,r,i,a,s,c)=>{let l=e.point??=o();l[0]=n,l[1]=r,l[2]=i,e.dist=t,e.normal=C;let u=e.outwardDirection??=o(),d=a*a+s*s+c*c;if(d>0){let e=1/Math.sqrt(d);u[0]=a*e,u[1]=s*e,u[2]=c*e}else u[0]=C[0],u[1]=C[1],u[2]=C[2];return e.layerViewUid=S,e},P=d[0],F=d[1],I=d[2],L=_[0],R=_[1],z=_[2],B=this.layerView.clippingBox,V=e=>{let{relativePositions:t,packedRotations:n,packedOpacityScaledScales:r,gaussianCount:i,obb:a,maxSplatMbsRadiusSquared:o}=e,s=a.centerX,l=a.centerY,u=a.centerZ,p=-1,m=B[0],h=B[1],g=B[2],_=B[3],v=B[4],y=B[5];for(let e=0,a=0;e<i;e++,a+=3){let i=t[a]+s,b=t[a+1]+l,S=t[a+2]+u;if(i<m||b<h||S<g||i>_||b>v||S>y)continue;let C=i-P,w=b-F,O=S-I,B=C*L+w*R+O*z;if(B<0&&B*B>o)continue;let V=B<0?0:B;if(C*C+w*w+O*O-V*V>o||k&&E.dist!=null&&(p<0&&(p=Math.sqrt(o)),Math.max(B-p,0)*T>=E.dist))continue;let H=this._intersectGaussianEllipsoid(C,w,O,L,R,z,n[e],r[e]);if(H<0)continue;let U=H*T;if(c!=null&&!c(d,f,U))continue;let W=E.dist==null||U<E.dist,G=j&&(D.dist==null||U>D.dist);if(!W&&!G&&!A)continue;let K=L*H,q=R*H,ee=z*H,J=P+K,Y=F+q,X=I+ee,Z=K-C,Q=q-w,$=ee-O;if(W&&N(E,U,J,Y,X,Z,Q,$),G&&N(D,U,J,Y,X,Z,Q,$),A){let e=new x;M.push(N(e,U,J,Y,X,Z,Q,$))}}},H=e=>{let{relativePositions:t,packedRotations:n,packedOpacityScaledScales:r,gaussianCount:i,obb:a,maxSplatMbsRadiusSquared:o}=e,s=a.centerX,l=a.centerY,u=a.centerZ,p=-1,m=P-s,h=F-l,g=I-u;for(let e=0,a=0;e<i;e++,a+=3){let i=t[a]-m,s=t[a+1]-h,l=t[a+2]-g,u=i*L+s*R+l*z;if(u<0&&u*u>o)continue;let _=u<0?0:u;if(i*i+s*s+l*l-_*_>o||k&&E.dist!=null&&(p<0&&(p=Math.sqrt(o)),Math.max(u-p,0)*T>=E.dist))continue;let v=this._intersectGaussianEllipsoid(i,s,l,L,R,z,n[e],r[e]);if(v<0)continue;let y=v*T;if(c!=null&&!c(d,f,y))continue;let b=E.dist==null||y<E.dist,S=j&&(D.dist==null||y>D.dist);if(!b&&!S&&!A)continue;let C=L*v,w=R*v,O=z*v,B=P+C,V=F+w,H=I+O,U=C-i,W=w-s,G=O-l;if(b&&N(E,y,B,V,H,U,W,G),S&&N(D,y,B,V,H,U,W,G),A){let e=new x;M.push(N(e,y,B,V,H,U,W,G))}}},U=(e,t)=>{let{min:n,max:r}=e.obb.signedDistanceRangePlane(y);if(r<0)return;let i=n*T;if(!(k&&E.dist!=null&&E.dist<i)){if(E.dist!=null&&D.dist!=null){let e=r*T;if(E.dist<i&&D.dist>e)return}t?V(e):H(e)}};this._bvh.forEachTileIntersectingRay(d,f,B==null?e=>{U(e,!1)}:e=>{let t=e.boundingBox;l(t,B)&&U(e,!u(B,t))},g);let W=(e,t)=>{let{layerViewUid:n}=t,r=new m(t.point,t.outwardDirection,n);e.set(0,r,t.dist,t.dist,t.normal)};if(b(E)){let e=a.results.min;(e.distance==null||E.dist<e.distance)&&W(e,E)}if(b(D)&&j){let e=a.results.max;(e.distance==null||D.dist>e.distance)&&W(e,D)}if(A&&M?.length)for(let e of M){let t=new v(w);W(t,e),a.results.all.push(t)}}_intersectGaussianEllipsoid(e,t,n,r,i,o,s,c){let l=s>>>30,u=s&1023,d=s>>>10&1023,f=s>>>20&1023,p=(u&S)*C*(1-(u>>>9&1)*2),m=(d&S)*C*(1-(d>>>9&1)*2),h=(f&S)*C*(1-(f>>>9&1)*2),g,_,v,y,b=p*p+m*m+h*h,x=Math.sqrt(Math.max(0,1-b));switch(l){case 0:g=x,_=h,v=m,y=p;break;case 1:g=h,_=x,v=m,y=p;break;case 2:g=h,_=m,v=x,y=p;break;default:g=h,_=m,v=p,y=x}let E=this._ellipsoidLocalRayOrigin;E[0]=-e,E[1]=-t,E[2]=-n,a(E,E,-g,-_,-v,y);let D=this._ellipsoidLocalRayDir;D[0]=r,D[1]=i,D[2]=o,a(D,D,-g,-_,-v,y);let O=T[c&255],k=T[c>>>8&255],A=T[c>>>16],j=E[0]*O,M=E[1]*k,N=E[2]*A,P=j*j+M*M+N*N;if(P<=1)return 0;let F=D[0]*O,I=D[1]*k,L=D[2]*A,R=F*F+I*I+L*L,z=j*F+M*I+N*L;if(z>0)return w;let B=z*z-R*(P-1);return B<0?w:(-z-Math.sqrt(B))/R}getElevationRange(e){return this._bvh.getElevationRangeIntersectingSphere(e)??new g(0,0)}}function b(e){return e.dist!=null&&e.point!=null}class x{constructor(){this.point=null,this.dist=null,this.normal=null,this.outwardDirection=null,this.layerViewUid=``}}const S=511,C=Math.SQRT1_2/511,w=-1,T=(()=>{let e=new Float64Array(256);for(let t=0;t<e.length;t++)e[t]=Math.exp(10-t/16)/_;return e})();export{y as GaussianSplatIntersectionHandler};
2
+ import{subtract as e,length as t,scale as n,negate as r,dot as i,transformQuatValues as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as s}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{intersects as c,contains as l}from"../../../../geometry/support/aaBoundingBox.js";import{create as u}from"../../../../geometry/support/plane.js";import{fromPoints as d}from"../../../../geometry/support/ray.js";import{GaussianSplatTarget as f}from"../../layers/i3s/Intersector.js";import{createTileBVHForLayer as p}from"../../layers/support/createTileBVHForLayer.js";import{ElevationRange as m}from"../ElevationRange.js";import{gaussianEllipsoidScaleMultiplier as h}from"./formatConstants.js";import{IntersectorResultRay as g}from"../../webgl-engine/lib/IntersectorResult.js";class _{constructor(e){this.layerView=e,this.type=0,this.slicePlaneEnabled=!1,this.isGround=!1,this._ellipsoidLocalRayOrigin=o(),this._ellipsoidLocalRayDir=o(),this.intersectionNormal=o(),this.intersectionRayDir=o(),this.intersectionPlane=u(),this.layerViewUid=e.uid,this._bvh=p(e)}destroy(){this._bvh.destroy()}addTile(e){this._bvh.addTile(e)}removeTile(e){this._bvh.removeTile(e)}get elevationRange(){let e=this._bvh.elevationRange;return e!=null&&!e.isEmpty?new m(e.minElevation,e.maxElevation):null}intersectRay(a,u,p,m,h,_){let{intersectionRayDir:b,intersectionPlane:x,layerViewUid:S,intersectionNormal:C}=this,w=d(p,m);e(b,m,p);let T=1/t(b);n(b,b,T),r(C,b),s(x,b[0],b[1],b[2],-i(b,p));let E=new y,D=new y,O=a.options.store,k=O===0,A=O===2,j=O===1||A,M=A?[]:null,N=(e,t,n,r,i,a,s,c)=>{let l=e.point??=o();l[0]=n,l[1]=r,l[2]=i,e.dist=t,e.normal=C;let u=e.outwardDirection??=o(),d=a*a+s*s+c*c;if(d>0){let e=1/Math.sqrt(d);u[0]=a*e,u[1]=s*e,u[2]=c*e}else u[0]=C[0],u[1]=C[1],u[2]=C[2];return e.layerViewUid=S,e},P=p[0],F=p[1],I=p[2],L=b[0],R=b[1],z=b[2],B=this.layerView.clippingBox,V=e=>{let{relativePositions:t,packedRotations:n,packedOpacityScaledScales:r,gaussianCount:i,obb:a,maxSplatMbsRadiusSquared:o}=e,s=a.centerX,c=a.centerY,l=a.centerZ,d=-1,f=B[0],h=B[1],g=B[2],_=B[3],v=B[4],b=B[5];for(let e=0,a=0;e<i;e++,a+=3){let i=t[a]+s,x=t[a+1]+c,S=t[a+2]+l;if(i<f||x<h||S<g||i>_||x>v||S>b)continue;let C=i-P,w=x-F,O=S-I,B=C*L+w*R+O*z;if(B<0&&B*B>o)continue;let V=B<0?0:B;if(C*C+w*w+O*O-V*V>o||k&&E.dist!=null&&(d<0&&(d=Math.sqrt(o)),Math.max(B-d,0)*T>=E.dist))continue;let H=this._intersectGaussianEllipsoid(C,w,O,L,R,z,n[e],r[e]);if(H<0)continue;let U=H*T;if(u!=null&&!u(p,m,U))continue;let W=E.dist==null||U<E.dist,G=j&&(D.dist==null||U>D.dist);if(!W&&!G&&!A)continue;let K=L*H,q=R*H,ee=z*H,J=P+K,Y=F+q,X=I+ee,Z=K-C,Q=q-w,$=ee-O;if(W&&N(E,U,J,Y,X,Z,Q,$),G&&N(D,U,J,Y,X,Z,Q,$),A){let e=new y;M.push(N(e,U,J,Y,X,Z,Q,$))}}},H=e=>{let{relativePositions:t,packedRotations:n,packedOpacityScaledScales:r,gaussianCount:i,obb:a,maxSplatMbsRadiusSquared:o}=e,s=a.centerX,c=a.centerY,l=a.centerZ,d=-1,f=P-s,h=F-c,g=I-l;for(let e=0,a=0;e<i;e++,a+=3){let i=t[a]-f,s=t[a+1]-h,c=t[a+2]-g,l=i*L+s*R+c*z;if(l<0&&l*l>o)continue;let _=l<0?0:l;if(i*i+s*s+c*c-_*_>o||k&&E.dist!=null&&(d<0&&(d=Math.sqrt(o)),Math.max(l-d,0)*T>=E.dist))continue;let v=this._intersectGaussianEllipsoid(i,s,c,L,R,z,n[e],r[e]);if(v<0)continue;let b=v*T;if(u!=null&&!u(p,m,b))continue;let x=E.dist==null||b<E.dist,S=j&&(D.dist==null||b>D.dist);if(!x&&!S&&!A)continue;let C=L*v,w=R*v,O=z*v,B=P+C,V=F+w,H=I+O,U=C-i,W=w-s,G=O-c;if(x&&N(E,b,B,V,H,U,W,G),S&&N(D,b,B,V,H,U,W,G),A){let e=new y;M.push(N(e,b,B,V,H,U,W,G))}}},U=(e,t)=>{let{min:n,max:r}=e.obb.signedDistanceRangePlane(x);if(r<0)return;let i=n*T;if(!(k&&E.dist!=null&&E.dist<i)){if(E.dist!=null&&D.dist!=null){let e=r*T;if(E.dist<i&&D.dist>e)return}t?V(e):H(e)}};this._bvh.forEachTileIntersectingRay(p,m,B==null?e=>{U(e,!1)}:e=>{let t=e.boundingBox;c(t,B)&&U(e,!l(B,t))},_);let W=(e,t)=>{let{layerViewUid:n}=t,r=new f(t.point,t.outwardDirection,n);e.set(0,r,t.dist,t.dist,t.normal)};if(v(E)){let e=a.results.min;(e.distance==null||E.dist<e.distance)&&W(e,E)}if(v(D)&&j){let e=a.results.max;(e.distance==null||D.dist>e.distance)&&W(e,D)}if(A&&M?.length)for(let e of M){let t=new g(w);W(t,e),a.results.all.push(t)}}_intersectGaussianEllipsoid(e,t,n,r,i,o,s,c){let l=s>>>30,u=s&1023,d=s>>>10&1023,f=s>>>20&1023,p=(u&b)*x*(1-(u>>>9&1)*2),m=(d&b)*x*(1-(d>>>9&1)*2),h=(f&b)*x*(1-(f>>>9&1)*2),g,_,v,y,w=p*p+m*m+h*h,T=Math.sqrt(Math.max(0,1-w));switch(l){case 0:g=T,_=h,v=m,y=p;break;case 1:g=h,_=T,v=m,y=p;break;case 2:g=h,_=m,v=T,y=p;break;default:g=h,_=m,v=p,y=T}let E=this._ellipsoidLocalRayOrigin;E[0]=-e,E[1]=-t,E[2]=-n,a(E,E,-g,-_,-v,y);let D=this._ellipsoidLocalRayDir;D[0]=r,D[1]=i,D[2]=o,a(D,D,-g,-_,-v,y);let O=C[c&255],k=C[c>>>8&255],A=C[c>>>16],j=E[0]*O,M=E[1]*k,N=E[2]*A,P=j*j+M*M+N*N;if(P<=1)return 0;let F=D[0]*O,I=D[1]*k,L=D[2]*A,R=F*F+I*I+L*L,z=j*F+M*I+N*L;if(z>0)return S;let B=z*z-R*(P-1);return B<0?S:(-z-Math.sqrt(B))/R}getElevationRange(e){return this._bvh.getElevationRangeIntersectingSphere(e)??new m(0,0)}}function v(e){return e.dist!=null&&e.point!=null}class y{constructor(){this.point=null,this.dist=null,this.normal=null,this.outwardDirection=null,this.layerViewUid=``}}const b=511,x=Math.SQRT1_2/511,S=-1,C=(()=>{let e=new Float64Array(256);for(let t=0;t<e.length;t++)e[t]=Math.exp(10-t/16)/h;return e})();export{_ as GaussianSplatIntersectionHandler};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as n}from"../../../../core/memoryEstimations.js";import{isAbortError as r}from"../../../../core/promiseUtils.js";import{signal as i}from"../../../../core/signal.js";import{Milliseconds as a,now as o}from"../../../../core/time.js";import{normalize as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersects as l}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as u}from"../../layers/support/makeScheduleFunction.js";import{SplatSortWorkerInput as d}from"../GaussianSplatSortWorker.js";import{GaussianSplatSortWorkerHandle as f}from"../GaussianSplatWorkerHandle.js";import{TaskPriority as p}from"../../../support/Scheduler.js";class m{constructor(e,t,n){this._textures=t,this._updating=i(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this._sortWorkerMemory=0,this.visibleGaussians=0,this._latestSortedGaussianTilesVersion=0,this._sortBufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=[],this._latestSortedGaussianTiles=[],this._nextCommittedVisibleGaussianTiles=[],this._workerResidentTiles=new Map,this._cameraDirectionNormalized=c(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortReason=null,this._scheduledSortStartTimeout=null,this._lastSortStartTime=a(-1/0),this._viewSortInterval=a(80),this._dataSortInterval=a(160),this._renderer=e,this._onSortComplete=n;let{resourceController:r}=this._renderer.view;this._workerHandle=new f(u(r)),this._frameTask=r.scheduler.registerTask(p.GAUSSIAN_SPLAT_SORTING)}get visibleTiles(){return this._latestSortedGaussianTiles}get visibleTilesVersion(){return this._latestSortedGaussianTilesVersion}get sortBufferMemory(){return this._sortBufferMemory}get sortWorkerMemory(){return this._sortWorkerMemory}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort(`data`)}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortReason=null,this._updating.value=!1,this._scheduledSortStartTimeout!=null&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._sortWorkerMemory=0}requestSort(e=`view`){this._updating.value=!0,this._pendingSortReason!==`view`&&this._pendingSortReason!==e&&(this._pendingSortReason=e,this._scheduledSortStartTimeout!=null&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._scheduleSortStart())}_scheduleSortStart(){if(this._isSorting)return;let e=o()-this._lastSortStartTime,t=(this._pendingSortReason===`view`?this._viewSortInterval:this._dataSortInterval)-e;t<=0?this._startSortIfRequired():this._scheduledSortStartTimeout??=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortReason!=null&&!this._isSorting&&this._scheduleSortStart()},t)}_startSortIfRequired(){if(this._isSorting||this._pendingSortReason==null)return;let e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortReason=null,this._lastSortStartTime=o(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortReason==null?this._updating.value=!1:this._scheduleSortStart()}_clearBuffersAndTextures(){this._sortedAtlasIndicesBuffer=void 0,this._sortBufferCapacity=0,this._sortBufferMemory=0,this._textures.clear()}_computeExpandedCapacity(t,n){let r=Math.max(1,t);for(;r<n;)r=Math.ceil(r*e);return r}_ensureSortBufferCapacity(e){if(this._sortBufferCapacity<e){let t=this._computeExpandedCapacity(this._sortBufferCapacity,e);this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._sortBufferMemory=n(this._sortedAtlasIndicesBuffer),this._sortBufferCapacity=t}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._workerResidentTiles.clear(),this._sortWorkerMemory=0,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(this._latestUpdatedGaussianTiles.length===0){this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1);return}this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);let t=this._latestUpdatedGaussianTiles,n=t.length,r=this._requestedLyr3dVisibilityChange,i=0;for(let e=0;e<n;e++)i+=t[e].gaussianCount;this._ensureSortBufferCapacity(i),this._textures.ensureCapacity();let a=this._renderer.camera;s(this._cameraDirectionNormalized,a.ray.direction);let o=this._cameraDirectionNormalized[0],c=this._cameraDirectionNormalized[1],u=this._cameraDirectionNormalized[2],f=0,p=this._renderer.clippingBox,m=this._nextCommittedVisibleGaussianTiles;m.length=0;let h=0,{frustum:g}=a,_=this._renderer.tileCullingRevision,v=g[0],y=g[1],b=g[2],x=g[3],S=g[4],C=g[5];for(let e=0;e<n;e++){let n=t[e],{obbCenterX:r,obbCenterY:i,obbCenterZ:a,paddedMbsRadius:o}=n,s=n.gaussianCount;if(n.cullingRevision!==_){let e=p==null||l(n.boundingBox,p);if(e){let t=o*1.5;e=v[0]*r+v[1]*i+v[2]*a+v[3]<t&&y[0]*r+y[1]*i+y[2]*a+y[3]<t&&b[0]*r+b[1]*i+b[2]*a+b[3]<t&&x[0]*r+x[1]*i+x[2]*a+x[3]<t&&S[0]*r+S[1]*i+S[2]*a+S[3]<t&&C[0]*r+C[1]*i+C[2]*a+C[3]<t}n.cullingRevision=_,n.cullingVisible=e}n.cullingVisible&&(m[h++]=n,f+=s)}if(m.length=h,f===0){this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=r,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1);return}let w=new Map,T=[],E=new Uint32Array(h);for(let e=0;e<h;e++){let t=m[e],n=t.handle;w.set(n,t),E[e]=n,this._workerResidentTiles.get(n)!==t&&T.push({handle:n,relativePositions:t.relativePositions,pageIds:t.pageIds,gaussianCount:t.gaussianCount,originX:t.obbCenterX,originY:t.obbCenterY,originZ:t.obbCenterZ})}let D=[];for(let e of this._workerResidentTiles.keys())w.has(e)||D.push(e);let O=new d({addedTiles:T,removedTileHandles:Uint32Array.from(D),visibleTileHandles:E,sortedAtlasIndices:this._sortedAtlasIndicesBuffer,numGaussians:f,directionX:o,directionY:c,directionZ:u,preciseSort:this._useDeterministicSort}),k=await this._workerHandle?.sort(O,e);if(e.aborted)return;k&&(this._sortedAtlasIndicesBuffer=k.sortedAtlasIndices,this._sortWorkerMemory=k.usedMemory,this._workerResidentTiles=w),await this._frameTask.schedule(async e=>{this._textures.setOrder(this._sortedAtlasIndicesBuffer,f);let t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=m,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=r,this.visibleGaussians=f,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()},e)}catch(e){if(r(e))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{m as GaussianSplatSortCoordinator};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{estimateNumberArrayMemory as e}from"../../../../core/memoryEstimations.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as n,diameter as r}from"../../../../geometry/support/aaBoundingBox.js";class i{constructor({handle:i,obb:a,pageIds:o,relativePositions:s,packedRotations:c,packedOpacityScaledScales:l,gaussianCount:u,maxSplatMbsRadiusSquared:d,maxGaussianOpacity:f,elevationRange:p}){this.bvhIntersectionGeneration=0,this.lifecycleState=0,this.cullingRevision=-1,this.cullingVisible=!1,this.fadeDirection=0,this.opacityModifier=0,this.handle=i,this.obb=a,this.pageIds=o,this.relativePositions=s,this.packedRotations=c,this.packedOpacityScaledScales=l,this.gaussianCount=u,this.maxSplatMbsRadiusSquared=d,this.maxGaussianOpacity=f,this.elevationRange=p,this.usedMemory=e(this.pageIds,this.relativePositions,this.packedRotations,this.packedOpacityScaledScales);let m=t();a.getCenter(m),this.obbCenterX=m[0],this.obbCenterY=m[1],this.obbCenterZ=m[2];let h=a.radius??-1;this._mbsRadius=h;let g=h<0?-1:h*h;this._mbsRadiusSquared=g,this._obbShortestHalfsize=Math.min(a.halfSizeX,a.halfSizeY,a.halfSizeZ);let _=n();a.toAaBoundingBox(_),this.boundingBox=_;let v=h>=0?h:r(_)*.5;this.paddedMbsRadius=v+Math.sqrt(Math.max(0,d))}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;let{obbCenterX:n,obbCenterY:r,obbCenterZ:i}=this,a=n-e[0],o=r-e[1],s=i-e[2],c=a*t[0]+o*t[1]+s*t[2],l=a*a+o*o+s*s-c*c;return(this._mbsRadiusSquared<0||l<=this._mbsRadiusSquared)&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){let t=this._mbsRadius;if(t<0)return!0;let n=e.center,r=e.radius,i=t+r,a=this.obbCenterX-n[0];if(a>i)return!1;let o=this.obbCenterY-n[1];if(o>i)return!1;let s=this.obbCenterZ-n[2];if(s>i)return!1;let c=a*a+o*o+s*s;return c>i*i?!1:c<=(this._obbShortestHalfsize+r)**2||Math.sqrt(c)+t<=r?!0:this.obb?.intersectSphere(e)??!0}}export{i as GaussianTile};
2
+ import{estimateNumberArrayMemory as e}from"../../../../core/memoryEstimations.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as n,diameter as r}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsRay as i,intersectsSphere as a}from"../../layers/support/tileBoundingVolumeUtils.js";class o{constructor({handle:i,obb:a,pageIds:o,relativePositions:s,packedRotations:c,packedOpacityScaledScales:l,gaussianCount:u,maxSplatMbsRadiusSquared:d,maxGaussianOpacity:f,elevationRange:p}){this.bvhIntersectionGeneration=0,this.lifecycleState=0,this.cullingRevision=-1,this.cullingVisible=!1,this.fadeDirection=0,this.opacityModifier=0,this.handle=i,this.obb=a,this.pageIds=o,this.relativePositions=s,this.packedRotations=c,this.packedOpacityScaledScales=l,this.gaussianCount=u,this.maxSplatMbsRadiusSquared=d,this.maxGaussianOpacity=f,this.elevationRange=p,this.usedMemory=e(this.pageIds,this.relativePositions,this.packedRotations,this.packedOpacityScaledScales);let m=t();a.getCenter(m),this.obbCenterX=m[0],this.obbCenterY=m[1],this.obbCenterZ=m[2];let h=a.radius??-1;this._mbsRadius=h;let g=h<0?-1:h*h;this._mbsRadiusSquared=g,this._obbShortestHalfsize=Math.min(a.halfSizeX,a.halfSizeY,a.halfSizeZ);let _=n();a.toAaBoundingBox(_),this.boundingBox=_;let v=h>=0?h:r(_)*.5;this.paddedMbsRadius=v+Math.sqrt(Math.max(0,d))}boundingVolumeIntersectsRay(e,t){return i(this.obb,this.obbCenterX,this.obbCenterY,this.obbCenterZ,this._mbsRadiusSquared,e,t)}boundingVolumeIntersectsSphere(e){return a(this.obb,this.obbCenterX,this.obbCenterY,this.obbCenterZ,this._mbsRadius,this._obbShortestHalfsize,e)}}export{o as GaussianTile};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{clamp as e,isPowerOfTwo as t}from"../../../core/mathUtils.js";import{maxUint16 as n}from"../../../core/typedArrayUtil.js";import{empty as r}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as i}from"../../../geometry/support/aaBoundingRect.js";import{sampleElevation as a,sampleSingleElevation as o}from"./ElevationData.js";import{PatchGeometryLUT as s}from"./PatchGeometryLUT.js";import{zeroToFour as c,neighborTileIfLoadedOrSelf as l}from"./PatchRenderData.js";import{maxPatchTesselation as u,elevationNoDataValue as d}from"./TerrainConst.js";import{internalAssert as f,enableTerrainInternalChecks as p,neighborEdgeIndices as m,almostEquals as h}from"./terrainUtils.js";import{isCornerNeighbor as g}from"./Tile.js";import{compareTilesByLij as _}from"./tileUtils.js";import{compressNormal as v}from"../webgl-engine/lib/Normals.js";function y(e,t){let{tile:n,geometry:i,geometryState:a}=e,{extentInRadians:o,surface:s}=n,{isWebMercator:c,renderer:l}=s,{numVerticesPerSide:u,wireframe:d}=a,f=u-1,p=(u-2)**2,m=c&&(t===2||t===3),h=c&&(t===1||t===3),g=(+!!m+ +!!h)*Ee*u,_=xe(a),v=4*_,y=p+g+v,S=l.tileGeometryCache.acquire(y);i.numVerticesPerSide=u,i.vertexAttributes=S,i.maxEdgeVertexCount=_;let{boundingBox:C}=i;r(C);let w=P(e);$.update(f,o,w),x(e),i.poleVerticesStartIndex=p;let T=b(e,m,h);i.edgeVerticesStartIndex=p+g,J(e),O(e,we,Te),U(i,T,d),e.intersectionData=null}function b(e,t,r){let{tile:i,localOrigin:a,geometry:o}=e,{extent:s,ellipsoid:c}=i,{boundingBox:l,numVerticesPerSide:u,vertexAttributes:d,poleVerticesStartIndex:f}=o,p=u-1,m=a[0],h=a[1],g=a[2],_=c.radius,y=s[1],b=s[3],x=[],S=f,C=(e,t)=>{let r=t*u;be(-m,-h,-g+e*_,l),x.push(new oe(e===1,r,e===1?0:2,S,Ee));let i=j(e===-1?y:b,_),a=e*Math.PI/2-i,o=(e===1?1:-1)*.99,s=_+0,{position:c,uv0:f}=d,{typedBuffer:C,typedBufferStride:w}=d.normalCompressed;for(let e=1;e<=Ee;++e){let t=i+e/Ee*a,r=Math.cos(t),u=Math.sin(t);for(let e=0;e<=p;e++){let t=e/p,i=$.sinLonLUT[e],a=$.cosLonLUT[e]*r,d=i*r,_=u,y=a*s-m,b=d*s-h,x=_*s-g;be(y,b,x,l),c.setValues(S,y,b,x),f.setValues(S,Math.round(t*n),Math.round(o*n)),v(C,S,a,d,_,w),++S}}};return t&&C(-1,0),r&&C(1,p),x}function x(e){let t=e.geometryState.samplerData,n=t?.length===1?t[0]:null;n?S(e,n):C(e)}function S(e,t){let{tile:n}=e;if(!n.intersectsClippingArea)return;let{geometry:r,geometryState:i,localOrigin:a}=e,{numVerticesPerSide:o}=i,s=o-2,c=o-1,{vertexAttributes:l,boundingBox:u}=r,{position:d,uv0:f}=l,{typedBuffer:p,typedBufferStride:m}=l.normalCompressed,{extent:h}=n,g=n.ellipsoid.radius,_=a[0],y=a[1],b=a[2],x=d.typedBuffer,S=d.typedBufferStride,C=f.typedBuffer,E=f.typedBufferStride;w(c,h,t);let D=0,O=t.data.values;if(1<=s){let e=le[1],t=$.sinLatLUT[1],n=$.cosLatLUT[1];for(let r=1;r<=s;r++){let i=$.sinLonLUT[r],a=$.cosLonLUT[r],o=g+T(r,1,O),s=-_+o*a*n,c=-y+o*i*n,l=-b+o*t;be(s,c,l,u);let d=(r-1)*S;x[d]=s,x[d+1]=c,x[d+2]=l;let f=(r-1)*E;C[f]=le[r],C[f+1]=e}}for(let e=1;e<=s;e++){let t=$.sinLatLUT[e],n=$.cosLatLUT[e],r=e+1,i=le[r],a=$.sinLatLUT[r],o=$.cosLatLUT[r],l=$.sinLonLUT[0],d=$.cosLonLUT[0],f=g+T(0,e,O),h=d*n*f-_,w=l*n*f-y,k=t*f-b,A=D*S,j=x[A],M=x[A+1],N=x[A+2];for(let l=1;l<=s;l++){let d=$.sinLonLUT[l],f=$.cosLonLUT[l],A=0,P=0,F=0;if(l<s){let e=(D+1)*S;A=x[e],P=x[e+1],F=x[e+2]}else{let r=$.sinLonLUT[c],i=$.cosLonLUT[c],a=g+T(c,e,O);A=i*n*a-_,P=r*n*a-y,F=t*a-b}let I=h,L=w,R=k;h=j,w=M,k=N,j=A,M=P,N=F;let z=A-I,B=P-L,ee=F-R,V=0,H=0,te=0;if(e>1){let e=(D-s)*S;V=x[e],H=x[e+1],te=x[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=g+T(l,0,O);V=f*t*n-_,H=d*t*n-y,te=e*n-b}let U=g+T(l,r,O),W=f*o*U-_,G=d*o*U-y,K=a*U-b;if(e<s){let e=D+s,t=e*S;x[t]=W,x[t+1]=G,x[t+2]=K,be(W,G,K,u);let n=e*E;C[n]=le[l],C[n+1]=i}let q=V-W,ne=H-G,re=te-K,J=f*n,Y=d*n,X=t;X*X<.999&&(J=ee*ne-B*re,Y=z*re-ee*q,X=B*q-z*ne);let Z=1/Math.sqrt(J*J+Y*Y+X*X);v(p,D,J*Z,Y*Z,X*Z,m),++D}}}function C(e){let{tile:t}=e;if(!t.intersectsClippingArea)return;let{geometry:r,geometryState:i,localOrigin:o}=e,{numVerticesPerSide:s,samplerData:c}=i,l=s-2,u=s-1,{vertexAttributes:d,boundingBox:f}=r,{position:p,uv0:m}=d,{typedBuffer:h,typedBufferStride:g}=d.normalCompressed,{extent:_}=t,y=_[0],b=_[2],x=_[1],S=_[3],C=t.ellipsoid.radius,w=o[0],T=o[1],E=o[2],D=p.typedBuffer,O=p.typedBufferStride,k=1/u,A=0;if(1<=l){let e=k,t=x*(1-e)+S*e,r=$.sinLatLUT[1],i=$.cosLatLUT[1];for(let o=1;o<=l;o++){let s=o*k,l=y*(1-s)+b*s,u=$.sinLonLUT[o],d=$.cosLonLUT[o],p=C+a(l,t,c),h=-w+p*d*i,g=-T+p*u*i,_=-E+p*r;be(h,g,_,f);let v=(o-1)*O;D[v]=h,D[v+1]=g,D[v+2]=_,m.setValues(o-1,Math.round(s*n),Math.round(e*n))}}for(let e=1;e<=l;e++){let t=e*k,r=x*(1-t)+S*t,i=$.sinLatLUT[e],o=$.cosLatLUT[e],s=e+1,d=s*k,p=x*(1-d)+S*d,_=$.sinLatLUT[s],j=$.cosLatLUT[s],M=$.sinLonLUT[0],N=$.cosLonLUT[0],P=C+a(y,r,c),F=N*o*P-w,I=M*o*P-T,L=i*P-E,R=A*O,z=D[R],B=D[R+1],ee=D[R+2];for(let t=1;t<=l;t++){let s=t*k,S=y*(1-s)+b*s,M=$.sinLonLUT[t],N=$.cosLonLUT[t],P=0,R=0,V=0;if(t<l){let e=(A+1)*O;P=D[e],R=D[e+1],V=D[e+2]}else{let e=$.sinLonLUT[u],t=$.cosLonLUT[u],n=C+a(b,r,c);P=t*o*n-w,R=e*o*n-T,V=i*n-E}let H=F,te=I,U=L;F=z,I=B,L=ee,z=P,B=R,ee=V;let W=P-H,G=R-te,K=V-U,q=0,ne=0,re=0;if(e>1){let e=(A-l)*O;q=D[e],ne=D[e+1],re=D[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=C+a(S,x,c);q=N*t*n-w,ne=M*t*n-T,re=e*n-E}let J=C+a(S,p,c),Y=N*j*J-w,X=M*j*J-T,Z=_*J-E;if(e<l){let e=A+l,t=e*O;D[t]=Y,D[t+1]=X,D[t+2]=Z,be(Y,X,Z,f),m.setValues(e,Math.round(s*n),Math.round(d*n))}let ie=q-Y,Q=ne-X,ae=re-Z,oe=N*o,se=M*o,ce=i;ce*ce<.999&&(oe=K*Q-G*ae,se=W*ae-K*ie,ce=G*ie-W*Q);let le=1/Math.sqrt(oe*oe+se*se+ce*ce);v(h,A,oe*le,se*le,ce*le,g),++A}}}function w(t,r,i){let a=r[0],o=r[2],s=r[1],c=r[3],l=1/t,{dx:u,dy:d,x0:f,y1:p,safeWidth:m}=i,h=i.data.width;for(let r=0;r<=t;r++){let t=r*l,i=e(u*(a*(1-t)+o*t-f),0,m),g=Math.floor(i);ue[r]=g,pe[r]=i-g;let _=e(d*(p-(s*(1-t)+c*t)),0,m),v=Math.floor(_);de[r]=v*h,fe[r]=(v+1)*h,me[r]=_-v,le[r]=Math.round(t*n)}}function T(e,t,n){let r=ue[e],i=pe[e],a=de[t],o=fe[t],s=me[t],c=a+r,l=n[c],u=n[c+1],d=n[o+r],f=n[o+r+1];if(l+d+u+f>=ce)return 0;let p=l+(u-l)*i;return p+(d+(f-d)*i-p)*s}function E(e,t=!1){e.tile.intersectsClippingArea&&(O(e,t?we:e.dirtyEdges,t?Te:e.dirtyCorners),Q(e),e.intersectionData=null)}function D(e){e.tile.intersectsClippingArea&&(Y(e),O(e,we,Te),Q(e),ae(e),e.intersectionData=null)}function O(e,t,n){e.tile.intersectsClippingArea&&(n&&A(e,n),t&&k(e,t))}function k(e,r){let{geometry:i,geometryState:s,tile:c,localOrigin:u}=e,{level:d,extent:g,extentInRadians:y,ellipsoid:b}=c,x=b.radius,S=y[0],C=y[2],w=y[1],T=y[3],{samplerData:E}=s,D=g[0],O=g[2],k=g[1],A=g[3],j=P(e),{boundingBox:M,vertexAttributes:N}=i,F=u[0],I=u[1],L=u[2],{position:R,uv0:z}=N,B=R.typedBuffer,ee=R.typedBufferStride,V=z.typedBuffer,H=z.typedBufferStride,{typedBuffer:te,typedBufferStride:U}=N.normalCompressed,W=E?.length===1?E[0]:null,G=(e,t,n)=>W?o(e,t,W)??0:a(e,t,E)??0;for(let u=0;u<4;++u){if(!(r&1<<u))continue;let y=u===1||u===3,b=s.edgeResolutions[u];f(t(b));let N=b+1,P=l(c,s.edgePeerNeighbors[u]);if(_e(c,P,u)&&X(e,u,P))continue;let R=P!=null;f(!R||P.level===c.level),f(!R||_(c,P)<=0);let z=P?.renderData?.geometryState;if(p){let e=c.surface;if(!P&&e&&!e.updatingRootTiles){let t=m[u],n=c.findNeighborTile(t,e=>e.loaded||e.leaf||e.level===c.level);n?n.intersectsClippingArea&&(f(!n.loaded),f(!n.leaf),f(n.level===d)):f(e?.rootTiles==null||!c.shouldHaveNeighbor(t))}}let K=u===1?g[2]:g[0],q=P?.extent,ne=q&&y?u===1?q[0]:q[2]:K,re=u===0?g[3]:g[1],J=+(u===1),Y=+(u===0),Z=u===1?C:S,ie=u===0?T:w,Q=Math.sin(Z),ae=Math.cos(Z),oe=Math.sin(ie),se=Math.cos(ie),$=z?.samplerData,ce=$?.length===1?$[0]:null,le=(e,t,n)=>ce?o(n,t,ce)??0:a(n,t,$)??0,ue=R?(e,t,n)=>(G(e,t)+le(e,t,n))*.5:G,de=i.outerEdgesOffsetAndLength[u*2+0],fe=W!=null||E!=null&&E.some(e=>e!=null),pe=ce!=null||$!=null&&$.some(e=>e!=null),me=fe||pe,he=1/b,ge=n*he,ve=J*n,ye=Y*n,xe=de;f(!q||h(q[2]-q[0],g[2]-g[0])),(()=>{let e=u===1?-1:+(u===3),t=u===0?-1:+(u===2),n=(g[2]-g[0])*he,r=e*n,i=t*n,s=C-S,c=y?s*he*e:0,l=y?0:t*he,d=Y,f=y?Z+c:Z,p=y?Math.sin(f):Q,m=y?Math.cos(f):ae,h=y?Z-c:Z,_=y?Math.sin(h):Q,b=y?Math.cos(h):ae,w=d+l,T=y?ie:j(w),P=y?oe:Math.sin(T),z=y?se:Math.cos(T),G=d-l,q=y?ie:j(G),J=y?oe:Math.sin(q),X=y?se:Math.cos(q),le=0,de=0,fe=0;{let e=0*he,t=y?K:D*(1-e)+O*e,n=y?ne:t,r=y?k*(1-e)+A*e:re,i=y?Z:S*(1-e)+C*e,a=y?Q:Math.sin(i),o=y?ae:Math.cos(i),s=y?j(e):ie,c=y?Math.sin(s):oe,l=y?Math.cos(s):se,u=x+ue(t,r,n);le=o*l*u,de=a*l*u,fe=c*u}let pe=0,_e=0,Se=0;{let e=1*he,t=y?K:D*(1-e)+O*e,n=y?ne:t,r=y?k*(1-e)+A*e:re,i=y?Z:S*(1-e)+C*e,a=y?Q:Math.sin(i),o=y?ae:Math.cos(i),s=y?j(e):ie,c=y?Math.sin(s):oe,l=y?Math.cos(s):se,u=x+ue(t,r,n);pe=o*l*u,_e=a*l*u,Se=c*u}for(let e=1;e<N-1;++e){let t=0,n=0,s=0;{let r=(e+1)*he,i=y?K:D*(1-r)+O*r,a=y?ne:i,o=y?k*(1-r)+A*r:re,c=y?Z:S*(1-r)+C*r,l=y?Q:Math.sin(c),u=y?ae:Math.cos(c),d=y?j(r):ie,f=y?Math.sin(d):oe,p=y?Math.cos(d):se,m=x+ue(i,o,a);t=u*p*m,n=l*p*m,s=f*m}let c=t,l=n,d=s,f=pe,h=_e,g=Se;pe=c,_e=l,Se=d;{let t=xe+e,n=t*ee,r=f-F,i=h-I,a=g-L;B[n]=r,B[n+1]=i,B[n+2]=a,be(r,i,a,M);let o=Math.round(e*ge),s=t*H;V[s]=y?ve:o,V[s+1]=y?o:ye}let w=le,T=de,N=fe;le=f,de=h,fe=g;let G=f,q=h,Y=g,Ce=1/Math.sqrt(G*G+q*q+Y*Y),we=Y*Ce,Te=0,Ee=0,De=0;if(me&&we*we<.999){let t=0,n=0,s=0;{let e=u===0?-1:1;t=e*(c-w),n=e*(l-T),s=e*(d-N)}{let c=e*he,l=y?K:D*(1-c)+O*c,d=y?ne:l,f=y?k*(1-c)+A*c:re,h=y?Z:S*(1-c)+C*c,g=y?Q:Math.sin(h),v=y?ae:Math.cos(h),w=y?j(c):ie,T=y?Math.sin(w):oe,M=y?Math.cos(w):se,N=G,F=q,I=Y;if(R){let e=d-r,t=f-i,n=x+(ce?o(e,t,ce)??0:a(e,t,$)??0),s=y?_:g,c=y?b:v,l=y?T:J,u=y?M:X;N=c*u*n,F=s*u*n,I=l*n}{let e=l+r,c=f+i,d=x+(W?o(e,c,W)??0:a(e,c,E)??0),h=y?p:g,_=y?m:v,b=y?T:P,S=y?M:z,C=_*S*d,w=h*S*d,D=b*d;R||(N=2*G-C,F=2*q-w,I=2*Y-D);let O=u===3?-1:1,k=O*(N-C),A=O*(F-w),j=O*(I-D);Te=s*A-n*j,Ee=t*j-s*k,De=n*k-t*A;let L=1/Math.sqrt(Te*Te+Ee*Ee+De*De);Te*=L,Ee*=L,De*=L}}}else Te=G*Ce,Ee=q*Ce,De=Y*Ce;v(te,xe+e,Te,Ee,De,U)}})()}}function A(e,t){Z(e,t)}function j(e,t){return Math.PI/2-2*Math.atan(Math.exp(-e/t))}function M(e,t,n,r){return j(e*(1-r)+t*r,n)}function N(e,t,n){return e*(1-n)+t*n}function P(e){let{tile:t}=e;if(t.surface.isWebMercator){let e=t.extent,n=t.ellipsoid.radius;return t=>M(e[1],e[3],n,t)}let n=t.extentInRadians;return e=>N(n[1],n[3],e)}function F(e){let{tile:t,geometryState:n,geometry:i}=e,{extent:a,surface:o}=t,{wireframe:s}=n,c=a[0],l=a[1],u=a[2],d=a[3],f=u-c,p=d-l,{numVerticesPerSide:m,clippingArea:h}=n,g=h==null?0:Math.max(0,(h[0]-c)/f),_=h==null?0:Math.max(0,(h[1]-l)/p),v=h==null?1:Math.min(1,(h[2]-c)/f),y=h==null?1:Math.min(1,(h[3]-l)/p),b=(m-2)**2,x=xe(n),S=b+4*x,C=o.renderer.tileGeometryCache.acquire(S),{boundingBox:w}=i;r(w),i.numVerticesPerSide=m,i.vertexAttributes=C,i.maxEdgeVertexCount=x,i.minu=g,i.minv=_,i.maxu=v,i.maxv=y,I(e),i.edgeVerticesStartIndex=b,J(e),z(e,we,Te),U(i,[],s),e.intersectionData=null}function I(t){let r=t.tile;if(!r.intersectsClippingArea)return;let{geometry:i,geometryState:s,localOrigin:c}=t,{samplerData:l,clippingArea:u,numVerticesPerSide:d}=s,{surface:f,extent:p,ellipsoid:m}=r,{isWebMercatorOnPlateCarree:h}=f,g=u??he,_=p[0],y=p[1],b=p[2],x=p[3],S=Math.max(_,g[0]),C=Math.min(b,g[2]),w=Math.max(y,g[1]),T=Math.min(x,g[3]),E=m.radius,D=r.horizontalScale,O=d-1,k=d-2,{minu:A,minv:j,maxu:M,maxv:N,boundingBox:P,vertexAttributes:F}=i,{position:I,uv0:L}=F,{typedBuffer:R,typedBufferStride:z}=F.normalCompressed,B=c[0],ee=c[1],V=c[2],H=I.typedBuffer,te=I.typedBufferStride,U=0,W=e(y,w,T),G=h?(Math.PI/2-2*Math.atan(Math.exp(-W/E)))*E:W*D,K=1/O,q=e(y*(1-K)+x*K,w,T),ne=h?(Math.PI/2-2*Math.atan(Math.exp(-q/E)))*E:q*D,re=G,J=ne,Y=l?.length===1?l[0]:null,X=Y?(e,t)=>o(e,t,Y)??0:(e,t)=>a(e,t,l)??0;for(let t=1;t<=k;t++){let r=t/O,i=e(y*(1-r)+x*r,w,T),a=e(r,j,N),o=J,s=(t-1)/O,c=e(y*(1-s)+x*s,w,T),l=re,u=(t+1)/O,d=e(y*(1-u)+x*u,w,T),f=h?(Math.PI/2-2*Math.atan(Math.exp(-d/E)))*E:d*D,p=e(u,j,N);re=J,J=f;let m=e(_,S,C),g=m*D,F=X(m,i),I=1/O,W=e(I,A,M),G=e(_*(1-W)+b*W,S,C),K=W,q=G,ne=G*D,Y=X(G,i);if(t===1){let t=ne-B,r=re-ee,i=Y-V,o=0*te;H[o]=t,H[o+1]=r,H[o+2]=i,be(t,r,i,P);let s=e(I,A,M);L.setValues(U,Math.round(s*n),Math.round(a*n))}for(let r=1;r<=k;r++){let s=ne,u=Y,m=(r+1)/O,h=e(m,A,M),y=e(_*(1-m)+b*m,S,C),x=q;q=y;{let e=U+1,s=e*te;if(t===1||r===k){let c=X(y,i),l=y*D,u=o,d=c;if(t===1&&r<k){let t=l-B,r=u-ee,i=d-V;H[s]=t,H[s+1]=r,H[s+2]=i,be(t,r,i,P),L.setValues(e,Math.round(h*n),Math.round(a*n))}ne=l,Y=d}else ne=H[s]+B,Y=H[s+2]+V}let w=ne,T=Y,E=g,j=F;g=s,F=u;let N=(U-k)*te,I=t===1?X(x,c):H[N+2]+V,W=X(x,d);if(t<k){let e=U+k,t=e*te,r=s-B,i=f-ee,a=W-V;H[t]=r,H[t+1]=i,H[t+2]=a,be(r,i,a,P);let o=K;K=h,L.setValues(e,Math.round(o*n),Math.round(p*n))}{let e=w-E,t=T-j,n=l-f,r=I-W,i=n*t,a=e*r,o=-n*e,s=i*i+a*a+o*o;if(s===0)v(R,U,0,0,1,z);else{let e=1/Math.sqrt(s);v(R,U,i*e,a*e,o*e,z)}}++U}}}function L(e){e.tile.intersectsClippingArea&&(Y(e),z(e,we,Te),Q(e),ae(e),e.intersectionData=null)}function R(e,t=!1){e.tile.intersectsClippingArea&&(z(e,t?we:e.dirtyEdges,t?Te:e.dirtyCorners),Q(e),e.intersectionData=null)}function z(e,t,n){e.tile.intersectsClippingArea&&(n&&ee(e,n),t&&B(e,t))}function B(n,r){let{geometry:i,geometryState:s,localOrigin:c}=n,u=n.tile,{surface:d,extent:h}=u,{clippingArea:g,samplerData:v}=s,y=g??he,b=h[0],x=h[2],S=h[1],C=h[3],w=[C>y[3],x>y[2],S<y[1],b<y[0]],T=u.horizontalScale,E=te(d.isWebMercatorOnPlateCarree,u.ellipsoid.radius,T),{minu:D,minv:O,maxu:k,maxv:A,boundingBox:j}=i,M=Math.max(b,y[0]),N=Math.min(x,y[2]),P=Math.max(S,y[1]),F=Math.min(C,y[3]),I=c[0],L=c[1],R=c[2],z=v?.length===1?v[0]:void 0,B=z?(e,t)=>o(e,t,z)??0:(e,t)=>a(e,t,v)??0;for(let c=0;c<4;++c){if(!(r&1<<c))continue;let h=c===1||c===3,g=s.edgeResolutions[c];f(t(g));let y=g+1,z=w[c],ee=l(u,s.edgePeerNeighbors[c]);if(!z&&_e(u,ee,c)&&X(n,c,ee))continue;let V=ee!=null&&!z,H=ee?.renderData?.geometryState;if(p&&(f(!V||ee.level===u.level),f(!V||_(u,ee)<=0),u&&!ee&&!d.updatingRootTiles)){let e=m[c],t=u.findNeighborTile(e,e=>e.loaded||e.leaf||e.level===u.level);d.updatingRootTiles||(t?t.intersectsClippingArea&&(f(!t.loaded),f(!t.leaf),f(t.level===u.level)):f(d?.rootTiles==null||!u.shouldHaveNeighbor(e)))}let te=e(c===1?x:b,M,N),U=e(c===0?C:S,P,F),W=H?.samplerData,G=e(+(c===1),D,k),K=e(+(c===0),O,A),q=W?.length===1?W[0]:null,ne=(e,t)=>q?o(e,t,q)??0:a(e,t,W)??0,re=V?(e,t)=>(ne(e,t)+B(e,t))*.5:B,J=(x-b)/g,Y=h?c===1?J:-J:0,Z=h?0:c===0?J:-J,ie=-Y,Q=-Z,ae=0,oe=0,se=0;{let t=0/g,n=h?te:e(b*(1-t)+x*t,M,N),r=h?e(S*(1-t)+C*t,P,F):U,i=re(n,r);ae=n*T,oe=E(r),se=i}let $=0,ce=0,le=0;{let t=1/g,n=h?te:e(b*(1-t)+x*t,M,N),r=h?e(S*(1-t)+C*t,P,F):U,i=re(n,r),a=n*T,o=E(r),s=i;$=a,ce=o,le=s}for(let t=1;t<y-1;++t){let n=t/g,r=$,o=ce,s=le;{let a=h?G:e(n,D,k),l=h?e(n,O,A):K,u=r-I,d=o-L,f=s-R;be(r,d,f,j),i.setEdgeVertexFromValuesRawPositionUV(c,t,u,d,f,a,l)}{let n=(t+1)/g,r=h?te:e(b*(1-n)+x*n,M,N),i=h?e(S*(1-n)+C*n,P,F):U,a=re(r,i);$=r*T,ce=E(i),le=a}let l=$,u=ce,d=le,f=ae,p=oe,m=se;ae=r,oe=o,se=s;let _=0,y=0,w=0;if(h){let t=u-o,i=d-s,l=p-o,f=m-s,h=e(S*(1-n)+C*n,P,F),g=te+ie,b=h,x=g*T,E=a(g,b,v),D=x-r,O=E-s,k=c===3?-1:1;if(_=k*(-l+t)*O,y=k*D*(-f+i),w=-k*D*(-l+t),V){let e=te+Y,n=h,o=e*T,c=a(e,n,W),u=o-r,d=c-s;_=(-l+t)*(O-d),y=(D-u)*(-f+i),w=-(D-u)*(-l+t)}}else{let t=l-r,i=d-s,u=f-r,p=m-s,h=e(b*(1-n)+x*n,M,N),g=h,S=U+Q,C=a(g,S,v)-s,T=E(S)-o,D=c===2?-1:1;if(_=D*T*(-p+i),y=D*(-u+t)*C,w=-D*T*(-u+t),V){let e=h,n=U+Z,r=E(n),c=a(e,n,W)-s,l=r-o;_=(-T+l)*(-p+i),y=(-u+t)*(-C+c),w=-(-T+l)*(-u+t)}}let z=1/Math.sqrt(_*_+y*y+w*w);i.setEdgeNormalFromValues(c,t,_*z,y*z,w*z)}}}function ee(e,t){Z(e,t)}function V(e,t){return(Math.PI/2-2*Math.atan(Math.exp(-e/t)))*t}function H(e,t){return e*t}function te(e,t,n){return e?e=>V(e,t):e=>H(e,n)}function U(e,t,n){let{numVerticesPerSide:r,vertexAttributes:i,maxEdgeVertexCount:a}=e,o=r-1,s=i.count,l=r-3,u=r-3,d=2*l*u,f=4*(o+a-3),p=c.reduce((t,n)=>t+(o+e.getEdgeCount(n)-3),0),m=t.reduce((e,t)=>e+o*((t.latitudeResolution-1)*2+1),0),h=3*(n?2:1),g=(d+f+m)*h;e.indices=s>=65536?new Uint32Array(g):new Uint16Array(g),e.indexCount=(d+p+m)*h,e.poleIndicesStartIndex=d*h,e.edgeIndicesStartIndex=(d+m)*h,n?(q(e),ne(e,t),re(e)):(W(e),G(e,t),K(e))}function W(e){let{numVerticesPerSide:t,indices:n,vertexAttributes:r}=e,{position:i}=r,{typedBuffer:a,typedBufferStride:o}=i,s=t-2,c=t-3,l=t-3,u=0;for(let e=0;e<c;++e){let t=e*s;for(let e=0;e<l;++e){let r=t+e,i=r+1,c=i+s,l=c-1;Se(r,i,c,l,o,a)?(n[u]=r,n[u+1]=i,n[u+2]=c,n[u+3]=c,n[u+4]=l,n[u+5]=r):(n[u]=r,n[u+1]=i,n[u+2]=l,n[u+3]=l,n[u+4]=i,n[u+5]=c),u+=6}}}function G(e,t){let{numVerticesPerSide:n,indices:r,poleIndicesStartIndex:i}=e,a=n-1,o=i;for(let i of t){let t=i.isNorth?1:2,s=i.isNorth?2:1,c=i.isNorth?3:4,l=i.isNorth?4:3,u=e.getEdgeVertexIndex(i.connectedOuterEdgeOffset,0),d=1;for(let e=0;e<i.latitudeResolution;++e){let f=e===0?i.rowOffset:u+n;for(let n=0;n<a;n++){let a=f+n;r[o]=u,r[o+t]=u+1,r[o+s]=a,e<i.latitudeResolution-1?(r[o+c]=u+1,r[o+l]=a+1,r[o+5]=a,o+=6):o+=3,u+=d}u=f,d=1}}}function K(e){let{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:r}=e,i=n-1,a=i-2,o=r;for(let n=0;n<4;++n){let r=ye[n],s=0,c=0,l=e.getEdgeCount(n),u=r.count;f(u===i-1);let d=n===1||n===2,p=d?1:2,m=d?2:1,h=e.getEdgeFirstVertexIndex(n),g=r.vertex0Index,_=r.stride;for(;s<l-1||c<u-1;){let e=g+c*_,n=h+s*1,r=s<l-1,d=c<u-1,f=r?0+i*(s+.5)/(l-1):0,v=d?1+a*(c+.5)/(u-1):0,y=r&&(!d||f<=v);y?++s:++c;let b=y?n+1:e+_;t[o]=e,t[o+p]=n,t[o+m]=b,o+=3}}e.indexCount=o}function q(e){let{indices:t,numVerticesPerSide:n,vertexAttributes:r}=e,{position:i}=r,{typedBuffer:a,typedBufferStride:o}=i,s=n-2,c=0;for(let e=0;e<n-3;++e){let r=e*s;for(let i=0;i<n-3;++i){let n=e*s+i,l=n+1,u=l+s,d=u-1,f=r+i,p=f+1,m=p+s;Se(f,p,m,m-1,o,a)?(Ce(t,c,n,l,u),c+=6,Ce(t,c,u,d,n)):(Ce(t,c,n,l,d),c+=6,Ce(t,c,d,u,l)),c+=6}}}function ne(e,t){let{indices:n,numVerticesPerSide:r,poleIndicesStartIndex:i}=e,a=r-1,o=i;for(let i of t){let t=i.connectedOuterEdgeOffset,s=e.getEdgeVertexIndex(t,0),c=1;for(let e=0;e<i.latitudeResolution;++e){let t=e===0?i.rowOffset:s+r;for(let r=0;r<a;r++)Ce(n,o,s,s+1,t+r),o+=6,e<i.latitudeResolution-1&&(Ce(n,o,s+1,t+r+1,t+r),o+=6),s+=c;s=t,c=1}}}function re(e){let{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:r}=e,i=n-1,a=i-2,o=r;for(let n=0;n<4;++n){let r=ye[n],s=0,c=0,l=e.getEdgeCount(n),u=r.count;f(u===i-1);let d=n===1||n===2,p=d?1:3,m=d?3:1,h=e.getEdgeFirstVertexIndex(n),g=r.vertex0Index,_=r.stride;for(;s<l-1||c<u-1;){let e=g+c*_,n=h+s*1,r=s<l-1,d=c<u-1,f=r?0+i*(s+.5)/(l-1):0,v=d?1+a*(c+.5)/(u-1):0,y=r&&(!d||f<=v);y?++s:++c;let b=y?n+1:e+_;t[o]=e,t[o+p]=n,t[o+p+1]=n,t[o+m]=b,t[o+m+1]=b,t[o+5]=e,o+=6}}e.indexCount=o}function J(e){let{geometry:t,geometryState:n}=e,{edgeResolutions:r}=n,{numVerticesPerSide:i,edgeVerticesStartIndex:a}=t,o=i-2,s=a;for(let e=0;e<4;++e){{let t=e===1?o-1:0,n=e===0?o-1:0,r=e===0||e===2,i=+!!r,a=+!r,s=n*o+t,c=a*o+i,l=ye[e];l.vertex0Index=s,l.stride=c,l.count=o}{let n=r[e]+1;t.outerEdgesOffsetAndLength[e*2+0]=s,t.outerEdgesOffsetAndLength[e*2+1]=n,s+=n}}}function Y(e){J(e),e.geometryState.wireframe?re(e.geometry):K(e.geometry)}function X(r,i,a){let{geometryState:o,geometry:s,tile:c,localOrigin:l}=r,u=i===1||i===3,d=o.edgeResolutions[i];f(t(d));let p=d+1,{boundingBox:m,minu:h,minv:g,maxu:_,maxv:v,vertexAttributes:y}=s,b=e(+(i===1),h,_),x=e(+(i===0),g,v),S=a.renderData,C=S.geometryState;if(!C||!S.geometry.vertexAttributes)return!1;let w=S.geometry,T=(i+2)%4,E=w.getEdgeCount(T),D=c.getNeighborEdgeStartVertexIndex(i,a)*d,O=d*2**(c.level-a.level);f(C.edgeResolutions[T]===O),f(E-1===O);let k=S.localOrigin[0]-l[0],A=S.localOrigin[1]-l[1],j=S.localOrigin[2]-l[2],M=s.getEdgeFirstVertexIndex(i),{position:N,uv0:P}=y,F=N.typedBuffer,I=N.typedBufferStride,L=y.normalCompressed,R=L.typedBuffer,z=L.typedBufferStride,B=w.vertexAttributes,ee=w.getEdgeFirstVertexIndex(T),V=B.position.typedBuffer,H=B.position.typedBufferStride,te=B.normalCompressed.typedBuffer,U=B.normalCompressed.typedBufferStride;for(let t=1;t<p-1;++t){let r=D+t,i=M+t,a=ee+r,o=i*I,s=a*H,c=V[s]+k,l=V[s+1]+A,f=V[s+2]+j;F[o]=c,F[o+1]=l,F[o+2]=f,be(c,l,f,m);let p=i*z,y=a*U;R[p]=te[y],R[p+1]=te[y+1];let S=t/d,C=u?b:e(S,h,_),w=u?e(S,g,v):x;P.setValues(i,Math.round(C*n),Math.round(w*n))}return!0}function Z(t,r){let{geometry:i,geometryState:o,localOrigin:s}=t,{clippingArea:c,samplerData:l}=o,{minu:u,minv:d,maxu:p,maxv:m,boundingBox:h,vertexAttributes:g}=i,v=t.tile,{surface:y,ellipsoid:b,extent:x,extentInRadians:S,horizontalScale:C}=v,w=y.view?.viewingMode===`local`,T=b.radius,E=0,D=0,O=0,k=w?(()=>{let t=c,n=t!=null&&(x[3]>t[3]||x[2]>t[2]||x[1]<t[1]||x[0]<t[0]),r=te(y.isWebMercatorOnPlateCarree,T,C);return(i,a,o)=>{let s=i===0?x[0]:x[2],c=a===0?x[1]:x[3],l=n?e(s,t[0],t[2]):s,u=n?e(c,t[1],t[3]):c,d=o;E=l*C,D=r(u),O=d}})():(e,t,n)=>{let r=S[t===0?1:3],i=S[e===0?0:2],a=Math.cos(r),o=Math.sin(r),s=Math.sin(i),c=Math.cos(i),l=T+n;E=c*a*l,D=s*a*l,O=o*l},A=0,j=0,M=0,N=0,F=0,I=0,L=0,R=0,z=0,B=w&&y.isWebMercatorOnPlateCarree,ee=(e,t,n,r,i)=>{let a=0,o=0,s=0;if(w){let e=t*C,i=B?(Math.PI/2-2*Math.atan(Math.exp(-n/T)))*T:n*C,c=r;a=e-E,o=i-D,s=c-O}else{let i=P(e),c=e.tile,l=c.extent,u=c.extentInRadians,d=(t-l[0])/(l[2]-l[0]),f=(n-l[1])/(l[3]-l[1]),p=u[0]*(1-d)+u[2]*d,m=i(f),h=Math.cos(m),g=Math.sin(m),_=Math.sin(p),v=Math.cos(p),y=T+r,b=v*h*y,x=_*h*y,S=g*y;a=b-E,o=x-D,s=S-O}switch(i){case 0:L+=a,R+=o,z+=s;break;case 1:N-=a,F-=o,I-=s;break;case 2:L-=a,R-=o,z-=s;break;case 3:N+=a,F+=o,I+=s}},V=c??he,H=x[0],U=x[2],W=x[1],G=x[3],K=[G>V[3],U>V[2],W<V[1],H<V[0]],q=Math.max(H,V[0]),ne=Math.min(U,V[2]),re=Math.max(W,V[1]),J=Math.min(G,V[3]),Y=e=>Math.max(V[0],Math.min(V[2],e)),X=e=>Math.max(V[1],Math.min(V[3],e)),Z=e=>{let t=o.cornerNeighborCornerTiles;A=0,j=0,M=1,N=0,F=0,I=0,L=0,R=0,z=0;let n=1/0;for(let r=0;r<4;++r){let i=t[e*4+r];n=Math.min(n,i?.level??1/0)}for(let r=0;r<4;++r){let i=t[e*4+r];ge[r]=i?.level===n?i:null}let r=1,i=0;for(let e=0;e<4;++e){let t=ge[e];t&&(r=Math.max(r,t?.renderData.geometryState.numVerticesPerSide),i=t.extent[2]-t.extent[0])}let s=i,c=r;f(c>1);let l=s/c;for(let e=0;e<4;++e){let t=ge[(e+3)%4],n=ge[e%4];if(!t&&!n)continue;let r=e===0?1:e===1?2:e===2?3:0,i=e===0?2:e===1?3:e===2?0:1;if(t&&n){let o=se[e][0]*l,s=se[e][1]*l,c=t.extent,u=Y(c[r===0||r===1?2:0]+o),d=X(c[r===0||r===3?3:1]+s),f=n.extent,p=Y(f[i===0||i===1?2:0]+o),m=X(f[i===0||i===3?3:1]+s),h=t.renderData,g=n.renderData,_=a(u,d,h.geometryState.samplerData),v=a(p,m,g.geometryState.samplerData);ee(h,u,d,.5*(_+v),e)}else{let o=t??n,s=t?r:i,c=o.extent,u=se[e],d=Y(c[s===0||s===1?2:0]+u[0]*l),f=X(c[s===0||s===3?3:1]+u[1]*l),p=o.renderData,m=a(d,f,p.geometryState.samplerData);ee(p,d,f,m,e)}}if(!w){let e=Math.sqrt(E*E+D*D+O*O);A=E/e,j=D/e,M=O/e}if(w||M*M<.999){let e=Math.sqrt(N*N+F*F+I*I);N/=e,F/=e,I/=e;let t=Math.sqrt(L*L+R*R+z*z);L/=t,R/=t,z/=t,A=I*R-F*z,j=N*z-I*L,M=F*L-N*R;let n=1/Math.sqrt(A*A+j*j+M*M);A*=n,j*=n,M*=n}},Q=o.cornerNeighborCornerTiles;for(let t=0;t<4;++t){if(!(r&1<<t))continue;let c=t,y=(t+1)%4,b=+(t===0||t===1),x=+(t===0||t===3),S=e(b,u,p),C=e(x,d,m),w=i.getEdgeFirstVertexIndex(c),T=i.getEdgeCount(c),N=t===0||t===3?T-1:0,P=i.getEdgeFirstVertexIndex(y),F=i.getEdgeCount(y),I=t===0||t===1?F-1:0,L=-1;for(let e=0;e<4;++e){let n=Q[t*4+e],r=Q[t*4+L];n&&(L===-1||_(r,n)>0)&&(L=e)}let R=L,z=Q[t*4+R];if(z!==v){let e=v.level-z.level,r=2**e,i=[z.lij[0]+e,z.lij[1]*r,z.lij[2]*r],a=[i[1]+r===v.lij[1],t===0&&(R===1||R===0&&z!==Q[t*4+3])||t===1&&(R===0||R===1&&z!==Q[t*4+2]),i[1]===v.lij[1]+1,t===2&&(R===3||R===2&&z!==Q[t*4+1])||t===3&&(R===2||R===3&&z!==Q[t*4+0])],c=a.reduce((e,t)=>e+ +!!t,0);f(c===1||c===2);let l=-1,u=-1,d=z.renderData;if(c===1){let e=a.findIndex(e=>e);f(0<=e&&e<=3),l=(e+2)%4;let n=o.edgeResolutions[e];u=v.getNeighborEdgeStartVertexIndex(e,z)*n+n*+(e===0&&t===0||e===1&&t===0||e===2&&t===1||e===3&&t===3)}else{f(a[1]||a[3]),l=a[1]?3:1;let e=d.geometryState.edgeResolutions[l];u=t===0||t===3?0:e}let p=d.geometry;{let e=w+N,t=P+I,r=p.getEdgeFirstVertexIndex(l)+u,i=p.vertexAttributes,a=d.localOrigin,o=i.position,c=o.typedBuffer,f=r*o.typedBufferStride,m=c[f]+a[0]-s[0],_=c[f+1]+a[1]-s[1],v=c[f+2]+a[2]-s[2];be(m,_,v,h);let y=g.position,b=y.typedBuffer,x=e*y.typedBufferStride;b[x]=m,b[x+1]=_,b[x+2]=v;let T=t*y.typedBufferStride;b[T]=m,b[T+1]=_,b[T+2]=v;let E=g.uv0;E.setValues(e,Math.round(S*n),Math.round(C*n)),E.setValues(t,Math.round(S*n),Math.round(C*n));{let n=i.normalCompressed.typedBuffer,a=r*i.normalCompressed.typedBufferStride,o=g.normalCompressed,s=o.typedBuffer;{let t=e*o.typedBufferStride;s[t]=n[a],s[t+1]=n[a+1]}{let e=t*o.typedBufferStride;s[e]=n[a],s[e+1]=n[a+1]}}}}else{let n=K[c],r=K[y],o;if(n||r){let t=e(H*(1-b)+U*b,q,ne),n=e(W*(1-x)+G*x,re,J);o=a(t,n,l)}else o=ie(Q,t);k(b,x,o),Z(t);let u=E-s[0],d=D-s[1],f=O-s[2];be(u,d,f,h),i.setEdgeVertexFromValuesRawPositionUVNormal(c,N,u,d,f,S,C,A,j,M),i.setEdgeVertexFromValuesRawPositionUVNormal(y,I,u,d,f,S,C,A,j,M)}}for(let e=0;e<4;++e)ge[e]=null}function ie(e,t){let n=t*4,r=c.reduce((t,r)=>Math.min(t,e[n+r]?.level??1/0),1/0);p&&(f(!e[n+0]||!e[n+2]||g(e[n+0],e[n+2],5)),f(!e[n+1]||!e[n+3]||g(e[n+1],e[n+3],7)));let i=0,o=0;for(let t=0;t<4;++t){let s=e[n+t];if(s?.level===r){let e=t===0||t===1,n=t===0||t===3,r=s.extent,c=r[e?0:2],l=r[n?1:3],u=s.renderData?.geometryState?.samplerData,d=a(c,l,u);o+=d,i++}}let s=i?o/i:0;return f(s!=null),s}function Q(e){let{vao:t,geometry:n}=e,{vertexAttributes:r,edgeVerticesStartIndex:i}=n,{position:a}=r,o=a.typedBuffer,s=i*a.typedBufferStride;t.buffer()?.setSubData(o,s,s,o.length)}function ae(e){let{vao:t,geometry:n}=e,{indices:r,indexCount:i,edgeIndicesStartIndex:a}=n;t.indexBuffer.setSubData(r,a,a,i)}class oe{constructor(e,t,n,r,i){this.isNorth=e,this.connectedRowOffset=t,this.connectedOuterEdgeOffset=n,this.rowOffset=r,this.latitudeResolution=i}}const se=[[0,1],[1,0],[0,-1],[-1,0]],$=new s,ce=.5*d,le=new Uint16Array(u+1),ue=new Int32Array(u+1),de=new Int32Array(u+1),fe=new Int32Array(u+1),pe=new Float64Array(u+1),me=new Float64Array(u+1),he=i(-1/0,-1/0,1/0,1/0),ge=[null,null,null,null];function _e(e,t,n){if(!t)return!1;let r=_(e,t);return r>0||r===0&&n>=2}class ve{constructor(){this.vertex0Index=0,this.stride=1,this.count=0}getVertexIndex(e){return f(0<=e&&e<this.count),this.vertex0Index+this.stride*e}}const ye=[new ve,new ve,new ve,new ve];function be(e,t,n,r){e<r[0]?r[0]=e:e>r[3]&&(r[3]=e),t<r[1]?r[1]=t:t>r[4]&&(r[4]=t),n<r[2]?r[2]=n:n>r[5]&&(r[5]=n)}function xe(e){let{edgeResolutions:t,numVerticesPerSide:n}=e,r=1+Math.max(...t);return Math.max(n,r)}function Se(e,t,n,r,i,a){let o=e*i,s=a[o],c=a[o+1],l=a[o+2],u=t*i,d=a[u],f=a[u+1],p=a[u+2],m=n*i,h=a[m],g=a[m+1],_=a[m+2],v=r*i,y=a[v],b=a[v+1],x=a[v+2],S=(s-h)*(s-h)+(c-g)*(c-g)+(l-_)*(l-_);return(d-y)*(d-y)+(f-b)*(f-b)+(p-x)*(p-x)>S}function Ce(e,t,n,r,i){e[t]=n,e[t+1]=r,e[t+2]=r,e[t+3]=i,e[t+4]=i,e[t+5]=n}const we=15,Te=15,Ee=6;export{F as createPlanarGlobePatch,y as createSphericalGlobePatch,L as updateEdgeElevationsAndResolutionsPlanar,D as updateEdgeElevationsAndResolutionsSpherical,R as updateEdgesAndCornersPlanar,E as updateEdgesAndCornersSpherical};
2
+ import{clamp as e,isPowerOfTwo as t}from"../../../core/mathUtils.js";import{maxUint16 as n}from"../../../core/typedArrayUtil.js";import{empty as r}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as i}from"../../../geometry/support/aaBoundingRect.js";import{sampleElevation as a,sampleSingleElevation as o}from"./ElevationData.js";import{PatchGeometryLUT as s}from"./PatchGeometryLUT.js";import{zeroToFour as c,neighborTileIfLoadedOrSelf as l}from"./PatchRenderData.js";import{maxPatchTesselation as u,elevationNoDataValue as d}from"./TerrainConst.js";import{internalAssert as f,enableTerrainInternalChecks as p,neighborEdgeIndices as m,almostEquals as h}from"./terrainUtils.js";import{isCornerNeighbor as g}from"./Tile.js";import{compareTilesByLij as _}from"./tileUtils.js";import{compressNormal as v}from"../webgl-engine/lib/Normals.js";function y(e,t){let{tile:n,geometry:i,geometryState:a}=e,{extentInRadians:o,surface:s}=n,{isWebMercator:c,renderer:l}=s,{numVerticesPerSide:u,wireframe:d}=a,f=u-1,p=(u-2)**2,m=c&&(t===2||t===3),h=c&&(t===1||t===3),g=(+!!m+ +!!h)*Ee*u,_=xe(a),v=4*_,y=p+g+v,S=l.tileGeometryCache.acquire(y);i.numVerticesPerSide=u,i.vertexAttributes=S,i.maxEdgeVertexCount=_;let{boundingBox:C}=i;r(C);let w=P(e);$.update(f,o,w),x(e),i.poleVerticesStartIndex=p;let T=b(e,m,h);i.edgeVerticesStartIndex=p+g,J(e),O(e,we,Te),U(i,T,d),e.intersectionData=null}function b(e,t,r){let{tile:i,localOrigin:a,geometry:o}=e,{extent:s,ellipsoid:c}=i,{boundingBox:l,numVerticesPerSide:u,vertexAttributes:d,poleVerticesStartIndex:f}=o,p=u-1,m=a[0],h=a[1],g=a[2],_=c.radius,y=s[1],b=s[3],x=[],S=f,C=(e,t)=>{let r=t*u;be(-m,-h,-g+e*_,l),x.push(new oe(e===1,r,e===1?0:2,S,Ee));let i=j(e===-1?y:b,_),a=e*Math.PI/2-i,o=(e===1?1:-1)*.99,s=_+0,{position:c,uv0:f}=d,{typedBuffer:C,typedBufferStride:w}=d.normalCompressed;for(let e=1;e<=Ee;++e){let t=i+e/Ee*a,r=Math.cos(t),u=Math.sin(t);for(let e=0;e<=p;e++){let t=e/p,i=$.sinLonLUT[e],a=$.cosLonLUT[e]*r,d=i*r,_=u,y=a*s-m,b=d*s-h,x=_*s-g;be(y,b,x,l),c.setValues(S,y,b,x),f.setValues(S,Math.round(t*n),Math.round(o*n)),v(C,S,a,d,_,w),++S}}};return t&&C(-1,0),r&&C(1,p),x}function x(e){let t=e.geometryState.samplerData,n=t?.length===1?t[0]:null;n?S(e,n):C(e)}function S(e,t){let{tile:n}=e;if(!n.intersectsClippingArea)return;let{geometry:r,geometryState:i,localOrigin:a}=e,{numVerticesPerSide:o}=i,s=o-2,c=o-1,{vertexAttributes:l,boundingBox:u}=r,{position:d,uv0:f}=l,{typedBuffer:p,typedBufferStride:m}=l.normalCompressed,{extent:h}=n,g=n.ellipsoid.radius,_=a[0],y=a[1],b=a[2],x=d.typedBuffer,S=d.typedBufferStride,C=f.typedBuffer,E=f.typedBufferStride;w(c,h,t);let D=0,O=t.data.values;if(1<=s){let e=le[1],t=$.sinLatLUT[1],n=$.cosLatLUT[1];for(let r=1;r<=s;r++){let i=$.sinLonLUT[r],a=$.cosLonLUT[r],o=g+T(r,1,O),s=-_+o*a*n,c=-y+o*i*n,l=-b+o*t;be(s,c,l,u);let d=(r-1)*S;x[d]=s,x[d+1]=c,x[d+2]=l;let f=(r-1)*E;C[f]=le[r],C[f+1]=e}}for(let e=1;e<=s;e++){let t=$.sinLatLUT[e],n=$.cosLatLUT[e],r=e+1,i=le[r],a=$.sinLatLUT[r],o=$.cosLatLUT[r],l=$.sinLonLUT[0],d=$.cosLonLUT[0],f=g+T(0,e,O),h=d*n*f-_,w=l*n*f-y,k=t*f-b,A=D*S,j=x[A],M=x[A+1],N=x[A+2];for(let l=1;l<=s;l++){let d=$.sinLonLUT[l],f=$.cosLonLUT[l],A=0,P=0,F=0;if(l<s){let e=(D+1)*S;A=x[e],P=x[e+1],F=x[e+2]}else{let r=$.sinLonLUT[c],i=$.cosLonLUT[c],a=g+T(c,e,O);A=i*n*a-_,P=r*n*a-y,F=t*a-b}let I=h,L=w,R=k;h=j,w=M,k=N,j=A,M=P,N=F;let z=A-I,B=P-L,ee=F-R,V=0,H=0,te=0;if(e>1){let e=(D-s)*S;V=x[e],H=x[e+1],te=x[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=g+T(l,0,O);V=f*t*n-_,H=d*t*n-y,te=e*n-b}let U=g+T(l,r,O),W=f*o*U-_,G=d*o*U-y,K=a*U-b;if(e<s){let e=D+s,t=e*S;x[t]=W,x[t+1]=G,x[t+2]=K,be(W,G,K,u);let n=e*E;C[n]=le[l],C[n+1]=i}let q=V-W,ne=H-G,re=te-K,J=f*n,Y=d*n,X=t;X*X<.999&&(J=ee*ne-B*re,Y=z*re-ee*q,X=B*q-z*ne);let Z=1/Math.sqrt(J*J+Y*Y+X*X);v(p,D,J*Z,Y*Z,X*Z,m),++D}}}function C(e){let{tile:t}=e;if(!t.intersectsClippingArea)return;let{geometry:r,geometryState:i,localOrigin:o}=e,{numVerticesPerSide:s,samplerData:c}=i,l=s-2,u=s-1,{vertexAttributes:d,boundingBox:f}=r,{position:p,uv0:m}=d,{typedBuffer:h,typedBufferStride:g}=d.normalCompressed,{extent:_}=t,y=_[0],b=_[2],x=_[1],S=_[3],C=t.ellipsoid.radius,w=o[0],T=o[1],E=o[2],D=p.typedBuffer,O=p.typedBufferStride,k=1/u,A=0;if(1<=l){let e=k,t=x*(1-e)+S*e,r=$.sinLatLUT[1],i=$.cosLatLUT[1];for(let o=1;o<=l;o++){let s=o*k,l=y*(1-s)+b*s,u=$.sinLonLUT[o],d=$.cosLonLUT[o],p=C+a(l,t,c),h=-w+p*d*i,g=-T+p*u*i,_=-E+p*r;be(h,g,_,f);let v=(o-1)*O;D[v]=h,D[v+1]=g,D[v+2]=_,m.setValues(o-1,Math.round(s*n),Math.round(e*n))}}for(let e=1;e<=l;e++){let t=e*k,r=x*(1-t)+S*t,i=$.sinLatLUT[e],o=$.cosLatLUT[e],s=e+1,d=s*k,p=x*(1-d)+S*d,_=$.sinLatLUT[s],j=$.cosLatLUT[s],M=$.sinLonLUT[0],N=$.cosLonLUT[0],P=C+a(y,r,c),F=N*o*P-w,I=M*o*P-T,L=i*P-E,R=A*O,z=D[R],B=D[R+1],ee=D[R+2];for(let t=1;t<=l;t++){let s=t*k,S=y*(1-s)+b*s,M=$.sinLonLUT[t],N=$.cosLonLUT[t],P=0,R=0,V=0;if(t<l){let e=(A+1)*O;P=D[e],R=D[e+1],V=D[e+2]}else{let e=$.sinLonLUT[u],t=$.cosLonLUT[u],n=C+a(b,r,c);P=t*o*n-w,R=e*o*n-T,V=i*n-E}let H=F,te=I,U=L;F=z,I=B,L=ee,z=P,B=R,ee=V;let W=P-H,G=R-te,K=V-U,q=0,ne=0,re=0;if(e>1){let e=(A-l)*O;q=D[e],ne=D[e+1],re=D[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=C+a(S,x,c);q=N*t*n-w,ne=M*t*n-T,re=e*n-E}let J=C+a(S,p,c),Y=N*j*J-w,X=M*j*J-T,Z=_*J-E;if(e<l){let e=A+l,t=e*O;D[t]=Y,D[t+1]=X,D[t+2]=Z,be(Y,X,Z,f),m.setValues(e,Math.round(s*n),Math.round(d*n))}let ie=q-Y,Q=ne-X,ae=re-Z,oe=N*o,se=M*o,ce=i;ce*ce<.999&&(oe=K*Q-G*ae,se=W*ae-K*ie,ce=G*ie-W*Q);let le=1/Math.sqrt(oe*oe+se*se+ce*ce);v(h,A,oe*le,se*le,ce*le,g),++A}}}function w(t,r,i){let a=r[0],o=r[2],s=r[1],c=r[3],l=1/t,{dx:u,dy:d,x0:f,y1:p,safeWidth:m}=i,h=i.data.width;for(let r=0;r<=t;r++){let t=r*l,i=e(u*(a*(1-t)+o*t-f),0,m),g=Math.floor(i);ue[r]=g,pe[r]=i-g;let _=e(d*(p-(s*(1-t)+c*t)),0,m),v=Math.floor(_);de[r]=v*h,fe[r]=(v+1)*h,me[r]=_-v,le[r]=Math.round(t*n)}}function T(e,t,n){let r=ue[e],i=pe[e],a=de[t],o=fe[t],s=me[t],c=a+r,l=n[c],u=n[c+1],d=n[o+r],f=n[o+r+1];if(l+d+u+f>=ce)return 0;let p=l+(u-l)*i;return p+(d+(f-d)*i-p)*s}function E(e,t=!1){e.tile.intersectsClippingArea&&(O(e,t?we:e.dirtyEdges,t?Te:e.dirtyCorners),Q(e),e.intersectionData=null)}function D(e){e.tile.intersectsClippingArea&&(Y(e),O(e,we,Te),Q(e),ae(e),e.intersectionData=null)}function O(e,t,n){e.tile.intersectsClippingArea&&(n&&A(e,n),t&&k(e,t))}function k(e,r){let{geometry:i,geometryState:s,tile:c,localOrigin:u}=e,{level:d,extent:g,extentInRadians:y,ellipsoid:b}=c,x=b.radius,S=y[0],C=y[2],w=y[1],T=y[3],{samplerData:E}=s,D=g[0],O=g[2],k=g[1],A=g[3],j=P(e),{boundingBox:M,vertexAttributes:N}=i,F=u[0],I=u[1],L=u[2],{position:R,uv0:z}=N,B=R.typedBuffer,ee=R.typedBufferStride,V=z.typedBuffer,H=z.typedBufferStride,{typedBuffer:te,typedBufferStride:U}=N.normalCompressed,W=E?.length===1?E[0]:null,G=(e,t,n)=>W?o(e,t,W)??0:a(e,t,E)??0;for(let u=0;u<4;++u){if(!(r&1<<u))continue;let y=u===1||u===3,b=s.edgeResolutions[u];f(t(b));let N=b+1,P=l(c,s.edgePeerNeighbors[u]);if(_e(c,P,u)&&X(e,u,P))continue;let R=P!=null;f(!R||P.level===c.level),f(!R||_(c,P)<=0);let z=P?.renderData?.geometryState;if(p){let e=c.surface;if(!P&&e&&!e.updatingRootTiles){let t=m[u],n=c.findNeighborTile(t,e=>e.loaded||e.leaf||e.level===c.level);n?n.intersectsClippingArea&&(f(!n.loaded),f(!n.leaf),f(n.level===d)):f(e?.rootTiles==null||!c.shouldHaveNeighbor(t))}}let K=u===1?g[2]:g[0],q=P?.extent,ne=q&&y?u===1?q[0]:q[2]:K,re=u===0?g[3]:g[1],J=+(u===1),Y=+(u===0),Z=u===1?C:S,ie=u===0?T:w,Q=Math.sin(Z),ae=Math.cos(Z),oe=Math.sin(ie),se=Math.cos(ie),$=z?.samplerData,ce=$?.length===1?$[0]:null,le=(e,t,n)=>ce?o(n,t,ce)??0:a(n,t,$)??0,ue=R?(e,t,n)=>(G(e,t)+le(e,t,n))*.5:G,de=i.outerEdgesOffsetAndLength[u*2+0],fe=W!=null||E!=null&&E.some(e=>e!=null),pe=ce!=null||$!=null&&$.some(e=>e!=null),me=fe||pe,he=1/b,ge=n*he,ve=J*n,ye=Y*n,xe=de;f(!q||h(q[2]-q[0],g[2]-g[0])),(()=>{let e=u===1?-1:+(u===3),t=u===0?-1:+(u===2),n=(g[2]-g[0])*he,r=e*n,i=t*n,s=C-S,c=y?s*he*e:0,l=y?0:t*he,d=Y,f=y?Z+c:Z,p=y?Math.sin(f):Q,m=y?Math.cos(f):ae,h=y?Z-c:Z,_=y?Math.sin(h):Q,b=y?Math.cos(h):ae,w=d+l,T=y?ie:j(w),P=y?oe:Math.sin(T),z=y?se:Math.cos(T),G=d-l,q=y?ie:j(G),J=y?oe:Math.sin(q),X=y?se:Math.cos(q),le=0,de=0,fe=0;{let e=0*he,t=y?K:D*(1-e)+O*e,n=y?ne:t,r=y?k*(1-e)+A*e:re,i=y?Z:S*(1-e)+C*e,a=y?Q:Math.sin(i),o=y?ae:Math.cos(i),s=y?j(e):ie,c=y?Math.sin(s):oe,l=y?Math.cos(s):se,u=x+ue(t,r,n);le=o*l*u,de=a*l*u,fe=c*u}let pe=0,_e=0,Se=0;{let e=1*he,t=y?K:D*(1-e)+O*e,n=y?ne:t,r=y?k*(1-e)+A*e:re,i=y?Z:S*(1-e)+C*e,a=y?Q:Math.sin(i),o=y?ae:Math.cos(i),s=y?j(e):ie,c=y?Math.sin(s):oe,l=y?Math.cos(s):se,u=x+ue(t,r,n);pe=o*l*u,_e=a*l*u,Se=c*u}for(let e=1;e<N-1;++e){let t=0,n=0,s=0;{let r=(e+1)*he,i=y?K:D*(1-r)+O*r,a=y?ne:i,o=y?k*(1-r)+A*r:re,c=y?Z:S*(1-r)+C*r,l=y?Q:Math.sin(c),u=y?ae:Math.cos(c),d=y?j(r):ie,f=y?Math.sin(d):oe,p=y?Math.cos(d):se,m=x+ue(i,o,a);t=u*p*m,n=l*p*m,s=f*m}let c=t,l=n,d=s,f=pe,h=_e,g=Se;pe=c,_e=l,Se=d;{let t=xe+e,n=t*ee,r=f-F,i=h-I,a=g-L;B[n]=r,B[n+1]=i,B[n+2]=a,be(r,i,a,M);let o=Math.round(e*ge),s=t*H;V[s]=y?ve:o,V[s+1]=y?o:ye}let w=le,T=de,N=fe;le=f,de=h,fe=g;let G=f,q=h,Y=g,Ce=1/Math.sqrt(G*G+q*q+Y*Y),we=Y*Ce,Te=0,Ee=0,De=0;if(me&&we*we<.999){let t=0,n=0,s=0;{let e=u===0?-1:1;t=e*(c-w),n=e*(l-T),s=e*(d-N)}{let c=e*he,l=y?K:D*(1-c)+O*c,d=y?ne:l,f=y?k*(1-c)+A*c:re,h=y?Z:S*(1-c)+C*c,g=y?Q:Math.sin(h),v=y?ae:Math.cos(h),w=y?j(c):ie,T=y?Math.sin(w):oe,M=y?Math.cos(w):se,N=G,F=q,I=Y;if(R){let e=d-r,t=f-i,n=x+(ce?o(e,t,ce)??0:a(e,t,$)??0),s=y?_:g,c=y?b:v,l=y?T:J,u=y?M:X;N=c*u*n,F=s*u*n,I=l*n}{let e=l+r,c=f+i,d=x+(W?o(e,c,W)??0:a(e,c,E)??0),h=y?p:g,_=y?m:v,b=y?T:P,S=y?M:z,C=_*S*d,w=h*S*d,D=b*d;R||(N=2*G-C,F=2*q-w,I=2*Y-D);let O=u===3?-1:1,k=O*(N-C),A=O*(F-w),j=O*(I-D);Te=s*A-n*j,Ee=t*j-s*k,De=n*k-t*A;let L=1/Math.sqrt(Te*Te+Ee*Ee+De*De);Te*=L,Ee*=L,De*=L}}}else Te=G*Ce,Ee=q*Ce,De=Y*Ce;v(te,xe+e,Te,Ee,De,U)}})()}}function A(e,t){Z(e,t)}function j(e,t){return Math.PI/2-2*Math.atan(Math.exp(-e/t))}function M(e,t,n,r){return j(e*(1-r)+t*r,n)}function N(e,t,n){return e*(1-n)+t*n}function P(e){let{tile:t}=e;if(t.surface.isWebMercator){let e=t.extent,n=t.ellipsoid.radius;return t=>M(e[1],e[3],n,t)}let n=t.extentInRadians;return e=>N(n[1],n[3],e)}function F(e){let{tile:t,geometryState:n,geometry:i}=e,{extent:a,surface:o}=t,{wireframe:s}=n,c=a[0],l=a[1],u=a[2],d=a[3],f=u-c,p=d-l,{numVerticesPerSide:m,clippingArea:h}=n,g=h==null?0:Math.max(0,(h[0]-c)/f),_=h==null?0:Math.max(0,(h[1]-l)/p),v=h==null?1:Math.min(1,(h[2]-c)/f),y=h==null?1:Math.min(1,(h[3]-l)/p),b=(m-2)**2,x=xe(n),S=b+4*x,C=o.renderer.tileGeometryCache.acquire(S),{boundingBox:w}=i;r(w),i.numVerticesPerSide=m,i.vertexAttributes=C,i.maxEdgeVertexCount=x,i.minu=g,i.minv=_,i.maxu=v,i.maxv=y,I(e),i.edgeVerticesStartIndex=b,J(e),z(e,we,Te),U(i,[],s),e.intersectionData=null}function I(t){let r=t.tile;if(!r.intersectsClippingArea)return;let{geometry:i,geometryState:s,localOrigin:c}=t,{samplerData:l,clippingArea:u,numVerticesPerSide:d}=s,{surface:f,extent:p,ellipsoid:m}=r,{isWebMercatorOnPlateCarree:h}=f,g=u??he,_=p[0],y=p[1],b=p[2],x=p[3],S=Math.max(_,g[0]),C=Math.min(b,g[2]),w=Math.max(y,g[1]),T=Math.min(x,g[3]),E=m.radius,D=r.horizontalScale,O=d-1,k=d-2,{minu:A,minv:j,maxu:M,maxv:N,boundingBox:P,vertexAttributes:F}=i,{position:I,uv0:L}=F,{typedBuffer:R,typedBufferStride:z}=F.normalCompressed,B=c[0],ee=c[1],V=c[2],H=I.typedBuffer,te=I.typedBufferStride,U=0,W=e(y,w,T),G=h?(Math.PI/2-2*Math.atan(Math.exp(-W/E)))*E:W*D,K=1/O,q=e(y*(1-K)+x*K,w,T),ne=h?(Math.PI/2-2*Math.atan(Math.exp(-q/E)))*E:q*D,re=G,J=ne,Y=l?.length===1?l[0]:null,X=Y?(e,t)=>o(e,t,Y)??0:(e,t)=>a(e,t,l)??0;for(let t=1;t<=k;t++){let r=t/O,i=e(y*(1-r)+x*r,w,T),a=e(r,j,N),o=J,s=(t-1)/O,c=e(y*(1-s)+x*s,w,T),l=re,u=(t+1)/O,d=e(y*(1-u)+x*u,w,T),f=h?(Math.PI/2-2*Math.atan(Math.exp(-d/E)))*E:d*D,p=e(u,j,N);re=J,J=f;let m=e(_,S,C),g=m*D,F=X(m,i),I=1/O,W=e(I,A,M),G=e(_*(1-W)+b*W,S,C),K=W,q=G,ne=G*D,Y=X(G,i);if(t===1){let t=ne-B,r=re-ee,i=Y-V,o=0*te;H[o]=t,H[o+1]=r,H[o+2]=i,be(t,r,i,P);let s=e(I,A,M);L.setValues(U,Math.round(s*n),Math.round(a*n))}for(let r=1;r<=k;r++){let s=ne,u=Y,m=(r+1)/O,h=e(m,A,M),y=e(_*(1-m)+b*m,S,C),x=q;q=y;{let e=U+1,s=e*te;if(t===1||r===k){let c=X(y,i),l=y*D,u=o,d=c;if(t===1&&r<k){let t=l-B,r=u-ee,i=d-V;H[s]=t,H[s+1]=r,H[s+2]=i,be(t,r,i,P),L.setValues(e,Math.round(h*n),Math.round(a*n))}ne=l,Y=d}else ne=H[s]+B,Y=H[s+2]+V}let w=ne,T=Y,E=g,j=F;g=s,F=u;let N=(U-k)*te,I=t===1?X(x,c):H[N+2]+V,W=X(x,d);if(t<k){let e=U+k,t=e*te,r=s-B,i=f-ee,a=W-V;H[t]=r,H[t+1]=i,H[t+2]=a,be(r,i,a,P);let o=K;K=h,L.setValues(e,Math.round(o*n),Math.round(p*n))}{let e=w-E,t=T-j,n=l-f,r=I-W,i=n*t,a=e*r,o=-n*e,s=i*i+a*a+o*o;if(s===0)v(R,U,0,0,1,z);else{let e=1/Math.sqrt(s);v(R,U,i*e,a*e,o*e,z)}}++U}}}function L(e){e.tile.intersectsClippingArea&&(Y(e),z(e,we,Te),Q(e),ae(e),e.intersectionData=null)}function R(e,t=!1){e.tile.intersectsClippingArea&&(z(e,t?we:e.dirtyEdges,t?Te:e.dirtyCorners),Q(e),e.intersectionData=null)}function z(e,t,n){e.tile.intersectsClippingArea&&(n&&ee(e,n),t&&B(e,t))}function B(n,r){let{geometry:i,geometryState:s,localOrigin:c}=n,u=n.tile,{surface:d,extent:h}=u,{clippingArea:g,samplerData:v}=s,y=g??he,b=h[0],x=h[2],S=h[1],C=h[3],w=[C>y[3],x>y[2],S<y[1],b<y[0]],T=u.horizontalScale,E=te(d.isWebMercatorOnPlateCarree,u.ellipsoid.radius,T),{minu:D,minv:O,maxu:k,maxv:A,boundingBox:j}=i,M=Math.max(b,y[0]),N=Math.min(x,y[2]),P=Math.max(S,y[1]),F=Math.min(C,y[3]),I=c[0],L=c[1],R=c[2],z=v?.length===1?v[0]:void 0,B=z?(e,t)=>o(e,t,z)??0:(e,t)=>a(e,t,v)??0;for(let c=0;c<4;++c){if(!(r&1<<c))continue;let h=c===1||c===3,g=s.edgeResolutions[c];f(t(g));let y=g+1,z=w[c],ee=l(u,s.edgePeerNeighbors[c]);if(!z&&_e(u,ee,c)&&X(n,c,ee))continue;let V=ee!=null&&!z,H=ee?.renderData?.geometryState;if(p&&(f(!V||ee.level===u.level),f(!V||_(u,ee)<=0),u&&!ee&&!d.updatingRootTiles)){let e=m[c],t=u.findNeighborTile(e,e=>e.loaded||e.leaf||e.level===u.level);d.updatingRootTiles||(t?t.intersectsClippingArea&&(f(!t.loaded),f(!t.leaf),f(t.level===u.level)):f(d?.rootTiles==null||!u.shouldHaveNeighbor(e)))}let te=e(c===1?x:b,M,N),U=e(c===0?C:S,P,F),W=H?.samplerData,G=e(+(c===1),D,k),K=e(+(c===0),O,A),q=W?.length===1?W[0]:null,ne=(e,t)=>q?o(e,t,q)??0:a(e,t,W)??0,re=V?(e,t)=>(ne(e,t)+B(e,t))*.5:B,J=(x-b)/g,Y=h?c===1?J:-J:0,Z=h?0:c===0?J:-J,ie=-Y,Q=-Z,ae=0,oe=0,se=0;{let t=0/g,n=h?te:e(b*(1-t)+x*t,M,N),r=h?e(S*(1-t)+C*t,P,F):U,i=re(n,r);ae=n*T,oe=E(r),se=i}let $=0,ce=0,le=0;{let t=1/g,n=h?te:e(b*(1-t)+x*t,M,N),r=h?e(S*(1-t)+C*t,P,F):U,i=re(n,r),a=n*T,o=E(r),s=i;$=a,ce=o,le=s}for(let t=1;t<y-1;++t){let n=t/g,r=$,o=ce,s=le;{let a=h?G:e(n,D,k),l=h?e(n,O,A):K,u=r-I,d=o-L,f=s-R;be(r,d,f,j),i.setEdgeVertexFromValuesRawPositionUV(c,t,u,d,f,a,l)}{let n=(t+1)/g,r=h?te:e(b*(1-n)+x*n,M,N),i=h?e(S*(1-n)+C*n,P,F):U,a=re(r,i);$=r*T,ce=E(i),le=a}let l=$,u=ce,d=le,f=ae,p=oe,m=se;ae=r,oe=o,se=s;let _=0,y=0,w=0;if(h){let t=u-o,i=d-s,l=p-o,f=m-s,h=e(S*(1-n)+C*n,P,F),g=te+ie,b=h,x=g*T,E=a(g,b,v),D=x-r,O=E-s,k=c===3?-1:1;if(_=k*(-l+t)*O,y=k*D*(-f+i),w=-k*D*(-l+t),V){let e=te+Y,n=h,o=e*T,c=a(e,n,W),u=o-r,d=c-s;_=(-l+t)*(O-d),y=(D-u)*(-f+i),w=-(D-u)*(-l+t)}}else{let t=l-r,i=d-s,u=f-r,p=m-s,h=e(b*(1-n)+x*n,M,N),g=h,S=U+Q,C=a(g,S,v)-s,T=E(S)-o,D=c===2?-1:1;if(_=D*T*(-p+i),y=D*(-u+t)*C,w=-D*T*(-u+t),V){let e=h,n=U+Z,r=E(n),c=a(e,n,W)-s,l=r-o;_=(-T+l)*(-p+i),y=(-u+t)*(-C+c),w=-(-T+l)*(-u+t)}}let z=1/Math.sqrt(_*_+y*y+w*w);i.setEdgeNormalFromValues(c,t,_*z,y*z,w*z)}}}function ee(e,t){Z(e,t)}function V(e,t){return(Math.PI/2-2*Math.atan(Math.exp(-e/t)))*t}function H(e,t){return e*t}function te(e,t,n){return e?e=>V(e,t):e=>H(e,n)}function U(e,t,n){let{numVerticesPerSide:r,vertexAttributes:i,maxEdgeVertexCount:a}=e,o=r-1,s=i.count,l=r-3,u=r-3,d=2*l*u,f=4*(o+a-3),p=c.reduce((t,n)=>t+(o+e.getEdgeCount(n)-3),0),m=t.reduce((e,t)=>e+o*((t.latitudeResolution-1)*2+1),0),h=3*(n?2:1),g=(d+f+m)*h;e.indices=s>=65536?new Uint32Array(g):new Uint16Array(g),e.indexCount=(d+p+m)*h,e.poleIndicesStartIndex=d*h,e.edgeIndicesStartIndex=(d+m)*h,n?(q(e),ne(e,t),re(e)):(W(e),G(e,t),K(e))}function W(e){let{numVerticesPerSide:t,indices:n,vertexAttributes:r}=e,{position:i}=r,{typedBuffer:a,typedBufferStride:o}=i,s=t-2,c=t-3,l=t-3,u=0;for(let e=0;e<c;++e){let t=e*s;for(let e=0;e<l;++e){let r=t+e,i=r+1,c=i+s,l=c-1;Se(r,i,c,l,o,a)?(n[u]=r,n[u+1]=i,n[u+2]=c,n[u+3]=c,n[u+4]=l,n[u+5]=r):(n[u]=r,n[u+1]=i,n[u+2]=l,n[u+3]=l,n[u+4]=i,n[u+5]=c),u+=6}}}function G(e,t){let{numVerticesPerSide:n,indices:r,poleIndicesStartIndex:i}=e,a=n-1,o=i;for(let i of t){let t=i.isNorth?1:2,s=i.isNorth?2:1,c=i.isNorth?3:4,l=i.isNorth?4:3,u=e.getEdgeVertexIndex(i.connectedOuterEdgeOffset,0),d=1;for(let e=0;e<i.latitudeResolution;++e){let f=e===0?i.rowOffset:u+n;for(let n=0;n<a;n++){let a=f+n;r[o]=u,r[o+t]=u+1,r[o+s]=a,e<i.latitudeResolution-1?(r[o+c]=u+1,r[o+l]=a+1,r[o+5]=a,o+=6):o+=3,u+=d}u=f,d=1}}}function K(e){let{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:r}=e,i=n-1,a=i-2,o=r;for(let n=0;n<4;++n){let r=ye[n],s=0,c=0,l=e.getEdgeCount(n),u=r.count;f(u===i-1);let d=n===1||n===2,p=d?1:2,m=d?2:1,h=e.getEdgeFirstVertexIndex(n),g=r.vertex0Index,_=r.stride;for(;s<l-1||c<u-1;){let e=g+c*_,n=h+s*1,r=s<l-1,d=c<u-1,f=r?0+i*(s+.5)/(l-1):0,v=d?1+a*(c+.5)/(u-1):0,y=r&&(!d||f<=v);y?++s:++c;let b=y?n+1:e+_;t[o]=e,t[o+p]=n,t[o+m]=b,o+=3}}e.indexCount=o}function q(e){let{indices:t,numVerticesPerSide:n,vertexAttributes:r}=e,{position:i}=r,{typedBuffer:a,typedBufferStride:o}=i,s=n-2,c=0;for(let e=0;e<n-3;++e){let r=e*s;for(let i=0;i<n-3;++i){let n=e*s+i,l=n+1,u=l+s,d=u-1,f=r+i,p=f+1,m=p+s;Se(f,p,m,m-1,o,a)?(Ce(t,c,n,l,u),c+=6,Ce(t,c,u,d,n)):(Ce(t,c,n,l,d),c+=6,Ce(t,c,d,u,l)),c+=6}}}function ne(e,t){let{indices:n,numVerticesPerSide:r,poleIndicesStartIndex:i}=e,a=r-1,o=i;for(let i of t){let t=i.connectedOuterEdgeOffset,s=e.getEdgeVertexIndex(t,0),c=1;for(let e=0;e<i.latitudeResolution;++e){let t=e===0?i.rowOffset:s+r;for(let r=0;r<a;r++)Ce(n,o,s,s+1,t+r),o+=6,e<i.latitudeResolution-1&&(Ce(n,o,s+1,t+r+1,t+r),o+=6),s+=c;s=t,c=1}}}function re(e){let{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:r}=e,i=n-1,a=i-2,o=r;for(let n=0;n<4;++n){let r=ye[n],s=0,c=0,l=e.getEdgeCount(n),u=r.count;f(u===i-1);let d=n===1||n===2,p=d?1:3,m=d?3:1,h=e.getEdgeFirstVertexIndex(n),g=r.vertex0Index,_=r.stride;for(;s<l-1||c<u-1;){let e=g+c*_,n=h+s*1,r=s<l-1,d=c<u-1,f=r?0+i*(s+.5)/(l-1):0,v=d?1+a*(c+.5)/(u-1):0,y=r&&(!d||f<=v);y?++s:++c;let b=y?n+1:e+_;t[o]=e,t[o+p]=n,t[o+p+1]=n,t[o+m]=b,t[o+m+1]=b,t[o+5]=e,o+=6}}e.indexCount=o}function J(e){let{geometry:t,geometryState:n}=e,{edgeResolutions:r}=n,{numVerticesPerSide:i,edgeVerticesStartIndex:a}=t,o=i-2,s=a;for(let e=0;e<4;++e){{let t=e===1?o-1:0,n=e===0?o-1:0,r=e===0||e===2,i=+!!r,a=+!r,s=n*o+t,c=a*o+i,l=ye[e];l.vertex0Index=s,l.stride=c,l.count=o}{let n=r[e]+1;t.outerEdgesOffsetAndLength[e*2+0]=s,t.outerEdgesOffsetAndLength[e*2+1]=n,s+=n}}}function Y(e){J(e),e.geometryState.wireframe?re(e.geometry):K(e.geometry)}function X(r,i,a){let{geometryState:o,geometry:s,tile:c,localOrigin:l}=r,u=i===1||i===3,d=o.edgeResolutions[i];f(t(d));let p=d+1,{boundingBox:m,minu:h,minv:g,maxu:_,maxv:v,vertexAttributes:y}=s,b=e(+(i===1),h,_),x=e(+(i===0),g,v),S=a.renderData,C=S.geometryState;if(!C||!S.geometry.vertexAttributes)return!1;let w=S.geometry,T=(i+2)%4,E=w.getEdgeCount(T),D=c.getNeighborEdgeStartVertexIndex(i,a)*d,O=d*2**(c.level-a.level);f(C.edgeResolutions[T]===O),f(E-1===O);let k=S.localOrigin[0]-l[0],A=S.localOrigin[1]-l[1],j=S.localOrigin[2]-l[2],M=s.getEdgeFirstVertexIndex(i),{position:N,uv0:P}=y,F=N.typedBuffer,I=N.typedBufferStride,L=y.normalCompressed,R=L.typedBuffer,z=L.typedBufferStride,B=w.vertexAttributes,ee=w.getEdgeFirstVertexIndex(T),V=B.position.typedBuffer,H=B.position.typedBufferStride,te=B.normalCompressed.typedBuffer,U=B.normalCompressed.typedBufferStride;for(let t=1;t<p-1;++t){let r=D+t,i=M+t,a=ee+r,o=i*I,s=a*H,c=V[s]+k,l=V[s+1]+A,f=V[s+2]+j;F[o]=c,F[o+1]=l,F[o+2]=f,be(c,l,f,m);let p=i*z,y=a*U;R[p]=te[y],R[p+1]=te[y+1];let S=t/d,C=u?b:e(S,h,_),w=u?e(S,g,v):x;P.setValues(i,Math.round(C*n),Math.round(w*n))}return!0}function Z(t,r){let{geometry:i,geometryState:o,localOrigin:s}=t,{clippingArea:c,samplerData:l}=o,{minu:u,minv:d,maxu:p,maxv:m,boundingBox:h,vertexAttributes:g}=i,v=t.tile,{surface:y,ellipsoid:b,extent:x,extentInRadians:S,horizontalScale:C}=v,w=y.view?.viewingMode===`local`,T=b.radius,E=0,D=0,O=0,k=w?(()=>{let t=c,n=t!=null&&(x[3]>t[3]||x[2]>t[2]||x[1]<t[1]||x[0]<t[0]),r=te(y.isWebMercatorOnPlateCarree,T,C);return(i,a,o)=>{let s=i===0?x[0]:x[2],c=a===0?x[1]:x[3],l=n?e(s,t[0],t[2]):s,u=n?e(c,t[1],t[3]):c,d=o;E=l*C,D=r(u),O=d}})():(e,t,n)=>{let r=S[t===0?1:3],i=S[e===0?0:2],a=Math.cos(r),o=Math.sin(r),s=Math.sin(i),c=Math.cos(i),l=T+n;E=c*a*l,D=s*a*l,O=o*l},A=0,j=0,M=0,N=0,F=0,I=0,L=0,R=0,z=0,B=w&&y.isWebMercatorOnPlateCarree,ee=(e,t,n,r,i)=>{let a=0,o=0,s=0;if(w){let e=t*C,i=B?(Math.PI/2-2*Math.atan(Math.exp(-n/T)))*T:n*C,c=r;a=e-E,o=i-D,s=c-O}else{let i=P(e),c=e.tile,l=c.extent,u=c.extentInRadians,d=(t-l[0])/(l[2]-l[0]),f=(n-l[1])/(l[3]-l[1]),p=u[0]*(1-d)+u[2]*d,m=i(f),h=Math.cos(m),g=Math.sin(m),_=Math.sin(p),v=Math.cos(p),y=T+r,b=v*h*y,x=_*h*y,S=g*y;a=b-E,o=x-D,s=S-O}switch(i){case 0:L+=a,R+=o,z+=s;break;case 1:N-=a,F-=o,I-=s;break;case 2:L-=a,R-=o,z-=s;break;case 3:N+=a,F+=o,I+=s}},V=c??he,H=x[0],U=x[2],W=x[1],G=x[3],K=[G>V[3],U>V[2],W<V[1],H<V[0]],q=Math.max(H,V[0]),ne=Math.min(U,V[2]),re=Math.max(W,V[1]),J=Math.min(G,V[3]),Y=e=>Math.max(V[0],Math.min(V[2],e)),X=e=>Math.max(V[1],Math.min(V[3],e)),Z=e=>{let t=o.cornerNeighborCornerTiles;A=0,j=0,M=1,N=0,F=0,I=0,L=0,R=0,z=0;let n=1/0;for(let r=0;r<4;++r){let i=t[e*4+r];n=Math.min(n,i?.level??1/0)}for(let r=0;r<4;++r){let i=t[e*4+r];ge[r]=i?.level===n?i:null}let r=1,i=0;for(let e=0;e<4;++e){let t=ge[e];t&&(r=Math.max(r,t?.renderData.geometryState.numVerticesPerSide),i=t.extent[2]-t.extent[0])}let s=i,c=r;f(c>1);let l=s/c;for(let e=0;e<4;++e){let t=ge[(e+3)%4],n=ge[e%4];if(!t&&!n)continue;let r=e===0?1:e===1?2:e===2?3:0,i=e===0?2:e===1?3:e===2?0:1;if(t&&n){let o=se[e][0]*l,s=se[e][1]*l,c=t.extent,u=Y(c[r===0||r===1?2:0]+o),d=X(c[r===0||r===3?3:1]+s),f=n.extent,p=Y(f[i===0||i===1?2:0]+o),m=X(f[i===0||i===3?3:1]+s),h=t.renderData,g=n.renderData,_=a(u,d,h.geometryState.samplerData),v=a(p,m,g.geometryState.samplerData);ee(h,u,d,.5*(_+v),e)}else{let o=t??n,s=t?r:i,c=o.extent,u=se[e],d=Y(c[s===0||s===1?2:0]+u[0]*l),f=X(c[s===0||s===3?3:1]+u[1]*l),p=o.renderData,m=a(d,f,p.geometryState.samplerData);ee(p,d,f,m,e)}}if(!w){let e=Math.sqrt(E*E+D*D+O*O);A=E/e,j=D/e,M=O/e}if(w||M*M<.999){let e=Math.sqrt(N*N+F*F+I*I);N/=e,F/=e,I/=e;let t=Math.sqrt(L*L+R*R+z*z);L/=t,R/=t,z/=t,A=I*R-F*z,j=N*z-I*L,M=F*L-N*R;let n=1/Math.sqrt(A*A+j*j+M*M);A*=n,j*=n,M*=n}},Q=o.cornerNeighborCornerTiles;for(let t=0;t<4;++t){if(!(r&1<<t))continue;let c=t,y=(t+1)%4,b=+(t===0||t===1),x=+(t===0||t===3),S=e(b,u,p),C=e(x,d,m),w=i.getEdgeFirstVertexIndex(c),T=i.getEdgeCount(c),N=t===0||t===3?T-1:0,P=i.getEdgeFirstVertexIndex(y),F=i.getEdgeCount(y),I=t===0||t===1?F-1:0,L=-1;for(let e=0;e<4;++e){let n=Q[t*4+e],r=Q[t*4+L];n&&(L===-1||_(r,n)>0)&&(L=e)}let R=L,z=Q[t*4+R];if(z!==v){let e=v.level-z.level,r=2**e,i=[z.lij[0]+e,z.lij[1]*r,z.lij[2]*r],a=[i[1]+r===v.lij[1],t===0&&(R===1||R===0&&z!==Q[t*4+3])||t===1&&(R===0||R===1&&z!==Q[t*4+2]),i[1]===v.lij[1]+1,t===2&&(R===3||R===2&&z!==Q[t*4+1])||t===3&&(R===2||R===3&&z!==Q[t*4+0])],c=a.reduce((e,t)=>e+ +!!t,0);f(c===1||c===2);let l=-1,u=-1,d=z.renderData;if(c===1){let e=a.findIndex(e=>e);f(0<=e&&e<=3),l=(e+2)%4;let n=o.edgeResolutions[e];u=v.getNeighborEdgeStartVertexIndex(e,z)*n+n*+(e===0&&t===0||e===1&&t===0||e===2&&t===1||e===3&&t===3)}else{f(a[1]||a[3]),l=a[1]?3:1;let e=d.geometryState.edgeResolutions[l];u=t===0||t===3?0:e}let p=d.geometry;{let e=w+N,t=P+I,r=p.getEdgeFirstVertexIndex(l)+u,i=p.vertexAttributes,a=d.localOrigin,o=i.position,c=o.typedBuffer,f=r*o.typedBufferStride,m=c[f]+a[0]-s[0],_=c[f+1]+a[1]-s[1],v=c[f+2]+a[2]-s[2];be(m,_,v,h);let y=g.position,b=y.typedBuffer,x=e*y.typedBufferStride;b[x]=m,b[x+1]=_,b[x+2]=v;let T=t*y.typedBufferStride;b[T]=m,b[T+1]=_,b[T+2]=v;let E=g.uv0;E.setValues(e,Math.round(S*n),Math.round(C*n)),E.setValues(t,Math.round(S*n),Math.round(C*n));{let n=i.normalCompressed.typedBuffer,a=r*i.normalCompressed.typedBufferStride,o=g.normalCompressed,s=o.typedBuffer;{let t=e*o.typedBufferStride;s[t]=n[a],s[t+1]=n[a+1]}{let e=t*o.typedBufferStride;s[e]=n[a],s[e+1]=n[a+1]}}}}else{let n=K[c],r=K[y],o;if(n||r){let t=e(H*(1-b)+U*b,q,ne),n=e(W*(1-x)+G*x,re,J);o=a(t,n,l)}else o=ie(Q,t);k(b,x,o),Z(t);let u=E-s[0],d=D-s[1],f=O-s[2];be(u,d,f,h),i.setEdgeVertexFromValuesRawPositionUVNormal(c,N,u,d,f,S,C,A,j,M),i.setEdgeVertexFromValuesRawPositionUVNormal(y,I,u,d,f,S,C,A,j,M)}}for(let e=0;e<4;++e)ge[e]=null}function ie(e,t){let n=t*4,r=c.reduce((t,r)=>Math.min(t,e[n+r]?.level??1/0),1/0);p&&(f(!e[n+0]||!e[n+2]||g(e[n+0],e[n+2],5)),f(!e[n+1]||!e[n+3]||g(e[n+1],e[n+3],7)));let i=0,o=0;for(let t=0;t<4;++t){let s=e[n+t];if(s?.level===r){let e=t===0||t===1,n=t===0||t===3,r=s.extent,c=r[e?0:2],l=r[n?1:3],u=s.renderData?.geometryState?.samplerData,d=a(c,l,u);o+=d,i++}}let s=i?o/i:0;return f(s!=null),s}function Q(e){let{vao:t,geometry:n}=e,{vertexAttributes:r,edgeVerticesStartIndex:i}=n,{position:a}=r,o=a.typedBuffer,s=i*a.typedBufferStride,c=(n.getEdgeFirstVertexIndex(3)+n.getEdgeCount(3))*a.typedBufferStride;t.buffer()?.setSubData(o,s,s,c)}function ae(e){let{vao:t,geometry:n}=e,{indices:r,indexCount:i,edgeIndicesStartIndex:a}=n;t.indexBuffer.setSubData(r,a,a,i)}class oe{constructor(e,t,n,r,i){this.isNorth=e,this.connectedRowOffset=t,this.connectedOuterEdgeOffset=n,this.rowOffset=r,this.latitudeResolution=i}}const se=[[0,1],[1,0],[0,-1],[-1,0]],$=new s,ce=.5*d,le=new Uint16Array(u+1),ue=new Int32Array(u+1),de=new Int32Array(u+1),fe=new Int32Array(u+1),pe=new Float64Array(u+1),me=new Float64Array(u+1),he=i(-1/0,-1/0,1/0,1/0),ge=[null,null,null,null];function _e(e,t,n){if(!t)return!1;let r=_(e,t);return r>0||r===0&&n>=2}class ve{constructor(){this.vertex0Index=0,this.stride=1,this.count=0}getVertexIndex(e){return f(0<=e&&e<this.count),this.vertex0Index+this.stride*e}}const ye=[new ve,new ve,new ve,new ve];function be(e,t,n,r){e<r[0]?r[0]=e:e>r[3]&&(r[3]=e),t<r[1]?r[1]=t:t>r[4]&&(r[4]=t),n<r[2]?r[2]=n:n>r[5]&&(r[5]=n)}function xe(e){let{edgeResolutions:t,numVerticesPerSide:n}=e,r=1+Math.max(...t);return Math.max(n,r)}function Se(e,t,n,r,i,a){let o=e*i,s=a[o],c=a[o+1],l=a[o+2],u=t*i,d=a[u],f=a[u+1],p=a[u+2],m=n*i,h=a[m],g=a[m+1],_=a[m+2],v=r*i,y=a[v],b=a[v+1],x=a[v+2],S=(s-h)*(s-h)+(c-g)*(c-g)+(l-_)*(l-_);return(d-y)*(d-y)+(f-b)*(f-b)+(p-x)*(p-x)>S}function Ce(e,t,n,r,i){e[t]=n,e[t+1]=r,e[t+2]=r,e[t+3]=i,e[t+4]=i,e[t+5]=n}const we=15,Te=15,Ee=6;export{F as createPlanarGlobePatch,y as createSphericalGlobePatch,L as updateEdgeElevationsAndResolutionsPlanar,D as updateEdgeElevationsAndResolutionsSpherical,R as updateEdgesAndCornersPlanar,E as updateEdgesAndCornersSpherical};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o,set as s,positiveInfinity as c,equals as l}from"../../../../geometry/support/aaBoundingBox.js";import{InternalRenderCategory as u}from"../../webgl.js";import{addWraparound as d}from"../../layers/i3s/I3SUtil.js";import f from"../../webgl/RenderNode.js";import{canRenderGaussianSplats as p,requiresPreciseColorDepth as m,prepareGaussianSplatPerspectiveParameters as h}from"./GaussianSplatRenderUtils.js";import{G as g}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as _}from"../shaders/GaussianSplatCompositionTechnique.js";import{GaussianSplatCompositionTechniqueConfiguration as v}from"../shaders/GaussianSplatCompositionTechniqueConfiguration.js";import{G as y}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as b}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatPassParameters as x}from"../shaders/GaussianSplatPassParameters.js";import{GaussianSplatTechnique as S}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as C}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{ColorAttachment1 as w,DepthStencilAttachment as T,PrimitiveType as E}from"../../../webgl/enums.js";let D=class extends f{constructor(e){super(e),this.consumes={required:[u.GAUSSIAN_SPLAT]},this.produces=u.GAUSSIAN_SPLAT,this._slicePlaneEnabled=!1,this.layerView=null,this._passParameters=new x,this._compositionPassParameters=new g,this._depthCompositionPassParameters=new y,this._compositionConfiguration=new v,this._clipBox=o(),this._previousSortRequestCameraDirection=a(),this._cameraSortDirty=!1,this._tileCullingRevision=0,this._sortRequestDirectionEpsilon=.01,this._configuration=new C(e.view.state.isGlobal),s(this._clipBox,c)}async initialize(){this.addHandles([t(()=>this.view.state.camera,()=>this._onCameraChange()),t(()=>this.view.state.mode===2,e=>{e&&this._cameraSortDirty&&this._requestCameraSort(this.view.state.camera.ray.direction),this.requestRender(1)})])}precompile(){this._canRender&&(this._updateConfigurations(),this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=this.bindParameters.hasOpaqueEmission,this.techniques.precompile(S,this._configuration),this.techniques.precompile(_,this._compositionConfiguration),this.techniques.precompile(b))}render(){let e=this.input;if(this._updateConfigurations(),this._fadeHelper.updateForFrame(this.view.stage.renderView.renderer.renderContext.time),!this._canRender)return e;let t=e.getAttachment(w);this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=t!=null;let{fullWidth:n,fullHeight:r}=this.bindParameters.camera;this._prepareParameters();let i=this.renderingContext,a=this.fboCache,o=a.acquire(n,r,`gaussian color output`),s=e.getAttachment(T);o.attachDepth(s);let c=this.techniques.get(S,this._configuration);this._renderGaussianColorAndDepth(o,c);let l=a.acquire(n,r,this.produces);this._depthCompositionPassParameters.splatDepth=o.getTexture(w),l.attachDepth(e.getAttachment(T)),i.bindFramebuffer(l.fbo);let u=this.techniques.get(b);i.bindTechnique(u,this.bindParameters,this._depthCompositionPassParameters),i.screen.draw(),this._compositionPassParameters.color=e.getTexture(),this._compositionPassParameters.splatColor=o.getTexture(),t?(l.acquireColor(w,8,`emissive`),this._compositionPassParameters.emission=e.getTexture(w)):this._compositionPassParameters.emission=null,i.bindFramebuffer(l.fbo);let d=this.techniques.get(_,this._compositionConfiguration);return i.bindTechnique(d,this.bindParameters,this._compositionPassParameters),i.screen.draw(),o.release(),l}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this.requestRender(1))}set clippingBox(e){let t=e||c;this._hasSameClipBox(t)||(s(this._clipBox,t),this._tileCullingRevision=d(this._tileCullingRevision,1),this._data.requestSort(),this.requestRender(1))}get clippingBox(){return this._clippingEnabled?this._clipBox:null}get tileCullingRevision(){return this._tileCullingRevision}get _clippingEnabled(){return!l(this._clipBox,c,(e,t)=>e===t)}get _isIdle(){return this.view.state.mode===2}get _data(){return this.layerView.data}get _canRender(){return p(this._data)}get _fadeHelper(){return this.layerView.fadeHelper}_updateConfigurations(){this._configuration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._configuration.fadingEnabled=this._fadeHelper.fadingEnabled,this._configuration.receiveShadows=this.bindParameters.shadowMap.ready,this._configuration.fragmentShading=this._configuration.receiveShadows&&this.view.stage.renderer.isFeatureEnabled(12),this._configuration.preciseDepth=m(this.bindParameters),this._configuration.hasShadowHighlights=this._configuration.receiveShadows&&this.bindParameters.hasShadowHighlights,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this._slicePlaneEnabled&&this.bindParameters.slicePlane!=null}_onCameraChange(){this._tileCullingRevision=d(this._tileCullingRevision,1);let e=this.view.state.camera.ray.direction;this._cameraSortDirty=!0,(this._isIdle||this._shouldRequestSort(e))&&this._requestCameraSort(e)}_shouldRequestSort(e){return Math.abs(e[0]-this._previousSortRequestCameraDirection[0])>this._sortRequestDirectionEpsilon||Math.abs(e[1]-this._previousSortRequestCameraDirection[1])>this._sortRequestDirectionEpsilon||Math.abs(e[2]-this._previousSortRequestCameraDirection[2])>this._sortRequestDirectionEpsilon}_requestCameraSort(e){this._data.requestSort(),i(this._previousSortRequestCameraDirection,e),this._cameraSortDirty=!1}_prepareParameters(){h(this._passParameters,this.layerView,this.bindParameters.camera)}_hasSameClipBox(e){return l(this._clipBox,e,(e,t)=>e===t)}_renderGaussianColorAndDepth(e,t){let n=this.renderingContext;e.acquireColor(w,5,`gaussian depth output`),n.bindFramebuffer(e.fbo),n.setClearColor(0,0,0,0),n.clear(16384),this.renderingContext.bindTechnique(t,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(E.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}};e([n()],D.prototype,`consumes`,void 0),e([n()],D.prototype,`produces`,void 0),e([n({constructOnly:!0})],D.prototype,`layerView`,void 0),D=e([r(`esri.views.3d.webgl-engine.lib.GaussianSplatRenderer`)],D);export{D as GaussianSplatRenderer};
2
+ import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o,set as s,positiveInfinity as c,equals as l}from"../../../../geometry/support/aaBoundingBox.js";import{InternalRenderCategory as u}from"../../webgl.js";import{addWraparound as d}from"../../layers/i3s/I3SUtil.js";import f from"../../webgl/RenderNode.js";import{canRenderGaussianSplats as p,requiresPreciseColorDepth as m,prepareGaussianSplatPerspectiveParameters as h}from"./GaussianSplatRenderUtils.js";import{G as g}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as _}from"../shaders/GaussianSplatCompositionTechnique.js";import{GaussianSplatCompositionTechniqueConfiguration as v}from"../shaders/GaussianSplatCompositionTechniqueConfiguration.js";import{G as y}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as b}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatPassParameters as x}from"../shaders/GaussianSplatPassParameters.js";import{GaussianSplatTechnique as S}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as C}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{ColorAttachment1 as w,DepthStencilAttachment as T,PrimitiveType as E}from"../../../webgl/enums.js";let D=class extends f{constructor(e){super(e),this.consumes={required:[u.GAUSSIAN_SPLAT]},this.produces=u.GAUSSIAN_SPLAT,this._slicePlaneEnabled=!1,this.layerView=null,this._passParameters=new x,this._compositionPassParameters=new g,this._depthCompositionPassParameters=new y,this._compositionConfiguration=new v,this._clipBox=o(),this._previousSortRequestCameraDirection=a(),this._cameraSortDirty=!1,this._tileCullingRevision=0,this._sortRequestDirectionEpsilon=.01,this._configuration=new C(e.view.state.isGlobal),s(this._clipBox,c)}async initialize(){this.addHandles([t(()=>this.view.state.camera,()=>this._onCameraChange()),t(()=>this.view.state.mode===2,e=>{e&&this._cameraSortDirty&&this._requestCameraSort(this.view.state.camera.ray.direction),this.requestRender(1)})])}precompile(){this._canRender&&(this._updateConfigurations(),this.techniques.precompile(S,this._configuration),this.techniques.precompile(_,this._compositionConfiguration),this.techniques.precompile(b))}render(){let e=this.input;if(this._fadeHelper.updateForFrame(this.view.stage.renderView.renderer.renderContext.time),!this._canRender)return e;let t=e.getAttachment(w);this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=t!=null;let{fullWidth:n,fullHeight:r}=this.bindParameters.camera;this._prepareParameters();let i=this.renderingContext,a=this.fboCache,o=a.acquire(n,r,`gaussian color output`),s=e.getAttachment(T);o.attachDepth(s);let c=this.techniques.get(S,this._configuration);this._renderGaussianColorAndDepth(o,c);let l=a.acquire(n,r,this.produces);this._depthCompositionPassParameters.splatDepth=o.getTexture(w),l.attachDepth(e.getAttachment(T)),i.bindFramebuffer(l.fbo);let u=this.techniques.get(b);i.bindTechnique(u,this.bindParameters,this._depthCompositionPassParameters),i.screen.draw(),this._compositionPassParameters.color=e.getTexture(),this._compositionPassParameters.splatColor=o.getTexture(),t?(l.acquireColor(w,8,`emissive`),this._compositionPassParameters.emission=e.getTexture(w)):this._compositionPassParameters.emission=null,i.bindFramebuffer(l.fbo);let d=this.techniques.get(_,this._compositionConfiguration);return i.bindTechnique(d,this.bindParameters,this._compositionPassParameters),i.screen.draw(),o.release(),l}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this.requestRender(1))}set clippingBox(e){let t=e||c;this._hasSameClipBox(t)||(s(this._clipBox,t),this._tileCullingRevision=d(this._tileCullingRevision,1),this._data.requestSort(),this.requestRender(1))}get clippingBox(){return this._clippingEnabled?this._clipBox:null}get tileCullingRevision(){return this._tileCullingRevision}get _clippingEnabled(){return!l(this._clipBox,c,(e,t)=>e===t)}get _isIdle(){return this.view.state.mode===2}get _data(){return this.layerView.data}get _canRender(){return p(this._data)}get _fadeHelper(){return this.layerView.fadeHelper}_updateConfigurations(){this._configuration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._configuration.fadingEnabled=this._fadeHelper.fadingEnabled,this._configuration.receiveShadows=this.bindParameters.shadowMap.ready,this._configuration.fragmentShading=this._configuration.receiveShadows&&this.view.stage.renderer.isFeatureEnabled(12),this._configuration.preciseDepth=m(this.bindParameters),this._configuration.hasShadowHighlights=this._configuration.receiveShadows&&this.bindParameters.hasShadowHighlights,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this._slicePlaneEnabled&&this.bindParameters.slicePlane!=null,this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=this.bindParameters.hasOpaqueEmission}_onCameraChange(){this._tileCullingRevision=d(this._tileCullingRevision,1);let e=this.view.state.camera.ray.direction;this._cameraSortDirty=!0,(this._isIdle||this._shouldRequestSort(e))&&this._requestCameraSort(e)}_shouldRequestSort(e){return Math.abs(e[0]-this._previousSortRequestCameraDirection[0])>this._sortRequestDirectionEpsilon||Math.abs(e[1]-this._previousSortRequestCameraDirection[1])>this._sortRequestDirectionEpsilon||Math.abs(e[2]-this._previousSortRequestCameraDirection[2])>this._sortRequestDirectionEpsilon}_requestCameraSort(e){this._data.requestSort(),i(this._previousSortRequestCameraDirection,e),this._cameraSortDirty=!1}_prepareParameters(){h(this._passParameters,this.layerView,this.bindParameters.camera)}_hasSameClipBox(e){return l(this._clipBox,e,(e,t)=>e===t)}_renderGaussianColorAndDepth(e,t){let n=this.renderingContext;e.acquireColor(w,5,`gaussian depth output`),n.bindFramebuffer(e.fbo),n.setClearColor(0,0,0,0),n.clear(16384),this.renderingContext.bindTechnique(t,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(E.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}};e([n()],D.prototype,`consumes`,void 0),e([n()],D.prototype,`produces`,void 0),e([n({constructOnly:!0})],D.prototype,`layerView`,void 0),D=e([r(`esri.views.3d.webgl-engine.lib.GaussianSplatRenderer`)],D);export{D as GaussianSplatRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{VisualVariablesParameters as e}from"../../layers/support/FastSymbolUpdates.js";import{isColor as t}from"../core/shaderLibrary/ShaderOutput.js";import{computeAttachmentOriginLines as n}from"./geometryDataUtils.js";import{Material as r}from"./Material.js";import{hasShadowHighlights as i}from"../shaders/ReceiveShadowsConfiguration.js";class a extends e{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.shadingEnabled=!1,this.isDecoration=!1,this.worldSized=!1}}class o extends r{constructor(){super(...arguments),this.primitiveVertexCount=1}updateConfiguration(e){super.updateConfiguration(e),this._configuration.pbrMode=this.parameters.shadingEnabled?2:0,this._configuration.draped=e.slot===18,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.worldSized=this.parameters.worldSized,this._configuration.emissionSource=+!!this.emissions,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=this.parameters.renderOccluded===8,t(e.output)&&this.parameters.shadingEnabled?(this._configuration.receiveShadows=e.shadowMap.enabled,this._configuration.hasShadowHighlights=i(this._configuration,e),this._configuration.receiveAmbientOcclusion=e.ssao!=null,this._configuration.receiveGlobalIllumination=e.globalIlluminationEnabled):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=this._configuration.receiveGlobalIllumination=!1}computeAttachmentOrigin(e,t,r){return n(e,t,r,this._isClosed(r))}_isClosed(e){return(this.parameters.isClosed??!1)&&e>2}}export{o as LineMaterial,a as LineMaterialParameters};
2
+ import{VisualVariablesParameters as e}from"../../layers/support/FastSymbolUpdates.js";import{computeAttachmentOriginLines as t}from"./geometryDataUtils.js";import{Material as n}from"./Material.js";import{configureShadedMaterial as r}from"../shaders/ShadedMaterialConfiguration.js";class i extends e{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.shadingEnabled=!1,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.isDecoration=!1,this.worldSized=!1}}class a extends n{constructor(){super(...arguments),this.primitiveVertexCount=1}updateConfiguration(e){super.updateConfiguration(e),this._configuration.pbrMode=this.parameters.shadingEnabled?2:0,this._configuration.draped=e.slot===18,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.worldSized=this.parameters.worldSized,this._configuration.emissionSource=+!!this.emissions,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=this.parameters.renderOccluded===8,r(this._configuration,e,this.parameters)}computeAttachmentOrigin(e,n,r){return t(e,n,r,this._isClosed(r))}_isClosed(e){return(this.parameters.isClosed??!1)&&e>2}}export{a as LineMaterial,i as LineMaterialParameters};
@@ -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{estimateNumberArrayMemory as t}from"../../../../core/memoryEstimations.js";import{isFloat32Array as n}from"../../../../core/typedArrayUtil.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as i,copy as a,nan as o,fromValues as s}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as c}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{intersectsTransformedAabb as u}from"../../../../geometry/support/frustumPlanes.js";import{newContinuousIndexArray as d}from"../../../../geometry/support/Indices.js";import{createPositionReader as f}from"./PositionReader.js";import{MeshIntersectionOptions as p,intersectRayTriangles as m}from"./RayIntersections.js";import{forEachTriangleRangeScreenPolygonHit as h}from"./screenPolygonTriangleIntersections.js";const g=1e-6;class _{constructor(t,n,i){this.globalTriangleVertexIndices=t,this.numTriangles=n,this.positions=i,this._rayDirection=r(),this._callback=T,this._intersectionOptions=w,this._screenPolygonCallback=E,this._screenPolygonDisplacement=null,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this.bspNodeTree=[],this.triangleIndexMap=d(n),this._readPosition=f(i.data,t,i.stride);let a=S(t,n,i.data,i.stride);if(this._rootAabb=b(this.triangleIndexMap,a,0,n),n<=40)return;let o=e(Math.log2(n/40),2,10),s=(e,t,n,r)=>{let i=t-e,{axis:c,midValue:l}=x(r),u=y(this.triangleIndexMap,a,e,t,c,l),d=(e,t,r)=>{if(n>o)return;let a=t-e;if(!(a<=40)&&!(a>=.8*i))return s(e,t,n+1,r)},f=b(this.triangleIndexMap,a,e,u.next),p=b(this.triangleIndexMap,a,u.next,u.mid),m=b(this.triangleIndexMap,a,u.mid,t),h=new v(f,p,m,c,l,u.next,u.mid);return this.bspNodeTree.push(h),h.leftNode=d(e,u.next,f),h.rightNode=d(u.mid,t,m),h};s(0,n,0,this._rootAabb)}intersectRayTriangleRange(e,t){if(e>=t)return;let{data:n,stride:r}=this.positions;m(this._rayFrom,this._rayDirection,e,t,this.globalTriangleVertexIndices,n,r,this._intersectionOptions.normalRequired,this._callback,this.triangleIndexMap),_.numFacesTested+=t-e}forEachScreenPolygonHit(e,t,n,r,i){e.camera!=null&&(this._screenPolygonIntersector=e,this._screenPolygonTransformation=t,this._screenPolygonQuery=n,this._screenPolygonDisplacement=r,this._screenPolygonCallback=i,this._intersectScreenPolygonBSP(this.bspNodeTree[0],0,this.triangleIndexMap.length),this._screenPolygonCallback=E,this._screenPolygonDisplacement=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._screenPolygonIntersector=null)}intersectRay(e,t,n,r){_.numFacesTested=0;let i=e,a=t,o=a[0]-i[0],s=a[1]-i[1],c=a[2]-i[2];if(o*o+s*s+c*c<g)return;this._rayFrom=i;let l=this._rayDirection;l[0]=o,l[1]=s,l[2]=c;let u=this.triangleIndexMap.length;this._callback=r,this._intersectionOptions=n;let d=this.bspNodeTree[0];d===void 0?C(this._rootAabb,i,l)&&this.intersectRayTriangleRange(0,u):this.intersectRayBSP(d,0,u),this._callback=T,this._intersectionOptions=w}intersectRayBSP(e,t,n){let r=this._rayFrom,i=this._rayDirection;this._traverseBSP(e,t,n,e=>C(e,r,i),e=>{let t=e.axis;return r[t]<e.d||i[t]<0},e=>{let t=e.axis;return r[t]>e.d||i[t]>0},(e,t)=>this.intersectRayTriangleRange(e,t))}_intersectScreenPolygonTriangleRange(e,t){if(e>=t)return;let n=this._screenPolygonIntersector,r=this._screenPolygonQuery;if(n!=null&&r!=null)for(let i of h(n,this._screenPolygonTransformation,r,e,t,this._readPosition,this._screenPolygonDisplacement,this.triangleIndexMap))this._screenPolygonCallback(i.distance,i.primitiveIndex,i.point)}_intersectScreenPolygonBSP(e,t,n){let r=this._screenPolygonIntersector,i=this._screenPolygonQuery;r?.camera!=null&&i!=null&&(e===void 0?this._nodeIntersectsScreenPolygonBroadPhase(this._rootAabb)&&this._intersectScreenPolygonTriangleRange(t,n):this._traverseBSP(e,t,n,e=>this._nodeIntersectsScreenPolygonBroadPhase(e),()=>!0,()=>!0,(e,t)=>this._intersectScreenPolygonTriangleRange(e,t)))}_traverseBSP(e,t,n,r,i,a,o){if(!r(this._rootAabb))return;let s=[{node:e,rangeStart:t,rangeEnd:n}];for(;s.length>0;){let{node:e,rangeStart:t,rangeEnd:n}=s.pop();i(e)&&this._traverseBSPRange(s,e.leftNode,e.leftAabb,t,e.midStartIndex,r,o),e.midStartIndex<e.rightStartIndex&&r(e.middleAabb)&&o(e.midStartIndex,e.rightStartIndex),a(e)&&this._traverseBSPRange(s,e.rightNode,e.rightAabb,e.rightStartIndex,n,r,o)}}_traverseBSPRange(e,t,n,r,i,a,o){r>=i||!a(n)||(t===void 0?o(r,i):e.push({node:t,rangeStart:r,rangeEnd:i}))}_nodeIntersectsScreenPolygonBroadPhase(e){let t=this._screenPolygonQuery;if(t==null)return!1;let n=this._screenPolygonDisplacement,r=n?n.applyToAabb(a(D,e)):e;return u(t.broadPhaseFrustum,r,this._screenPolygonTransformation)}static{this.numFacesTested=0}get estimatedMemoryUsage(){return t(this.triangleIndexMap)}}class v{constructor(e,t,n,r,i,a,o){this.leftAabb=e,this.middleAabb=t,this.rightAabb=n,this.axis=r,this.d=i,this.midStartIndex=a,this.rightStartIndex=o}}function y(e,t,n,r,i,a){let o=i+3,s=n,c=n,l=r;for(;c<l;){let n=e[c],r=n*6;t[r+o]<=a?(e[c]=e[s],e[s]=n,++s,++c):t[r+i]>=a?(--l,e[c]=e[l],e[l]=n):++c}return{next:s,mid:l}}function b(e,t,n,r){if(r<=n)return o;let i=e[n]*6,a=t[i++],c=t[i++],l=t[i++],u=t[i++],d=t[i++],f=t[i];for(let o=n+1;o<r;++o)i=e[o]*6,a=Math.min(a,t[i++]),c=Math.min(c,t[i++]),l=Math.min(l,t[i++]),u=Math.max(u,t[i++]),d=Math.max(d,t[i++]),f=Math.max(f,t[i]);return s(a,c,l,u,d,f)}function x(e){let t=e[3]-e[0],n=e[4]-e[1],r=e[5]-e[2],i=t>n?t>r?0:n>r?1:2:n>r?1:r>t?2:0;return{axis:i,midValue:(e[i]+e[i+3])/2}}function S(e,t,r,i){let a=n(r)?l(t*6,!0):c(t*6);for(let n=0;n<t;++n){let t=3*n,o=e[t]*i,s=e[t+1]*i,c=e[t+2]*i;for(let e=0;e<3;++e){let t=r[o+e],i=r[s+e],l=r[c+e];a[n*6+e]=Math.min(t,i,l),a[n*6+3+e]=Math.max(t,i,l)}}return a}function C(e,t,n){let r=t,i=n,a=0,o=1/0;for(let t=0;t<3;++t){{let n=e[t];if(r[t]<n){if(i[t]<=g)return!1;let e=(n-r[t])/i[t];a=Math.max(a,e)}else if(i[t]<=-1e-6){let e=(n-r[t])/i[t];o=Math.min(o,e)}if(a>o)return!1}{let n=e[t+3];if(r[t]>n){if(i[t]>=-1e-6)return!1;let e=(n-r[t])/i[t];a=Math.max(a,e)}else if(i[t]>=g){let e=(n-r[t])/i[t];o=Math.min(o,e)}if(a>o)return!1}}return!0}const w=new p,T=()=>{},E=()=>{},D=i();export{_ as TriangleIntersectionData};
2
+ import{clamp as e}from"../../../../core/mathUtils.js";import{estimateNumberArrayMemory as t}from"../../../../core/memoryEstimations.js";import{isFloat32Array as n}from"../../../../core/typedArrayUtil.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as i,copy as a,nan as o,fromValues as s,empty as c}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as l}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{intersectsTransformedAabb as d}from"../../../../geometry/support/frustumPlanes.js";import{newContinuousIndexArray as f}from"../../../../geometry/support/Indices.js";import{createPositionReader as p}from"./PositionReader.js";import{MeshIntersectionOptions as m,intersectRayTriangles as h}from"./RayIntersections.js";import{forEachTriangleRangeScreenPolygonHit as g}from"./screenPolygonTriangleIntersections.js";const _=1e-6;class v{constructor(t,n,i){this.globalTriangleVertexIndices=t,this.numTriangles=n,this.positions=i,this._rayDirection=r(),this._callback=E,this._intersectionOptions=T,this._screenPolygonCallback=D,this._screenPolygonDisplacement=null,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this.bspNodeTree=[],this.triangleIndexMap=f(n),this._readPosition=p(i.data,t,i.stride);let a=C(t,n,i.data,i.stride);if(this._rootAabb=x(this.triangleIndexMap,a,0,n),n<=40)return;let o=e(Math.log2(n/40),2,10),s=(e,t,n,r)=>{let i=t-e,{axis:c,midValue:l}=S(r),u=b(this.triangleIndexMap,a,e,t,c,l),d=(e,t,r)=>{if(n>o)return;let a=t-e;if(!(a<=40)&&!(a>=.8*i))return s(e,t,n+1,r)},{leftAabb:f,middleAabb:p,rightAabb:m}=u,h=new y(f,p,m,c,l,u.next,u.mid);return this.bspNodeTree.push(h),h.leftNode=d(e,u.next,f),h.rightNode=d(u.mid,t,m),h};s(0,n,0,this._rootAabb)}intersectRayTriangleRange(e,t){if(e>=t)return;let{data:n,stride:r}=this.positions;h(this._rayFrom,this._rayDirection,e,t,this.globalTriangleVertexIndices,n,r,this._intersectionOptions.normalRequired,this._callback,this.triangleIndexMap),v.numFacesTested+=t-e}forEachScreenPolygonHit(e,t,n,r,i){e.camera!=null&&(this._screenPolygonIntersector=e,this._screenPolygonTransformation=t,this._screenPolygonQuery=n,this._screenPolygonDisplacement=r,this._screenPolygonCallback=i,this._intersectScreenPolygonBSP(this.bspNodeTree[0],0,this.triangleIndexMap.length),this._screenPolygonCallback=D,this._screenPolygonDisplacement=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._screenPolygonIntersector=null)}intersectRay(e,t,n,r){v.numFacesTested=0;let i=e,a=t,o=a[0]-i[0],s=a[1]-i[1],c=a[2]-i[2];if(o*o+s*s+c*c<_)return;this._rayFrom=i;let l=this._rayDirection;l[0]=o,l[1]=s,l[2]=c;let u=this.triangleIndexMap.length;this._callback=r,this._intersectionOptions=n;let d=this.bspNodeTree[0];d===void 0?w(this._rootAabb,i,l)&&this.intersectRayTriangleRange(0,u):this.intersectRayBSP(d,0,u),this._callback=E,this._intersectionOptions=T}intersectRayBSP(e,t,n){let r=this._rayFrom,i=this._rayDirection;this._traverseBSP(e,t,n,e=>w(e,r,i),e=>{let t=e.axis;return r[t]<e.d||i[t]<0},e=>{let t=e.axis;return r[t]>e.d||i[t]>0},(e,t)=>this.intersectRayTriangleRange(e,t))}_intersectScreenPolygonTriangleRange(e,t){if(e>=t)return;let n=this._screenPolygonIntersector,r=this._screenPolygonQuery;if(n!=null&&r!=null)for(let i of g(n,this._screenPolygonTransformation,r,e,t,this._readPosition,this._screenPolygonDisplacement,this.triangleIndexMap))this._screenPolygonCallback(i.distance,i.primitiveIndex,i.point)}_intersectScreenPolygonBSP(e,t,n){let r=this._screenPolygonIntersector,i=this._screenPolygonQuery;r?.camera!=null&&i!=null&&(e===void 0?this._nodeIntersectsScreenPolygonBroadPhase(this._rootAabb)&&this._intersectScreenPolygonTriangleRange(t,n):this._traverseBSP(e,t,n,e=>this._nodeIntersectsScreenPolygonBroadPhase(e),()=>!0,()=>!0,(e,t)=>this._intersectScreenPolygonTriangleRange(e,t)))}_traverseBSP(e,t,n,r,i,a,o){if(!r(this._rootAabb))return;let s=[{node:e,rangeStart:t,rangeEnd:n}];for(;s.length>0;){let{node:e,rangeStart:t,rangeEnd:n}=s.pop();i(e)&&this._traverseBSPRange(s,e.leftNode,e.leftAabb,t,e.midStartIndex,r,o),e.midStartIndex<e.rightStartIndex&&r(e.middleAabb)&&o(e.midStartIndex,e.rightStartIndex),a(e)&&this._traverseBSPRange(s,e.rightNode,e.rightAabb,e.rightStartIndex,n,r,o)}}_traverseBSPRange(e,t,n,r,i,a,o){r>=i||!a(n)||(t===void 0?o(r,i):e.push({node:t,rangeStart:r,rangeEnd:i}))}_nodeIntersectsScreenPolygonBroadPhase(e){let t=this._screenPolygonQuery;if(t==null)return!1;let n=this._screenPolygonDisplacement,r=n?n.applyToAabb(a(O,e)):e;return d(t.broadPhaseFrustum,r,this._screenPolygonTransformation)}static{this.numFacesTested=0}get estimatedMemoryUsage(){return t(this.triangleIndexMap)}}class y{constructor(e,t,n,r,i,a,o){this.leftAabb=e,this.middleAabb=t,this.rightAabb=n,this.axis=r,this.d=i,this.midStartIndex=a,this.rightStartIndex=o}}function b(e,t,n,r,i,a){let s=i+3,l=c(),u=c(),d=c(),f=n,p=n,m=r;for(;p<m;){let n=e[p],r=n*6,o=t[r+s],c;o<=a?(c=l,e[p]=e[f],e[f]=n,++f,++p):t[r+i]>=a?(c=d,--m,e[p]=e[m],e[m]=n):(c=u,++p),c[0]=Math.min(c[0],t[r]),c[1]=Math.min(c[1],t[r+1]),c[2]=Math.min(c[2],t[r+2]),c[3]=Math.max(c[3],t[r+3]),c[4]=Math.max(c[4],t[r+4]),c[5]=Math.max(c[5],t[r+5])}return{next:f,mid:m,leftAabb:n<f?l:o,middleAabb:f<m?u:o,rightAabb:m<r?d:o}}function x(e,t,n,r){if(r<=n)return o;let i=e[n]*6,a=t[i++],c=t[i++],l=t[i++],u=t[i++],d=t[i++],f=t[i];for(let o=n+1;o<r;++o)i=e[o]*6,a=Math.min(a,t[i++]),c=Math.min(c,t[i++]),l=Math.min(l,t[i++]),u=Math.max(u,t[i++]),d=Math.max(d,t[i++]),f=Math.max(f,t[i]);return s(a,c,l,u,d,f)}function S(e){let t=e[3]-e[0],n=e[4]-e[1],r=e[5]-e[2],i=t>n?t>r?0:n>r?1:2:n>r?1:r>t?2:0;return{axis:i,midValue:(e[i]+e[i+3])/2}}function C(e,t,r,i){let a=n(r)?u(t*6,!0):l(t*6);for(let n=0;n<t;++n){let t=3*n,o=e[t]*i,s=e[t+1]*i,c=e[t+2]*i;for(let e=0;e<3;++e){let t=r[o+e],i=r[s+e],l=r[c+e];a[n*6+e]=Math.min(t,i,l),a[n*6+3+e]=Math.max(t,i,l)}}return a}function w(e,t,n){let r=t,i=n,a=0,o=1/0;for(let t=0;t<3;++t){{let n=e[t];if(r[t]<n){if(i[t]<=_)return!1;let e=(n-r[t])/i[t];a=Math.max(a,e)}else if(i[t]<=-1e-6){let e=(n-r[t])/i[t];o=Math.min(o,e)}if(a>o)return!1}{let n=e[t+3];if(r[t]>n){if(i[t]>=-1e-6)return!1;let e=(n-r[t])/i[t];a=Math.max(a,e)}else if(i[t]>=_){let e=(n-r[t])/i[t];o=Math.min(o,e)}if(a>o)return!1}}return!0}const T=new m,E=()=>{},D=()=>{},O=i();export{v as TriangleIntersectionData};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{exactEquals as e,subtract as t,add as n,set as r,copy as i,normalize as a,length as o,scale as s,dot as c,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as d,fromValues as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as p,getMin as m,setMax as h,getMax as g}from"../../../../geometry/support/aaBoundingBox.js";import{is3DGeometryOrShadowLike as _,isColor as v}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as y}from"../lib/GLTextureMaterial.js";import{Material as b}from"../lib/Material.js";import{intersectTriangleGeometry as x}from"../lib/RayIntersections.js";import{intersectTriangleGeometryWithScreenPolygon as S}from"../lib/screenPolygonTriangleIntersections.js";import{getVerticalOffsetObject3D as C}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as w}from"./DefaultBufferWriter.js";import{intersectWithPolygonOffset as T,applyPolygonOffsetToHit as E}from"./intersectWithPolygonOffset.js";import{verticalOffsetAtDistance as D}from"./internal/MaterialUtil.js";import{getLayout as O,DefaultMaterialPassParameters as k,DefaultMaterialTechnique as A}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as j}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as M}from"../shaders/RealisticTreeTechnique.js";import{hasShadowHighlights as N}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as P}from"../../../../webscene/support/AlphaCutoff.js";class F extends b{constructor(e,t){super(e,L),this.materialType=`default`,this.supportsEdges=!0,this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this.produces=new Map([[2,e=>_(e)&&!this.transparent],[4,e=>_(e)&&this.transparent]]),this._layout=O(this.parameters),this._configuration=new j(t.spherical)}isVisibleForOutput(e){return e===5||e===7||e===6?this.parameters.castShadows:!0}get visible(){let{layerOpacity:e,colorMixMode:t,opacity:n,externalColor:r}=this.parameters,i=t===`replace`?1:n,a=t===`ignore`||isNaN(r[3])?1:r[3];return e*i*a>=P}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get emissions(){return this.parameters.emissiveStrength>0&&(this.parameters.emissiveSource===0&&this._hasEmissiveBase||this.parameters.emissiveSource===1)?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e);let{parameters:t,_configuration:n}=this;n.hasNormalTexture=t.hasNormalTexture,n.hasColorTexture=t.hasColorTexture,n.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,n.hasOcclusionTexture=t.hasOcclusionTexture;let{treeRendering:r,doubleSided:i,doubleSidedType:a}=t;n.hasVertexTangents=!r&&t.hasVertexTangents,n.instanced=t.instanced,n.instancedDoublePrecision=t.instancedDoublePrecision,n.hasVVColor=!!t.vvColor,n.hasVVSize=!!t.vvSize,n.hasVerticalOffset=t.verticalOffset!=null,n.hasScreenSizePerspective=t.screenSizePerspective!=null,n.hasSlicePlane=t.hasSlicePlane,n.alphaDiscardMode=t.textureAlphaMode,n.normalType=r?0:t.normalType,n.transparent=this.transparent,n.enableOITOffset=e.enableOITOffset,n.customDepthTest=t.customDepthTest??0,n.hasOccludees=e.hasOccludees,n.cullFace=t.hasSlicePlane?0:t.cullFace,n.hasModelTransformation=!r&&t.modelTransformation!=null,n.hasVertexColors=t.hasVertexColors,n.hasSymbolColors=t.hasSymbolColors,n.doubleSidedMode=r?2:i&&a===`normal`?1:i&&a===`winding-order`?2:0,n.instancedFeatureAttribute=t.instancedFeatureAttribute,n.instancedColor=t.instancedColor,v(e.output)?(n.receiveShadows=t.receiveShadows,n.hasShadowHighlights=N(n,e),n.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&e.ssao!=null,n.receiveGlobalIllumination=t.receiveAmbientOcclusion&&e.globalIlluminationEnabled):n.receiveShadows=n.hasShadowHighlights=n.receiveAmbientOcclusion=n.receiveGlobalIllumination=!1,n.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,n.pbrMode=t.usePBR?t.unlit?7:t.isSchematic?2:1:0,n.emissionSource=t.emissionSource,n.offsetBackfaces=!!(this.transparent&&t.offsetTransparentBackfaces),n.snowCover=e.snowCover>0,n.hasColorTextureTransform=!!t.colorTextureTransformMatrix,n.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,n.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,n.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,n.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersectRay(e,n,r,i,a,o){let s=this._getMaterialVerticalOffset(n,r);s!=null&&(i=t(R,i,s),a=t(z,a,s)),o=T(o,this._configuration,i,a),x(e,r,i,a,C(r.verticalOffset),o)}intersectScreenPolygon(e,t,n,r){return E(S(e,n,t,r,this._createScreenPolygonVertexDisplacement(t,n)),this._configuration,n.camera.eye)}createGLMaterial(e){return new I(e)}createBufferWriter(){return new w(this._layout)}get transparent(){let{drivenOpacity:e,opacity:t,externalColor:n,layerOpacity:r,texture:i,textureId:a,textureAlphaMode:o,colorMixMode:s}=this.parameters,c=n[3];return e||t<1&&s!==`replace`||c<1&&s!==`ignore`||r<1||(i!=null||a!=null)&&o!==1&&o!==2&&s!==`replace`}_createScreenPolygonVertexDisplacement(e,t){let r=this._getMaterialVerticalOffset(e,t);return r==null?null:{applyToVertex:(e,t,n,i)=>(e[0]=t+r[0],e[1]=n+r[1],e[2]=i+r[2],e),applyToAabb:e=>(p(e,n(G,m(e,G),r)),h(e,n(G,g(e,G),r)),e)}}_getMaterialVerticalOffset(e,n){if(this.parameters.verticalOffset==null)return null;let u=n.camera;r(H,e[12],e[13],e[14]);let d=null;switch(n.viewingMode){case 1:d=a(V,H);break;case 2:d=i(V,B)}let f=t(U,H,u.eye),p=o(f),m=s(f,f,1/p),h=null;this.parameters.screenSizePerspective&&(h=c(d,m));let g=D(u,p,this.parameters.verticalOffset,h??0,this.parameters.screenSizePerspective,null);return s(d,d,g),l(W,d,n.transform.inverseRotation)}}class I extends y{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});let t=this._material.parameters;this.updateTexture(t.textureId);let n=e.camera.viewInverseTransposeMatrix;return r(t.origin,n[3],n[7],n[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?M:A,e)}}class L extends k{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1,this.unlit=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissionSource(){return this.emissiveTextureId!=null&&this.emissiveSource===0?3:this.emissiveSource===0?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||this.emissionSource===3||this.hasOcclusionTexture}}const R=d(),z=d(),B=f(0,0,1),V=d(),H=d(),U=d(),W=d(),G=d();export{I as DefaultGLMaterial,F as DefaultMaterial,L as DefaultMaterialParameters};
2
+ import{exactEquals as e,subtract as t,add as n,set as r,copy as i,normalize as a,length as o,scale as s,dot as c,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as d,fromValues as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as p,getMin as m,setMax as h,getMax as g}from"../../../../geometry/support/aaBoundingBox.js";import{is3DGeometryOrShadowLike as _}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as v}from"../lib/GLTextureMaterial.js";import{Material as y}from"../lib/Material.js";import{intersectTriangleGeometry as b}from"../lib/RayIntersections.js";import{intersectTriangleGeometryWithScreenPolygon as x}from"../lib/screenPolygonTriangleIntersections.js";import{getVerticalOffsetObject3D as S}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as C}from"./DefaultBufferWriter.js";import{intersectWithPolygonOffset as w,applyPolygonOffsetToHit as T}from"./intersectWithPolygonOffset.js";import{verticalOffsetAtDistance as E}from"./internal/MaterialUtil.js";import{getLayout as D,DefaultMaterialPassParameters as O,DefaultMaterialTechnique as k}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as A}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as j}from"../shaders/RealisticTreeTechnique.js";import{configureShadedMaterial as M}from"../shaders/ShadedMaterialConfiguration.js";import{alphaCutoff as N}from"../../../../webscene/support/AlphaCutoff.js";class P extends y{constructor(e,t){super(e,I),this.materialType=`default`,this.supportsEdges=!0,this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this.produces=new Map([[2,e=>_(e)&&!this.transparent],[4,e=>_(e)&&this.transparent]]),this._layout=D(this.parameters),this._configuration=new A(t.spherical)}isVisibleForOutput(e){return e===5||e===7||e===6?this.parameters.castShadows:!0}get visible(){let{layerOpacity:e,colorMixMode:t,opacity:n,externalColor:r}=this.parameters,i=t===`replace`?1:n,a=t===`ignore`||isNaN(r[3])?1:r[3];return e*i*a>=N}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get emissions(){return this.parameters.emissiveStrength>0&&(this.parameters.emissiveSource===0&&this._hasEmissiveBase||this.parameters.emissiveSource===1)?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e);let{parameters:t,_configuration:n}=this;n.hasNormalTexture=t.hasNormalTexture,n.hasColorTexture=t.hasColorTexture,n.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,n.hasOcclusionTexture=t.hasOcclusionTexture;let{treeRendering:r,doubleSided:i,doubleSidedType:a}=t;n.hasVertexTangents=!r&&t.hasVertexTangents,n.instanced=t.instanced,n.instancedDoublePrecision=t.instancedDoublePrecision,n.hasVVColor=!!t.vvColor,n.hasVVSize=!!t.vvSize,n.hasVerticalOffset=t.verticalOffset!=null,n.hasScreenSizePerspective=t.screenSizePerspective!=null,n.hasSlicePlane=t.hasSlicePlane,n.alphaDiscardMode=t.textureAlphaMode,n.normalType=r?0:t.normalType,n.transparent=this.transparent,n.enableOITOffset=e.enableOITOffset,n.customDepthTest=t.customDepthTest??0,n.hasOccludees=e.hasOccludees,n.cullFace=t.hasSlicePlane?0:t.cullFace,n.hasModelTransformation=!r&&t.modelTransformation!=null,n.hasVertexColors=t.hasVertexColors,n.hasSymbolColors=t.hasSymbolColors,n.doubleSidedMode=r?2:i&&a===`normal`?1:i&&a===`winding-order`?2:0,n.instancedFeatureAttribute=t.instancedFeatureAttribute,n.instancedColor=t.instancedColor,M(n,e,t),n.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,n.pbrMode=t.usePBR?t.unlit?7:t.isSchematic?2:1:0,n.emissionSource=t.emissionSource,n.offsetBackfaces=!!(this.transparent&&t.offsetTransparentBackfaces),n.snowCover=e.snowCover>0,n.hasColorTextureTransform=!!t.colorTextureTransformMatrix,n.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,n.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,n.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,n.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersectRay(e,n,r,i,a,o){let s=this._getMaterialVerticalOffset(n,r);s!=null&&(i=t(L,i,s),a=t(R,a,s)),o=w(o,this._configuration,i,a),b(e,r,i,a,S(r.verticalOffset),o)}intersectScreenPolygon(e,t,n,r){return T(x(e,n,t,r,this._createScreenPolygonVertexDisplacement(t,n)),this._configuration,n.camera.eye)}createGLMaterial(e){return new F(e)}createBufferWriter(){return new C(this._layout)}get transparent(){let{drivenOpacity:e,opacity:t,externalColor:n,layerOpacity:r,texture:i,textureId:a,textureAlphaMode:o,colorMixMode:s}=this.parameters,c=n[3];return e||t<1&&s!==`replace`||c<1&&s!==`ignore`||r<1||(i!=null||a!=null)&&o!==1&&o!==2&&s!==`replace`}_createScreenPolygonVertexDisplacement(e,t){let r=this._getMaterialVerticalOffset(e,t);return r==null?null:{applyToVertex:(e,t,n,i)=>(e[0]=t+r[0],e[1]=n+r[1],e[2]=i+r[2],e),applyToAabb:e=>(p(e,n(W,m(e,W),r)),h(e,n(W,g(e,W),r)),e)}}_getMaterialVerticalOffset(e,n){if(this.parameters.verticalOffset==null)return null;let u=n.camera;r(V,e[12],e[13],e[14]);let d=null;switch(n.viewingMode){case 1:d=a(B,V);break;case 2:d=i(B,z)}let f=t(H,V,u.eye),p=o(f),m=s(f,f,1/p),h=null;this.parameters.screenSizePerspective&&(h=c(d,m));let g=E(u,p,this.parameters.verticalOffset,h??0,this.parameters.screenSizePerspective,null);return s(d,d,g),l(U,d,n.transform.inverseRotation)}}class F extends v{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});let t=this._material.parameters;this.updateTexture(t.textureId);let n=e.camera.viewInverseTransposeMatrix;return r(t.origin,n[3],n[7],n[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?j:k,e)}}class I extends O{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1,this.unlit=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissionSource(){return this.emissiveTextureId!=null&&this.emissiveSource===0?3:this.emissiveSource===0?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||this.emissionSource===3||this.hasOcclusionTexture}}const L=d(),R=d(),z=f(0,0,1),B=d(),V=d(),H=d(),U=d(),W=d();export{F as DefaultGLMaterial,P as DefaultMaterial,I as DefaultMaterialParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{BufferViewVec3f as e}from"../../../../geometry/support/buffer/BufferView.js";import{isColor as t,isDepth as n,isColorHighlightOLIDOrDepth as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{LineMaterial as a}from"../lib/LineMaterial.js";import{createVerticesView as o}from"../lib/VerticesView.js";import{VisualVariablePassParameters as s}from"./VisualVariablePassParameters.js";import{writeLineMarkerBuffer as c}from"./internal/lineMarkerBufferUtils.js";import{getLayout as l}from"../shaders/lineMarkerLayouts.js";import{LineMarkerTechnique as u}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d}from"../shaders/LineMarkerTechniqueConfiguration.js";import{alphaCutoff as f}from"../../../../webscene/support/AlphaCutoff.js";class p extends a{constructor(e,i){super(e,h),this.produces=new Map([[2,e=>e===10||t(e)&&this.parameters.renderOccluded===8],[3,e=>n(e)],[10,e=>r(e)&&this.parameters.renderOccluded===8],[11,e=>r(e)&&this.parameters.renderOccluded===8],[4,e=>t(e)],[18,e=>t(e)||e===10]]),this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this._configuration=new d(i)}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==0,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.worldSpace=this.parameters.worldSpace&&!this._configuration.draped,this._configuration.hasScreenSizePerspective=this.parameters.screenSizePerspective!=null&&!this._configuration.worldSized}get visible(){return this.parameters.color[3]>=f}get emissions(){return this.parameters.emissiveStrength>0?this.parameters.renderOccluded===8?1:2:0}intersectRay(){}intersectScreenPolygon(){return null}computeAttachmentOrigin(){return!1}createPrimitivePositionReader(t){let n=t.vertex.getField(`position`,e);return(e,t)=>n.getVec(t,e)}createBufferWriter(){return new g(l(this.parameters),this.parameters)}createGLMaterial(e){return new m(e)}}class m extends i{dispose(){super.dispose(),this._markerTextures?.release(this._markerPrimitive),this._markerPrimitive=null}beginSlot(e){let t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this.getTechnique(u,e)}}class h extends s{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive=`arrow`,this.markerScale=1,this.placement=`end`,this.cap=0,this.anchor=0,this.hasTip=!1,this.shadingEnabled=!1,this.worldSpace=!1,this.worldSized=!1,this.hideOnShortSegments=!1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.stipplePattern=null,this.markerTexture=null}}class g{constructor(e,t){this.layout=e,this._parameters=t}elementCount(){return this._parameters.placement===`begin-end`?12:6}rebaseBuffers(e,t){t?.buffer.copyFrom(e.vertex,0,t.offset)}write(e,t,n,r){if(r==null)return;let i=n.get(`position`);c({position:o(i,3),normal:n.get(`normal`)?.data,color:n.get(`color`)?.data,size:n.get(`size`)?.data[0],colorFeature:this._parameters.vvColor?n.get(`colorFeatureAttribute`).data[0]:void 0,sizeFeature:this._parameters.vvSize?n.get(`sizeFeatureAttribute`).data[0]:void 0,opacityFeature:this._parameters.vvOpacity?n.get(`opacityFeatureAttribute`).data[0]:void 0},this._parameters,r,e)}}export{p as LineMarkerMaterial,h as Parameters};
2
+ import{BufferViewVec3f as e}from"../../../../geometry/support/buffer/BufferView.js";import{isColor as t,isDepth as n,isColorHighlightOLIDOrDepth as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{LineMaterial as a}from"../lib/LineMaterial.js";import{createVerticesView as o}from"../lib/VerticesView.js";import{VisualVariablePassParameters as s}from"./VisualVariablePassParameters.js";import{writeLineMarkerBuffer as c}from"./internal/lineMarkerBufferUtils.js";import{getLayout as l}from"../shaders/lineMarkerLayouts.js";import{LineMarkerTechnique as u}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d}from"../shaders/LineMarkerTechniqueConfiguration.js";import{alphaCutoff as f}from"../../../../webscene/support/AlphaCutoff.js";class p extends a{constructor(e,i){super(e,h),this.produces=new Map([[2,e=>e===10||t(e)&&this.parameters.renderOccluded===8],[3,e=>n(e)],[10,e=>r(e)&&this.parameters.renderOccluded===8],[11,e=>r(e)&&this.parameters.renderOccluded===8],[4,e=>t(e)],[18,e=>t(e)||e===10]]),this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this._configuration=new d(i)}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==0,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.worldSpace=this.parameters.worldSpace&&!this._configuration.draped,this._configuration.hasScreenSizePerspective=this.parameters.screenSizePerspective!=null&&!this._configuration.worldSized}get visible(){return this.parameters.color[3]>=f}get emissions(){return this.parameters.emissiveStrength>0?this.parameters.renderOccluded===8?1:2:0}intersectRay(){}intersectScreenPolygon(){return null}computeAttachmentOrigin(){return!1}createPrimitivePositionReader(t){let n=t.vertex.getField(`position`,e);return(e,t)=>n.getVec(t,e)}createBufferWriter(){return new g(l(this.parameters),this.parameters)}createGLMaterial(e){return new m(e)}}class m extends i{dispose(){super.dispose(),this._markerTextures?.release(this._markerPrimitive),this._markerPrimitive=null}beginSlot(e){let t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this.getTechnique(u,e)}}class h extends s{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive=`arrow`,this.markerScale=1,this.placement=`end`,this.cap=0,this.anchor=0,this.hasTip=!1,this.shadingEnabled=!1,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.worldSpace=!1,this.worldSized=!1,this.hideOnShortSegments=!1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.stipplePattern=null,this.markerTexture=null}}class g{constructor(e,t){this.layout=e,this._parameters=t}elementCount(){return this._parameters.placement===`begin-end`?12:6}rebaseBuffers(e,t){t?.buffer.copyFrom(e.vertex,0,t.offset)}write(e,t,n,r){if(r==null)return;let i=n.get(`position`);c({position:o(i,3),normal:n.get(`normal`)?.data,color:n.get(`color`)?.data,size:n.get(`size`)?.data[0],colorFeature:this._parameters.vvColor?n.get(`colorFeatureAttribute`).data[0]:void 0,sizeFeature:this._parameters.vvSize?n.get(`sizeFeatureAttribute`).data[0]:void 0,opacityFeature:this._parameters.vvOpacity?n.get(`opacityFeatureAttribute`).data[0]:void 0},this._parameters,r,e)}}export{p as LineMarkerMaterial,h as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{BufferViewUint32 as e,BufferViewVec3f as t,BufferViewVec2Snorm16 as n,BufferViewSnorm16 as r,BufferViewFloat16 as i,BufferViewFloat as a,BufferViewVec2f as o,BufferViewVec4Unorm8 as s,BufferViewUnorm8 as c}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as l}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as u,is3DGeometry as d,isColor as f}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as p}from"../effects/geometry/olidUtils.js";import m from"../lib/GLMaterial.js";import{pathVertexInfoPacking as h}from"../lib/PathVertexInfo.js";import{intersectTriangleGeometry as g}from"../lib/RayIntersections.js";import{intersectTriangleGeometryWithScreenPolygon as _}from"../lib/screenPolygonTriangleIntersections.js";import{assert as v}from"../lib/Util.js";import{applyPolygonOffsetToHit as y}from"./intersectWithPolygonOffset.js";import{getLayout as b,getTextureLayout as x}from"./PathLayouts.js";import{PathPassParameters as S,PathTechnique as C}from"./PathTechnique.js";import{PathTechniqueConfiguration as w}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as T}from"./TriangleMaterial.js";import{writeAttributes as E,writePosition as D,writeBufferVec2 as O,writeBufferInt16 as k,writeBufferFloat16 as A,writeBufferFloat as j,writeColor as M,writeBufferUint8 as N}from"./internal/bufferWriterUtils.js";import{hasShadowHighlights as P}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as F}from"../../../../webscene/support/AlphaCutoff.js";class I extends T{constructor(e,t){super(e,R),this.supportsEdges=!0,this.produces=new Map([[2,e=>(this.parameters.castShadows&&u(e)||d(e))&&!this.transparent],[4,e=>(this.parameters.castShadows&&u(e)||d(e))&&this.transparent]]),this._configuration=new w(t.spherical)}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=e.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?0:this.parameters.cullFace,this._configuration.pathJoinType=this.parameters.pathJoinType,this._configuration.offsetBackfaces=this.transparent,f(e.output)?(this._configuration.receiveShadows=e.shadowMap.enabled,this._configuration.hasShadowHighlights=P(this._configuration,e),this._configuration.receiveAmbientOcclusion=e.ssao!=null,this._configuration.receiveGlobalIllumination=e.globalIlluminationEnabled):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=this._configuration.receiveGlobalIllumination=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=+!!this.emissions,this._configuration.snowCover=e.snowCover>0,this._configuration.upVectorAlignment=this.parameters.upVectorAlignment,this._configuration.pathCapType=this.parameters.pathCapType,this._configuration.pathProfileType=this.parameters.profile.type,this._configuration.hasPathSize=this.parameters.hasPathSize,this._configuration.hasPathColor=this.parameters.hasPathColor,this._configuration.hasPathOpacity=this.parameters.hasPathOpacity}isVisibleForOutput(e){return e===5||e===7||e===6?this.parameters.castShadows:!0}get visible(){return this.parameters.opacity>=F}intersectRay(e,t,n,r,i,a){g(e,n,r,i,null,a)}intersectRayDraped(){}intersectScreenPolygonDraped(){return null}intersectScreenPolygon(e,t,n,r){return y(_(e,n,t,r,null),this._configuration,n.camera.eye)}createBufferWriter(){return new z(b(),x(this.parameters))}createGLMaterial(e){return new L(e)}get transparent(){return this.parameters.drivenOpacity||this.parameters.opacity<1}}class L extends m{beginSlot(e){return this.getTechnique(C,e)}}class R extends S{constructor(){super(...arguments),this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1,this.upVectorAlignment=0,this.pathCapType=1,this.cullFace=2,this.pathJoinType=1}}class z{constructor(e,t){this.layout=e,this.textureBufferLayout=t,this.maxTextureBufferItemIndex=l}elementCount(e){return e.get(`pathVertexInfo`)?.indices.length??0}elementCountTextureBuffer(e){return e.get(`position`)?.indices.length??0}write(e,t,n,r,i,a){r!=null&&this._writeVertexBuffer(e,t,n,r,i),a!=null&&this._writeTextureBuffer(e,n,a)}_writeVertexBuffer(t,n,r,i,a){E(r,this.layout,t,n,i);let o=a?.from??0,s=i.buffer.getField(`pathVertexInfo`,e),c=r.get(`pathVertexInfo`);if(s&&c){v(c.size===1);let{data:e,stride:t,indices:n}=c,r=h.getField(0);for(let a=0;a<n.length;++a){let c=e[t*n[a]],l=r.get(c)+o;v(l>=0&&l<=r.max,`Path frame index out of range`),s.set(i.offset+a,r.set(c,l))}}}_writeTextureBuffer(e,l,u){let d=u.offset,f=u.buffer.getField(`position`,t),m=l.get(`position`);f&&m&&(v(m.size===3),D(m,e,f,d));let h=u.buffer.getField(`profileRight`,n),g=l.get(`profileRight`);h&&g&&(v(g.size===2),O(g,h,d));let _=u.buffer.getField(`profileUp`,n),y=l.get(`profileUp`);_&&y&&(v(y.size===2),O(y,_,d));let b=u.buffer.getField(`profileRotation`,r),x=l.get(`profileRotation`);b&&x&&(v(x.size===1),k(x,b,d));let S=u.buffer.getField(`pathRotationUp`,n),C=l.get(`pathRotationUp`);S&&C&&(v(C.size===2),O(C,S,d));let w=u.buffer.getField(`pathMaxStretchDistance`,i),T=l.get(`pathMaxStretchDistance`);w&&T&&(v(T.size===1),A(T,w,d));let E=u.buffer.getField(`sizeFeatureAttribute`,a),P=l.get(`sizeFeatureAttribute`);E&&P&&j(P,E,d);let F=u.buffer.getField(`size`,o),I=l.get(`size`);F&&I&&(v(I.size===2),O(I,F,d));let L=u.buffer.getField(`colorFeatureAttribute`,a),R=l.get(`colorFeatureAttribute`);L&&R&&j(R,L,d);let z=u.buffer.getField(`color`,s),B=l.get(`color`);z&&B&&M(B,4,z,d);let V=u.buffer.getField(`opacityFeatureAttribute`,a),H=l.get(`opacityFeatureAttribute`);V&&H&&j(H,V,d);let U=u.buffer.getField(`opacity`,c),W=l.get(`opacity`);if(U&&W&&(v(W.size===1),N(W,U,d)),p()){let e=u.buffer.getField(`olidColor`,s),t=m?.indices.length??0,n=l.get(`olidColor`);n&&e&&t&&M(n,4,e,d)}}}export{R as Parameters,z as PathBufferWriter,I as PathMaterial};
2
+ import{BufferViewUint32 as e,BufferViewVec3f as t,BufferViewVec2Snorm16 as n,BufferViewSnorm16 as r,BufferViewFloat16 as i,BufferViewFloat as a,BufferViewVec2f as o,BufferViewVec4Unorm8 as s,BufferViewUnorm8 as c}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as l}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as u,is3DGeometry as d}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as f}from"../effects/geometry/olidUtils.js";import p from"../lib/GLMaterial.js";import{pathVertexInfoPacking as m}from"../lib/PathVertexInfo.js";import{intersectTriangleGeometry as h}from"../lib/RayIntersections.js";import{intersectTriangleGeometryWithScreenPolygon as g}from"../lib/screenPolygonTriangleIntersections.js";import{assert as _}from"../lib/Util.js";import{applyPolygonOffsetToHit as v}from"./intersectWithPolygonOffset.js";import{getLayout as y,getTextureLayout as b}from"./PathLayouts.js";import{PathPassParameters as x,PathTechnique as S}from"./PathTechnique.js";import{PathTechniqueConfiguration as C}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as w}from"./TriangleMaterial.js";import{writeAttributes as T,writePosition as E,writeBufferVec2 as D,writeBufferInt16 as O,writeBufferFloat16 as k,writeBufferFloat as A,writeColor as j,writeBufferUint8 as M}from"./internal/bufferWriterUtils.js";import{configureShadedMaterial as N}from"../shaders/ShadedMaterialConfiguration.js";import{alphaCutoff as P}from"../../../../webscene/support/AlphaCutoff.js";class F extends w{constructor(e,t){super(e,L),this.supportsEdges=!0,this.produces=new Map([[2,e=>(this.parameters.castShadows&&u(e)||d(e))&&!this.transparent],[4,e=>(this.parameters.castShadows&&u(e)||d(e))&&this.transparent]]),this._configuration=new C(t.spherical)}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e),N(this._configuration,e,this.parameters),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=e.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?0:this.parameters.cullFace,this._configuration.pathJoinType=this.parameters.pathJoinType,this._configuration.offsetBackfaces=this.transparent,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=+!!this.emissions,this._configuration.snowCover=e.snowCover>0,this._configuration.upVectorAlignment=this.parameters.upVectorAlignment,this._configuration.pathCapType=this.parameters.pathCapType,this._configuration.pathProfileType=this.parameters.profile.type,this._configuration.hasPathSize=this.parameters.hasPathSize,this._configuration.hasPathColor=this.parameters.hasPathColor,this._configuration.hasPathOpacity=this.parameters.hasPathOpacity}isVisibleForOutput(e){return e===5||e===7||e===6?this.parameters.castShadows:!0}get visible(){return this.parameters.opacity>=P}intersectRay(e,t,n,r,i,a){h(e,n,r,i,null,a)}intersectRayDraped(){}intersectScreenPolygonDraped(){return null}intersectScreenPolygon(e,t,n,r){return v(g(e,n,t,r,null),this._configuration,n.camera.eye)}createBufferWriter(){return new R(y(),b(this.parameters))}createGLMaterial(e){return new I(e)}get transparent(){return this.parameters.drivenOpacity||this.parameters.opacity<1}}class I extends p{beginSlot(e){return this.getTechnique(S,e)}}class L extends x{constructor(){super(...arguments),this.polygonOffset=0,this.shadingEnabled=!0,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1,this.upVectorAlignment=0,this.pathCapType=1,this.cullFace=2,this.pathJoinType=1}}class R{constructor(e,t){this.layout=e,this.textureBufferLayout=t,this.maxTextureBufferItemIndex=l}elementCount(e){return e.get(`pathVertexInfo`)?.indices.length??0}elementCountTextureBuffer(e){return e.get(`position`)?.indices.length??0}write(e,t,n,r,i,a){r!=null&&this._writeVertexBuffer(e,t,n,r,i),a!=null&&this._writeTextureBuffer(e,n,a)}_writeVertexBuffer(t,n,r,i,a){T(r,this.layout,t,n,i);let o=a?.from??0,s=i.buffer.getField(`pathVertexInfo`,e),c=r.get(`pathVertexInfo`);if(s&&c){_(c.size===1);let{data:e,stride:t,indices:n}=c,r=m.getField(0);for(let a=0;a<n.length;++a){let c=e[t*n[a]],l=r.get(c)+o;_(l>=0&&l<=r.max,`Path frame index out of range`),s.set(i.offset+a,r.set(c,l))}}}_writeTextureBuffer(e,l,u){let d=u.offset,p=u.buffer.getField(`position`,t),m=l.get(`position`);p&&m&&(_(m.size===3),E(m,e,p,d));let h=u.buffer.getField(`profileRight`,n),g=l.get(`profileRight`);h&&g&&(_(g.size===2),D(g,h,d));let v=u.buffer.getField(`profileUp`,n),y=l.get(`profileUp`);v&&y&&(_(y.size===2),D(y,v,d));let b=u.buffer.getField(`profileRotation`,r),x=l.get(`profileRotation`);b&&x&&(_(x.size===1),O(x,b,d));let S=u.buffer.getField(`pathRotationUp`,n),C=l.get(`pathRotationUp`);S&&C&&(_(C.size===2),D(C,S,d));let w=u.buffer.getField(`pathMaxStretchDistance`,i),T=l.get(`pathMaxStretchDistance`);w&&T&&(_(T.size===1),k(T,w,d));let N=u.buffer.getField(`sizeFeatureAttribute`,a),P=l.get(`sizeFeatureAttribute`);N&&P&&A(P,N,d);let F=u.buffer.getField(`size`,o),I=l.get(`size`);F&&I&&(_(I.size===2),D(I,F,d));let L=u.buffer.getField(`colorFeatureAttribute`,a),R=l.get(`colorFeatureAttribute`);L&&R&&A(R,L,d);let z=u.buffer.getField(`color`,s),B=l.get(`color`);z&&B&&j(B,4,z,d);let V=u.buffer.getField(`opacityFeatureAttribute`,a),H=l.get(`opacityFeatureAttribute`);V&&H&&A(H,V,d);let U=u.buffer.getField(`opacity`,c),W=l.get(`opacity`);if(U&&W&&(_(W.size===1),M(W,U,d)),f()){let e=u.buffer.getField(`olidColor`,s),t=m?.indices.length??0,n=l.get(`olidColor`);n&&e&&t&&j(n,4,e,d)}}}export{L as Parameters,R as PathBufferWriter,F as PathMaterial};