@arcgis/core 5.2.0-next.48 → 5.2.0-next.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/applications/Components/OrientedImageryViewer/PanoramicViewer/utils.d.ts +33 -0
  2. package/applications/Components/OrientedImageryViewer/PanoramicViewer/utils.js +2 -0
  3. package/arcgisGlobal.d.ts +2 -0
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/031ccf2e1583beebdf24.js +1 -0
  6. package/assets/esri/core/workers/chunks/0474af7687466d8befd2.js +1 -0
  7. package/assets/esri/core/workers/chunks/{f9b2727b41943d83d4ca.js → 0a413d917f3d19440fc1.js} +1 -1
  8. package/assets/esri/core/workers/chunks/0b2ca406761c63529a6a.js +1 -0
  9. package/assets/esri/core/workers/chunks/{c369d4266f38e9ea6592.js → 1119a33245138e7b3914.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{6fbcf1b85461c6c6c127.js → 172571397c66f992d08c.js} +1 -1
  11. package/assets/esri/core/workers/chunks/18edf2846d7546285e5e.js +1 -0
  12. package/assets/esri/core/workers/chunks/{7759a489205a874e13bb.js → 1b0557fcb058fc450230.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{7d0ff52748fd4eb0334d.js → 1bc45872d22d61dbd7d1.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{835643f716f7058a2722.js → 1cf8fb704c48ac3d3b15.js} +1 -1
  15. package/assets/esri/core/workers/chunks/25cb56c3b538d00e7693.js +1 -0
  16. package/assets/esri/core/workers/chunks/{2c0d92c0e3511775401a.js → 35cbf00f0c37a86517af.js} +1 -1
  17. package/assets/esri/core/workers/chunks/382d9491c2a56c1925fe.js +1 -0
  18. package/assets/esri/core/workers/chunks/3af2b9d6d5466cb2b957.js +256 -0
  19. package/assets/esri/core/workers/chunks/{c3766d98f0a70897647f.js → 3bc2943035391b44d4cf.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{bd8b180c61a80e60568c.js → 40f7bb0ebd918d76f078.js} +1 -1
  21. package/assets/esri/core/workers/chunks/43b39abd49c4a8ce891f.js +1 -0
  22. package/assets/esri/core/workers/chunks/{821176ee3be724621bb0.js → 461c2de938bf4c9b1442.js} +1 -1
  23. package/assets/esri/core/workers/chunks/4ee7232ea41fa41c5ed4.js +29 -0
  24. package/assets/esri/core/workers/chunks/50674ba5f24129d61d89.js +1 -0
  25. package/assets/esri/core/workers/chunks/547a2fe53139f705f95e.js +1 -0
  26. package/assets/esri/core/workers/chunks/5ce09c4d06e98b1e9251.js +1 -0
  27. package/assets/esri/core/workers/chunks/{4d9433f127aef76f3449.js → 5dbd28fce73751d2d1aa.js} +1 -1
  28. package/assets/esri/core/workers/chunks/5ec8b02e097cf6718462.js +1 -0
  29. package/assets/esri/core/workers/chunks/5f54d927dc77e92cf145.js +1 -0
  30. package/assets/esri/core/workers/chunks/63e3d338751240479335.js +1 -0
  31. package/assets/esri/core/workers/chunks/6ccd5fa5e35dc70fcd5d.js +1 -0
  32. package/assets/esri/core/workers/chunks/6e520ef645c5edcd499a.js +1 -0
  33. package/assets/esri/core/workers/chunks/{68d898037feb0aee3138.js → 78add8e6b54b51eaa299.js} +1 -1
  34. package/assets/esri/core/workers/chunks/7b61f56d0f766421eaef.js +1 -0
  35. package/assets/esri/core/workers/chunks/7f2f2a92dce3f68e579b.js +1 -0
  36. package/assets/esri/core/workers/chunks/{e7e3ea7af928b49b226c.js → 801a664f21e0218bc705.js} +1 -1
  37. package/assets/esri/core/workers/chunks/8d21e2dabc5165f1c8ca.js +1 -0
  38. package/assets/esri/core/workers/chunks/9008090a5d8431ddfa22.js +1 -0
  39. package/assets/esri/core/workers/chunks/{71ce1009dadcae8f8094.js → 95b3b8fe45ef4ac6b277.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{78918035144c3c76df71.js → 96cec8a02ca96175d602.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{bab71e1b8b93d09d4809.js → 99eccf9ce53582cfa5b5.js} +1 -1
  42. package/assets/esri/core/workers/chunks/9b7cb96acea388d86fa4.js +1 -0
  43. package/assets/esri/core/workers/chunks/{ff2c4f648f77850922d5.js → 9e474465d069cb9e94f5.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{ae9f9e975d7a9d442fa5.js → ab5aa4280ed0cb7fcbe9.js} +1 -1
  45. package/assets/esri/core/workers/chunks/b49952541d189b4b9f7e.js +1 -0
  46. package/assets/esri/core/workers/chunks/{fed6c75485601cd3afa1.js → baac90da0703891d59c4.js} +1 -1
  47. package/assets/esri/core/workers/chunks/bb552089b34d6811fb03.js +1 -0
  48. package/assets/esri/core/workers/chunks/{b30237361d87cf982e41.js → d1af0bd611a3dc549858.js} +64 -59
  49. package/assets/esri/core/workers/chunks/d2cb3d5ef0a9285afb78.js +1 -0
  50. package/assets/esri/core/workers/chunks/d560ed96dde5ca3a5583.js +1 -0
  51. package/assets/esri/core/workers/chunks/dc1787d88b11ed985159.js +1 -0
  52. package/assets/esri/core/workers/chunks/{399e23d777a043efa9f1.js → dd95f50dac3f33cdb6d2.js} +1 -1
  53. package/assets/esri/core/workers/chunks/ddb92c815d17c67a45e6.js +1 -0
  54. package/assets/esri/core/workers/chunks/{52efa4ded11c1e71f04f.js → e2e2162adbfb9b46bede.js} +1 -1
  55. package/assets/esri/core/workers/chunks/e4353f0792f45aa6a62f.js +1 -0
  56. package/assets/esri/core/workers/chunks/eac8cae89da9ce2f4946.js +1 -0
  57. package/assets/esri/core/workers/chunks/edf87407dd20685c82ab.js +1 -0
  58. package/assets/esri/core/workers/chunks/{be6caade351e89f84251.js → ee7c8a7f384ea6393487.js} +107 -82
  59. package/assets/esri/core/workers/chunks/f1299b4fc760ccca1518.js +1 -0
  60. package/assets/esri/core/workers/chunks/f244632f7934a4b72c91.js +1 -0
  61. package/assets/esri/core/workers/chunks/fc639c730115e07a4a1a.js +1 -0
  62. package/assets/esri/libs/dxtEncoder/dxt_encoder.wasm +0 -0
  63. package/chunks/Component.glsl.js +104 -67
  64. package/chunks/LineMarker.glsl.js +31 -31
  65. package/chunks/RibbonLine.glsl.js +60 -49
  66. package/chunks/dxt_encoder.js +1 -1
  67. package/chunks/vec3.js +1 -1
  68. package/config.js +1 -1
  69. package/core/has.js +1 -1
  70. package/geometry/support/aaBoundingBox.js +1 -1
  71. package/geometry/support/buffer/math/vec3.js +1 -1
  72. package/geometry/support/frustum.js +1 -1
  73. package/geometry/support/meshUtils/extent.js +1 -1
  74. package/geometry/support/meshUtils/vertexSpaceConversion.js +1 -1
  75. package/kernel.js +1 -1
  76. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  77. package/layers/orientedImagery/transformations/utils.js +1 -1
  78. package/package.json +1 -1
  79. package/support/revision.js +1 -1
  80. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  81. package/symbols/cim/CIMSymbolHelper.js +1 -1
  82. package/symbols/cim/TextRasterizer.js +1 -1
  83. package/symbols/cim/cimAnalyzer.js +1 -1
  84. package/symbols/cim/richTextUtils.js +2 -0
  85. package/views/2d/engine/webgl/TextureManager.js +1 -1
  86. package/views/2d/engine/webgl/definitions.js +1 -1
  87. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  88. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  89. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  90. package/views/2d/engine/webgl/util/DimensionMatcher.js +1 -1
  91. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  92. package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
  93. package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
  94. package/views/2d/layers/support/annodime/dimensionUtils.js +1 -1
  95. package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
  96. package/views/3d/analysis/Viewshed/ViewshedConfiguration.js +1 -1
  97. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  98. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  99. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
  100. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  101. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  102. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  103. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  104. package/views/3d/focusAreaUtils.js +1 -1
  105. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  106. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  107. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  108. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  109. package/views/3d/layers/i3s/meshUtils.js +1 -1
  110. package/views/3d/webgl/RenderCamera.js +1 -1
  111. package/views/3d/webgl/RenderNode.js +1 -1
  112. package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
  113. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +2 -2
  114. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +2 -2
  115. package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +36 -25
  116. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +17 -10
  117. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  118. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  119. package/views/3d/webgl-engine/lib/PolygonIntersections2D.js +1 -1
  120. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  121. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  122. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  123. package/views/3d/webgl-engine/lib/lodRendering/LodLevel.js +1 -1
  124. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
  125. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  126. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  127. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  128. package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +8 -5
  129. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  130. package/views/3d/webgl-engine/shaders/RibbonLineLayouts.js +1 -1
  131. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  132. package/views/3d/webgl-engine/shaders/RibbonLineTextureBuffer.glsl.js +1 -1
  133. package/views/SceneView.js +1 -1
  134. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  135. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
  136. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  137. package/views/selection/SelectionOperation.js +1 -1
  138. package/views/support/DefaultsFromMap.js +1 -1
  139. package/views/support/LayerViewManager.js +1 -1
  140. package/views/support/TextureCompressionWorker.js +1 -1
  141. package/views/webgl/RenderingContext.js +1 -1
  142. package/widgets/Editor.js +1 -1
  143. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  144. package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
  145. package/widgets/OrientedImageryViewer/support/superimposeUtils.js +1 -1
  146. package/widgets/PanoramicViewer/support/PanoramicTileNode.d.ts +63 -0
  147. package/widgets/PanoramicViewer/support/PanoramicTileNode.js +1 -1
  148. package/widgets/PanoramicViewer/support/PanoramicTilePyramid.d.ts +66 -0
  149. package/widgets/PanoramicViewer/support/PanoramicTilePyramid.js +1 -1
  150. package/widgets/PanoramicViewer/utils.js +1 -1
  151. package/widgets/Sketch/VisibleElements.d.ts +0 -10
  152. package/widgets/Sketch.js +1 -1
  153. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  154. package/widgets/support/SelectionToolbar.js +1 -1
  155. package/widgets/support/Selector3D/selectorUtils.js +2 -0
  156. package/assets/esri/core/workers/chunks/0e64e20fedfe01a1985f.js +0 -1
  157. package/assets/esri/core/workers/chunks/0f674c625f24ac73e25a.js +0 -1
  158. package/assets/esri/core/workers/chunks/15351354afcbf840a23d.js +0 -29
  159. package/assets/esri/core/workers/chunks/1843a762f7051f61af43.js +0 -1
  160. package/assets/esri/core/workers/chunks/1d1f5578c7d8619f7a46.js +0 -1
  161. package/assets/esri/core/workers/chunks/2015f4def2ef201bdab8.js +0 -1
  162. package/assets/esri/core/workers/chunks/20c363a113dc068de9e0.js +0 -1
  163. package/assets/esri/core/workers/chunks/24d936d459c538187af6.js +0 -1
  164. package/assets/esri/core/workers/chunks/272c8ab189217240d05f.js +0 -1
  165. package/assets/esri/core/workers/chunks/2e121eac97ae72a8b49a.js +0 -1
  166. package/assets/esri/core/workers/chunks/327899182a4dace428eb.js +0 -1
  167. package/assets/esri/core/workers/chunks/32ca15d928d51b380068.js +0 -1
  168. package/assets/esri/core/workers/chunks/3e1a7e4c674057807e3a.js +0 -1
  169. package/assets/esri/core/workers/chunks/4e2baa60c5d5197b2271.js +0 -1
  170. package/assets/esri/core/workers/chunks/519c0b51b1ba42fb71d7.js +0 -1
  171. package/assets/esri/core/workers/chunks/57fa3c0e7892c2eef3ee.js +0 -261
  172. package/assets/esri/core/workers/chunks/68b615bbd27fadcfcb66.js +0 -1
  173. package/assets/esri/core/workers/chunks/69d740ab18510156f5d6.js +0 -1
  174. package/assets/esri/core/workers/chunks/8d21f3d6edbcd7b335d0.js +0 -1
  175. package/assets/esri/core/workers/chunks/9a97f6cda2f36941efae.js +0 -1
  176. package/assets/esri/core/workers/chunks/9ceeae787dc7c194d60e.js +0 -1
  177. package/assets/esri/core/workers/chunks/a90f7b1c6c69b6033b4c.js +0 -1
  178. package/assets/esri/core/workers/chunks/b32bdf5730953c2fb16b.js +0 -1
  179. package/assets/esri/core/workers/chunks/b5d23efa584c74955d5b.js +0 -1
  180. package/assets/esri/core/workers/chunks/b83f2bbd634f57a5e8f9.js +0 -1
  181. package/assets/esri/core/workers/chunks/bb8e9b8343b83dd1ba3c.js +0 -1
  182. package/assets/esri/core/workers/chunks/bef1990159c0e49e7d27.js +0 -1
  183. package/assets/esri/core/workers/chunks/bf287f0e2ecb4532dc00.js +0 -1
  184. package/assets/esri/core/workers/chunks/c5e36544b2d1792e4c5f.js +0 -1
  185. package/assets/esri/core/workers/chunks/cba3316910ff088f4d77.js +0 -1
  186. package/assets/esri/core/workers/chunks/de9573871f64c01e9f01.js +0 -1
  187. package/assets/esri/core/workers/chunks/e232459f0b00110e07ac.js +0 -1
  188. package/assets/esri/core/workers/chunks/ee6bb6cd16f99421c76b.js +0 -1
  189. package/assets/esri/core/workers/chunks/fd2ba6f76645ba503cbb.js +0 -1
  190. package/views/3d/analysis/Viewshed/ViewshedTool2.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import t from"../../../../core/PooledArray.js";import{lerp as i,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as r,clone as s,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{assert as a}from"./Util.js";class h{get center(){return r(this._data[0],this._data[1],this._data[2])}get radius(){return this._data[3]}get bbMin(){return r(this._data[4],this._data[5],this._data[6])}get bbMax(){return r(this._data[7],this._data[8],this._data[9])}constructor(t,e,h){this.primitiveIndices=t,this._numIndexPerPrimitive=e,this.position=h,this._data=[.1,0,0,0,0,0,0,0,0,0],this._children=void 0,a(t.length>=1),a(3===h.size||4===h.size);const{data:l,size:d,indices:c}=h;a(c.length%this._numIndexPerPrimitive===0),a(c.length>=t.length*this._numIndexPerPrimitive);const m=t.length;let _=d*c[this._numIndexPerPrimitive*t[0]];o.clear(),o.push(_);const u=r(l[_],l[_+1],l[_+2]),f=s(u);for(let i=0;i<m;++i){const e=this._numIndexPerPrimitive*t[i];for(let t=0;t<this._numIndexPerPrimitive;++t){_=d*c[e+t],o.push(_);let i=l[_];u[0]=Math.min(i,u[0]),f[0]=Math.max(i,f[0]),i=l[_+1],u[1]=Math.min(i,u[1]),f[1]=Math.max(i,f[1]),i=l[_+2],u[2]=Math.min(i,u[2]),f[2]=Math.max(i,f[2])}}for(let i=0;i<3;++i)this._data[4+i]=u[i],this._data[7+i]=f[i];const x=i(n(),this.bbMin,this.bbMax,.5);let P=.5*Math.max(Math.max(f[0]-u[0],f[1]-u[1]),f[2]-u[2]),b=P*P;for(let i=0;i<o.length;++i){_=o.at(i);const t=l[_]-x[0],e=l[_+1]-x[1],r=l[_+2]-x[2],s=t*t+e*e+r*r;if(s<=b)continue;const n=Math.sqrt(s),a=.5*(n-P);P+=a,b=P*P;const h=a/n;x[0]+=t*h,x[1]+=e*h,x[2]+=r*h}this._data[3]=P;for(let i=0;i<3;++i)this._data[0+i]=x[i];o.clear()}getChildren(){if(this._children||e(this.bbMin,this.bbMax)<=1)return this._children;const t=i(n(),this.bbMin,this.bbMax,.5),r=this.primitiveIndices.length,s=new Uint8Array(r),a=new Array(8);for(let i=0;i<8;++i)a[i]=0;const{data:o,size:l,indices:d}=this.position;for(let i=0;i<r;++i){let e=0;const r=this._numIndexPerPrimitive*this.primitiveIndices[i];let n=l*d[r],h=o[n],c=o[n+1],m=o[n+2];for(let t=1;t<this._numIndexPerPrimitive;++t){n=l*d[r+t];const i=o[n],e=o[n+1],s=o[n+2];i<h&&(h=i),e<c&&(c=e),s<m&&(m=s)}h<t[0]&&(e|=1),c<t[1]&&(e|=2),m<t[2]&&(e|=4),s[i]=e,++a[e]}let c=0;for(let i=0;i<8;++i)a[i]>0&&++c;if(c<2)return;const m=new Array(8);for(let i=0;i<8;++i)m[i]=a[i]>0?new Uint32Array(a[i]):void 0;for(let i=0;i<8;++i)a[i]=0;for(let i=0;i<r;++i){const t=s[i];m[t][a[t]++]=this.primitiveIndices[i]}this._children=new Array;for(let i=0;i<8;++i)void 0!==m[i]&&this._children.push(new h(m[i],this._numIndexPerPrimitive,this.position));return this._children}static prune(){o.prune()}}const o=new t({deallocator:null});export{h as BoundingInfo};
2
+ import t from"../../../../core/PooledArray.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as i,fromValues as o,expandWithValues as r,center as n,width as s,height as c,depth as h,squareDiameter as l}from"../../../../geometry/support/aaBoundingBox.js";import{Sphere as d}from"../../../../geometry/support/sphere.js";import{assert as u}from"./Util.js";class a{get boundingSphere(){return this._sphere}get boundingBox(){return this._boundingBox}constructor(t,e,l){this.primitiveIndices=t,this._numIndexPerPrimitive=e,this.position=l,this._sphere=new d,this._boundingBox=i(),this._children=void 0,u(t.length>=1),u(3===l.size||4===l.size);const{data:a,size:p,indices:g}=l;u(g.length%e===0),u(g.length>=t.length*e);const m=t.length;let v=p*g[e*t[0]];f.clear(),f.push(v);const _=o(a[v],a[v+1],a[v+2],a[v],a[v+1],a[v+2],this._boundingBox);for(let i=0;i<m;++i){const o=e*t[i];for(let t=0;t<e;++t)v=p*g[o+t],f.push(v),r(_,a[v],a[v+1],a[v+2])}const x=n(_,this._sphere.center);let b=.5*Math.max(s(_),c(_),h(_)),B=b*b;for(let i=0;i<f.length;++i){v=f.at(i);const t=a[v]-x[0],e=a[v+1]-x[1],o=a[v+2]-x[2],r=t*t+e*e+o*o;if(r<=B)continue;const n=Math.sqrt(r),s=.5*(n-b);b+=s,B=b*b;const c=s/n;x[0]+=t*c,x[1]+=e*c,x[2]+=o*c}this._sphere.radius=b,f.clear()}get children(){if(this._children)return this._children;const t=this._boundingBox;if(l(t)<=1)return;const{position:e,_numIndexPerPrimitive:i,primitiveIndices:o}=this,r=n(t,p),s=o.length,c=new Uint8Array(s),h=[0,0,0,0,0,0,0,0],{data:d,size:u,indices:f}=e;for(let n=0;n<s;++n){let t=0;const e=i*o[n];let s=u*f[e],l=d[s],a=d[s+1],p=d[s+2];for(let o=1;o<i;++o){s=u*f[e+o];const t=d[s],i=d[s+1],r=d[s+2];t<l&&(l=t),i<a&&(a=i),r<p&&(p=r)}l<r[0]&&(t|=1),a<r[1]&&(t|=2),p<r[2]&&(t|=4),c[n]=t,++h[t]}let g=0;for(let n=0;n<8;++n)h[n]>0&&++g;if(g<2)return;const m=[void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0];for(let n=0;n<8;++n)h[n]>0&&(m[n]=new Uint32Array(h[n]));h.fill(0);for(let n=0;n<s;++n){const t=c[n];m[t][h[t]++]=o[n]}const v=new Array;for(let n=0;n<8;++n){const t=m[n];void 0!==t&&v.push(new a(t,i,e))}return this._children=v,this._children}static prune(){f.prune()}}const p=e(),f=new t({deallocator:null});export{a as BoundingInfo};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../core/has.js";import{generateUID as t}from"../../../../core/uid.js";import{multiply as i,copy as e,hasIdentityRotation as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o,IDENTITY as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{lerp as a,transformMat4 as h,distance as n,set as m,add as d,exactEquals as l,copy as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as g,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Sphere as u}from"../../../../geometry/support/sphere.js";import{maxScale as f}from"../../support/mathUtils.js";import{Object3DOccludeeStateID as b,Object3DHighlightStateID as v}from"./Object3DStateID.js";import{assert as p}from"./Util.js";import{affectsGeometry as y}from"./VertexAttribute.js";import{addObject3DStateID as j,removeObject3DStateID as V}from"../materials/renderers/utils.js";class x{constructor(i={}){this.id=t(),this._highlightIds=new Set,this._shaderTransformation=null,this._visible=!0,this.castShadow=i.castShadow??!0,this.usesVerticalDistanceToGround=i.usesVerticalDistanceToGround??!1,this.graphicUid=i.graphicUid,this.layerViewUid=i.layerViewUid,i.isElevationSource&&(this.lastValidElevationBB=new S),this._geometries=i.geometries?Array.from(i.geometries):[]}dispose(){this._geometries.length=0}get layer(){return this._layer}set layer(t){p(null==this._layer||null==t,"Object3D can only be added to a single Layer"),this._layer=t}addGeometry(t){t.visible=this._visible,this._geometries.push(t);for(const i of this._highlightIds)t.addHighlight(i);this._emit("geometryAdded",{object:this,geometry:t}),this._highlightIds.size&&this._emit("highlightChanged",this),this._invalidateBoundingVolume()}removeGeometry(t){const i=this._geometries.splice(t,1)[0];if(i){for(const t of this._highlightIds)i.removeHighlight(t);this._emit("geometryRemoved",{object:this,geometry:i}),this._highlightIds.size&&this._emit("highlightChanged",this),this._invalidateBoundingVolume()}}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}geometryVertexAttributeUpdated(t,i,e=!1){this._emit("attributesChanged",{object:this,geometry:t,attribute:i,sync:e}),y(i)&&this._invalidateBoundingVolume()}get visible(){return this._visible}set visible(t){if(this._visible!==t){this._visible=t;for(const t of this._geometries)t.visible=this._visible;this._emit("visibilityChanged",this)}}maskOccludee(){const t=new b;for(const i of this._geometries)i.occludees=j(i.occludees,t);return this._emit("occlusionChanged",this),t}removeOcclude(t){for(const i of this._geometries)i.occludees=V(i.occludees,t);this._emit("occlusionChanged",this)}highlight(t){const i=new v(t);for(const e of this._geometries)e.addHighlight(i);return this._emit("highlightChanged",this),this._highlightIds.add(i),i}removeHighlight(t){this._highlightIds.delete(t);for(const i of this._geometries)i.removeHighlight(t);this._emit("highlightChanged",this)}removeStateID(t){0===t.channel?this.removeHighlight(t):this.removeOcclude(t)}getCombinedStaticTransformation(t,e){return i(e,this.transformation,t.transformation)}getCombinedShaderTransformation(t,e=o()){return i(e,this.effectiveTransformation,t.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=new W,this._validateBoundingVolume(this._bvWorldSpace,0)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=new W,this._validateBoundingVolume(this._bvObjectSpace,1)),this._bvObjectSpace}_validateBoundingVolume(t,i){const e=1===i;for(const s of this._geometries){const i=s.boundingInfo;i&&A(i,t,e?s.transformation:this.getCombinedShaderTransformation(s))}a(t.bounds.center,t.min,t.max,.5);for(const s of this._geometries){const i=s.boundingInfo;if(null==i)continue;const o=e?s.transformation:this.getCombinedShaderTransformation(s),r=f(o);h(B,i.center,o);const a=n(B,t.bounds.center),m=i.radius*r;t.bounds.radius=Math.max(t.bounds.radius,a+m)}}_invalidateBoundingVolume(){const t=this._bvWorldSpace?.bounds;this._bvObjectSpace=this._bvWorldSpace=void 0,this.layer&&t&&this.layer.notifyObjectBBChanged(this,t)}_emit(t,i){this.layer?.events.emit(t,i)}get geometries(){return this._geometries}get transformation(){return this._transformation??r}set transformation(t){this._transformation=e(this._transformation??o(),t),this._invalidateBoundingVolume(),this._emit("transformationChanged",this)}get shaderTransformation(){return this._shaderTransformation}set shaderTransformation(t){this._shaderTransformation=t?e(this._shaderTransformation??o(),t):null,this._invalidateBoundingVolume(),this._emit("shaderTransformationChanged",this)}get effectiveTransformation(){return this.shaderTransformation??this.transformation}get test(){}}class S{constructor(){this._data=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE]}get min(){return g(this._data[0],this._data[1],this._data[2])}get max(){return g(this._data[3],this._data[4],this._data[5])}minWith(t){const{_data:i}=this;i[0]=Math.min(i[0],t[0]),i[1]=Math.min(i[1],t[1]),i[2]=Math.min(i[2],t[2])}maxWith(t){const{_data:i}=this;i[3]=Math.max(i[3],t[0]),i[4]=Math.max(i[4],t[1]),i[5]=Math.max(i[5],t[2])}assignMinMax(t,i){for(let e=0;e<3;++e)this._data[0+e]=t[e],this._data[3+e]=i[e]}isEmpty(){return this._data[3]<this._data[0]&&this._data[4]<this._data[1]&&this._data[5]<this._data[2]}}class W extends S{constructor(){super(...arguments),this.bounds=new u}}function A(t,i,e){const o=t.bbMin,r=t.bbMax;if(s(e)){const t=m(M,e[12],e[13],e[14]);return d(T,o,t),d(C,r,t),i.minWith(T),void i.maxWith(C)}if(h(T,o,e),l(o,r))return i.minWith(T),void i.maxWith(T);h(C,r,e),i.minWith(T),i.minWith(C),i.maxWith(T),i.maxWith(C);for(let s=0;s<3;++s)c(T,o),c(C,r),T[s]=r[s],C[s]=o[s],h(T,T,e),h(C,C,e),i.minWith(T),i.minWith(C),i.maxWith(T),i.maxWith(C)}const M=_(),T=_(),C=_(),B=_();export{W as BoundingVolume,x as Object3D};
2
+ import"../../../../core/has.js";import{generateUID as t}from"../../../../core/uid.js";import{multiply as i,copy as e,hasIdentityRotation as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o,IDENTITY as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{lerp as a,transformMat4 as h,distance as n,set as m,add as d,exactEquals as l,copy as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as c,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getMin as _,getMax as f}from"../../../../geometry/support/aaBoundingBox.js";import{Sphere as b}from"../../../../geometry/support/sphere.js";import{maxScale as v}from"../../support/mathUtils.js";import{Object3DOccludeeStateID as p,Object3DHighlightStateID as y}from"./Object3DStateID.js";import{assert as j}from"./Util.js";import{affectsGeometry as S}from"./VertexAttribute.js";import{addObject3DStateID as x,removeObject3DStateID as V}from"../materials/renderers/utils.js";class W{constructor(i={}){this.id=t(),this._highlightIds=new Set,this._shaderTransformation=null,this._visible=!0,this.castShadow=i.castShadow??!0,this.usesVerticalDistanceToGround=i.usesVerticalDistanceToGround??!1,this.graphicUid=i.graphicUid,this.layerViewUid=i.layerViewUid,i.isElevationSource&&(this.lastValidElevationBB=new A),this._geometries=i.geometries?Array.from(i.geometries):[]}dispose(){this._geometries.length=0}get layer(){return this._layer}set layer(t){j(null==this._layer||null==t,"Object3D can only be added to a single Layer"),this._layer=t}addGeometry(t){t.visible=this._visible,this._geometries.push(t);for(const i of this._highlightIds)t.addHighlight(i);this._emit("geometryAdded",{object:this,geometry:t}),this._highlightIds.size&&this._emit("highlightChanged",this),this._invalidateBoundingVolume()}removeGeometry(t){const i=this._geometries.splice(t,1)[0];if(i){for(const t of this._highlightIds)i.removeHighlight(t);this._emit("geometryRemoved",{object:this,geometry:i}),this._highlightIds.size&&this._emit("highlightChanged",this),this._invalidateBoundingVolume()}}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}geometryVertexAttributeUpdated(t,i,e=!1){this._emit("attributesChanged",{object:this,geometry:t,attribute:i,sync:e}),S(i)&&this._invalidateBoundingVolume()}get visible(){return this._visible}set visible(t){if(this._visible!==t){this._visible=t;for(const t of this._geometries)t.visible=this._visible;this._emit("visibilityChanged",this)}}maskOccludee(){const t=new p;for(const i of this._geometries)i.occludees=x(i.occludees,t);return this._emit("occlusionChanged",this),t}removeOcclude(t){for(const i of this._geometries)i.occludees=V(i.occludees,t);this._emit("occlusionChanged",this)}highlight(t){const i=new y(t);for(const e of this._geometries)e.addHighlight(i);return this._emit("highlightChanged",this),this._highlightIds.add(i),i}removeHighlight(t){this._highlightIds.delete(t);for(const i of this._geometries)i.removeHighlight(t);this._emit("highlightChanged",this)}removeStateID(t){0===t.channel?this.removeHighlight(t):this.removeOcclude(t)}getCombinedStaticTransformation(t,e){return i(e,this.transformation,t.transformation)}getCombinedShaderTransformation(t,e=o()){return i(e,this.effectiveTransformation,t.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=new B,this._validateBoundingVolume(this._bvWorldSpace,0)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=new B,this._validateBoundingVolume(this._bvObjectSpace,1)),this._bvObjectSpace}_validateBoundingVolume(t,i){const e=1===i;for(const s of this._geometries){const i=s.boundingInfo;i&&T(i,t,e?s.transformation:this.getCombinedShaderTransformation(s))}a(t.bounds.center,t.min,t.max,.5);for(const s of this._geometries){const i=s.boundingInfo;if(null==i)continue;const o=e?s.transformation:this.getCombinedShaderTransformation(s),r=v(o);h(O,i.boundingSphere.center,o);const a=n(O,t.bounds.center),m=i.boundingSphere.radius*r;t.bounds.radius=Math.max(t.bounds.radius,a+m)}}_invalidateBoundingVolume(){const t=this._bvWorldSpace?.bounds;this._bvObjectSpace=this._bvWorldSpace=void 0,this.layer&&t&&this.layer.notifyObjectBBChanged(this,t)}_emit(t,i){this.layer?.events.emit(t,i)}get geometries(){return this._geometries}get transformation(){return this._transformation??r}set transformation(t){this._transformation=e(this._transformation??o(),t),this._invalidateBoundingVolume(),this._emit("transformationChanged",this)}get shaderTransformation(){return this._shaderTransformation}set shaderTransformation(t){this._shaderTransformation=t?e(this._shaderTransformation??o(),t):null,this._invalidateBoundingVolume(),this._emit("shaderTransformationChanged",this)}get effectiveTransformation(){return this.shaderTransformation??this.transformation}get test(){}}class A{constructor(){this._data=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE]}get min(){return c(this._data[0],this._data[1],this._data[2])}get max(){return c(this._data[3],this._data[4],this._data[5])}minWith(t){const{_data:i}=this;i[0]=Math.min(i[0],t[0]),i[1]=Math.min(i[1],t[1]),i[2]=Math.min(i[2],t[2])}maxWith(t){const{_data:i}=this;i[3]=Math.max(i[3],t[0]),i[4]=Math.max(i[4],t[1]),i[5]=Math.max(i[5],t[2])}assignMinMax(t,i){for(let e=0;e<3;++e)this._data[0+e]=t[e],this._data[3+e]=i[e]}isEmpty(){return this._data[3]<this._data[0]&&this._data[4]<this._data[1]&&this._data[5]<this._data[2]}}class B extends A{constructor(){super(...arguments),this.bounds=new b}}function T(t,i,e){const o=t.boundingBox,r=_(o,w),a=f(o,I);if(s(e)){const t=m(C,e[12],e[13],e[14]);return d(M,r,t),d(U,a,t),i.minWith(M),void i.maxWith(U)}if(h(M,r,e),l(r,a))return i.minWith(M),void i.maxWith(M);h(U,a,e),i.minWith(M),i.minWith(U),i.maxWith(M),i.maxWith(U);for(let s=0;s<3;++s)g(M,r),g(U,a),M[s]=a[s],U[s]=r[s],h(M,M,e),h(U,U,e),i.minWith(M),i.minWith(U),i.maxWith(M),i.maxWith(U)}const C=u(),M=u(),U=u(),O=u(),w=u(),I=u();export{B as BoundingVolume,W as Object3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{fromValues as n,create as t}from"../../../../geometry/support/aaBoundingRect.js";import{screenPolygonIntersectsBounds as o,screenPolygonIntersectsTriangle as i}from"./screenPolygonOverlapUtils.js";function r(t,i,r){if(!r.visible)return null;const{boundingInfo:s}=r;if(s){const{bbMin:r,bbMax:e}=s;if(n(r[0]+i[0],r[1]+i[1],e[0]+i[0],e[1]+i[1],u),!o(t,u))return null}const c=r.positionAttribute,l=r.primitivePositionIndices;return e(t,i,0,l.length/3,l,c)}function e(n,t,o,r,e,u){const{data:p,stride:b}=u;for(let a=o;a<r;++a){const o=3*a;if(s(c,t,p,b,e[o]),s(l,t,p,b,e[o+1]),s(f,t,p,b,e[o+2]),i(n,c,l,f))return a}return null}function s(n,t,o,i,r){const e=i*r;n[0]=o[e]+t[0],n[1]=o[e+1]+t[1]}const u=t(),c=[0,0],l=[0,0],f=[0,0];export{r as intersectTriangleGeometryPolygon2D};
2
+ import{fromValues as n,create as t}from"../../../../geometry/support/aaBoundingRect.js";import{screenPolygonIntersectsBounds as o,screenPolygonIntersectsTriangle as i}from"./screenPolygonOverlapUtils.js";function r(t,i,r){if(!r.visible)return null;const{boundingInfo:s}=r;if(s){const{boundingBox:r}=s;if(n(r[0]+i[0],r[1]+i[1],r[3]+i[0],r[4]+i[1],u),!o(t,u))return null}const c=r.positionAttribute,l=r.primitivePositionIndices;return e(t,i,0,l.length/3,l,c)}function e(n,t,o,r,e,u){const{data:p,stride:d}=u;for(let g=o;g<r;++g){const o=3*g;if(s(c,t,p,d,e[o]),s(l,t,p,d,e[o+1]),s(f,t,p,d,e[o+2]),i(n,c,l,f))return g}return null}function s(n,t,o,i,r){const e=i*r;n[0]=o[e]+t[0],n[1]=o[e+1]+t[1]}const u=t(),c=[0,0],l=[0,0],f=[0,0];export{r as intersectTriangleGeometryPolygon2D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{sub as t,set as n,cross as o,normalize as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as c,setMax as s,create as r}from"../../../../geometry/support/aaBoundingBox.js";import{boundingInfoSubdivisionThreshold as u}from"./intersectionConstants.js";import{assert as f}from"./Util.js";class a{constructor(t=0,n=!1,o=!0){this.tolerance=t,this.isVerticalRay=n,this.normalRequired=o}}const l=r();function m(n,o,i,e,c,s){if(!n.visible)return;const r=t(E,e,i),{tolerance:u}=o,l=new a(u,!1,o.options.normalRequired);if(n.boundingInfo)f(0===n.type),h(n.boundingInfo,i,r,u,c,l,s);else{const t=n.positionAttribute,o=n.primitivePositionIndices;T(i,r,0,o.length/3,o,t.data,t.stride,c,l,s)}}const p=e();function h(t,n,o,i,e,r,f){if(null==t)return;const a=w(o,p);if(c(l,t.bbMin),s(l,t.bbMax),null!=e&&e.applyToAabb(l),U(l,n,a,i)){const{primitiveIndices:c,position:s}=t,a=c?c.length:s.indices.length/3;if(a>u){const c=t.getChildren();if(void 0!==c){for(const t of c)h(t,n,o,i,e,r,f);return}}q(n,o,0,a,s.indices,s.data,s.stride,c,e,r,f)}}const d=e();function b(n,o,i,e,c,s,r,u,f){const{data:a,stride:l}=s;T(n,t(E,o,n),i,e,c,a,l,r,u,f)}function M(t,n,o,i){if(!o.visible)return;const{boundingInfo:e}=o;if(e){const{bbMin:o,bbMax:i}=e;if(t<o[0]||t>i[0]||n<o[1]||n>i[1])return}const c=o.positionAttribute,s=o.primitivePositionIndices;x(t,n,0,s.length/3,s,c,i)}function x(t,n,o,i,e,c,s){const{data:r,stride:u}=c;for(let f=o;f<i;++f){const o=3*f,i=u*e[o],c=u*e[o+1],a=u*e[o+2],l=r[i+0]-t,m=r[i+1]-n,p=r[c+0]-t,h=r[c+1]-n,d=r[a+0]-t,b=r[a+1]-n,M=d*h-b*p,x=l*b-m*d,g=p*m-h*l;(M<0||x<0||g<0)&&(M>0||x>0||g>0)||s(0,null,f)}}function g(t,n,o,i,e,c,s,r,u,f=null,a=0){const l=t[0],m=t[1],p=t[2],h=n[0],b=n[1],M=n[2];for(let x=o;x<i;++x){const t=a+(f?.[x]??x),n=3*t,o=s*e[n],i=c[o],g=c[o+1],y=c[o+2],v=s*e[n+1],q=c[v],T=c[v+1],V=c[v+2],I=s*e[n+2],j=q-i,A=T-g,B=V-y,C=c[I]-i,P=c[I+1]-g,w=c[I+2]-y,U=b*w-P*M,k=M*C-w*h,z=h*P-C*b,E=j*U+A*k+B*z,F=E*E;if(F<=D)continue;const G=l-i,H=m-g,J=p-y,K=(G*U+H*k+J*z)*E;if(K<0||K>F)continue;const L=H*B-A*J,N=J*j-B*G,O=G*A-j*H,Q=(h*L+b*N+M*O)*E;if(Q<0||K+Q>F)continue;const S=(C*L+P*N+w*O)/E;if(S>=0){u(S,r?R(j,A,B,C,P,w,d):null,t)}}}function y(t,n,o,i,e,c,s,r){const u=t[0],f=t[1],a=t[2],l=n[0],m=n[1],p=n[2];for(let h=o;h<i;++h){const t=3*h,n=t+1,o=t+2,i=c*t,b=e[i],M=e[i+1],x=e[i+2],g=c*n,y=c*o,v=e[g]-b,q=e[g+1]-M,T=e[g+2]-x,V=e[y]-b,I=e[y+1]-M,j=e[y+2]-x,A=m*j-I*p,B=p*V-j*l,C=l*I-V*m,P=v*A+q*B+T*C,w=P*P;if(w<=D)continue;const U=u-b,k=f-M,z=a-x,E=(U*A+k*B+z*C)*P;if(E<0||E>w)continue;const F=k*T-q*z,G=z*v-T*U,H=U*q-v*k,J=(l*F+m*G+p*H)*P;if(J<0||E+J>w)continue;const K=(V*F+I*G+j*H)/P;if(K>=0){r(K,s?R(v,q,T,V,I,j,d):null,h)}}}function v(t,n,o,i,e,c,s,r,u,f,a,l=null,m=0){const p=t[0],h=t[1],b=t[2],M=n[0],x=n[1],g=n[2];for(let y=o;y<i;++y){const t=m+(l?.[y]??y),n=3*t,o=s*e[n],i=c[o],v=c[o+1],q=c[o+2],T=s*e[n+1],V=c[T],I=c[T+1],j=c[T+2],A=s*e[n+2],B=c[A],C=c[A+1],P=c[A+2],w=q-u,U=r/Math.sqrt(i*i+v*v+w*w),k=i+i*U,z=v+v*U,E=q+w*U,F=j-u,G=r/Math.sqrt(V*V+I*I+F*F),H=V+V*G,J=I+I*G,K=j+F*G,L=P-u,N=r/Math.sqrt(B*B+C*C+L*L),O=H-k,Q=J-z,S=K-E,W=B+B*N-k,X=C+C*N-z,Y=P+L*N-E,Z=x*Y-X*g,$=g*W-Y*M,_=M*X-W*x,tt=O*Z+Q*$+S*_,nt=tt*tt;if(nt<=D)continue;const ot=p-k,it=h-z,et=b-E,ct=(ot*Z+it*$+et*_)*tt;if(ct<0||ct>nt)continue;const st=it*S-Q*et,rt=et*O-S*ot,ut=ot*Q-O*it,ft=(M*st+x*rt+g*ut)*tt;if(ft<0||ct+ft>nt)continue;const at=(W*st+X*rt+Y*ut)/tt;if(at>=0){a(at,f?R(O,Q,S,W,X,Y,d):null,t)}}}function q(t,n,o,i,e,c,s,r,u,f,a){const l=t[0],m=t[1],p=t[2],h=n[0],b=n[1],M=n[2],{normalRequired:x}=f;for(let g=o;g<i;++g){const t=r[g],n=3*t,o=s*e[n];let i=c[o],f=c[o+1],y=c[o+2];const v=s*e[n+1];let q=c[v],T=c[v+1],V=c[v+2];const I=s*e[n+2];let j=c[I],A=c[I+1],B=c[I+2];null!=u&&([i,f,y]=u.applyToVertex(G,i,f,y,g),[q,T,V]=u.applyToVertex(G,q,T,V,g),[j,A,B]=u.applyToVertex(G,j,A,B,g));const C=q-i,P=T-f,w=V-y,U=j-i,k=A-f,z=B-y,E=b*z-k*M,F=M*U-z*h,H=h*k-U*b,J=C*E+P*F+w*H,K=J*J;if(K<=D)continue;const L=l-i,N=m-f,O=p-y,Q=(L*E+N*F+O*H)*J;if(Q<0||Q>K)continue;const S=N*w-P*O,W=O*C-w*L,X=L*P-C*N,Y=(h*S+b*W+M*X)*J;if(Y<0||Q+Y>K)continue;const Z=(U*S+k*W+z*X)/J;if(Z>=0){a(Z,x?R(C,P,w,U,k,z,d):null,t)}}}function T(o,i,e,c,s,r,u,f,a,l){const m=i,p=F,h=Math.abs(m[0]),d=Math.abs(m[1]),b=Math.abs(m[2]),M=h>=d?h>=b?0:2:d>=b?1:2,x=M,g=m[x]<0?2:1,y=(M+g)%3,v=(M+(3-g))%3,q=m[y]/m[x],T=m[v]/m[x],R=1/m[x],B=V,C=I,P=j,{normalRequired:w}=a;for(let V=e;V<c;++V){const i=3*V,e=u*s[i];n(p[0],r[e+0],r[e+1],r[e+2]);const c=u*s[i+1];n(p[1],r[c+0],r[c+1],r[c+2]);const a=u*s[i+2];n(p[2],r[a+0],r[a+1],r[a+2]),f&&(f.applyToVertex(p[0],p[0][0],p[0][1],p[0][2],V),f.applyToVertex(p[1],p[1][0],p[1][1],p[1][2],V),f.applyToVertex(p[2],p[2][0],p[2][1],p[2][2],V)),t(B,p[0],o),t(C,p[1],o),t(P,p[2],o);const m=B[y]-q*B[x],h=B[v]-T*B[x],d=C[y]-q*C[x],b=C[v]-T*C[x],M=P[y]-q*P[x],g=P[v]-T*P[x],I=M*b-g*d,j=m*g-h*M,U=d*h-b*m;if((I<0||j<0||U<0)&&(I>0||j>0||U>0))continue;const k=I+j+U;if(0===k)continue;const z=I*(R*B[x])+j*(R*C[x])+U*(R*P[x]);if(z*Math.sign(k)<0)continue;const D=z/k;if(D>=0){l(D,w?A(p):null,V)}}}const V=e(),I=e(),j=e();function R(t,e,c,s,r,u,f){return n(B,t,e,c),n(C,s,r,u),o(f,B,C),i(f,f),f}function A(n){return t(B,n[1],n[0]),t(C,n[2],n[0]),o(d,B,C),i(d,d),d}const B=e(),C=e();function P(t,o,i){return n(i,1/(o[0]-t[0]),1/(o[1]-t[1]),1/(o[2]-t[2]))}function w(t,o){return n(o,1/t[0],1/t[1],1/t[2])}function U(t,n,o,i){return k(t,n,o,i,1/0)}function k(t,n,o,i,e){const c=(t[0]-i-n[0])*o[0],s=(t[3]+i-n[0])*o[0];let r=Math.min(c,s),u=Math.max(c,s);const f=(t[1]-i-n[1])*o[1],a=(t[4]+i-n[1])*o[1];if(u=Math.min(u,Math.max(f,a)),u<0)return!1;if(r=Math.max(r,Math.min(f,a)),r>u)return!1;const l=(t[2]-i-n[2])*o[2],m=(t[5]+i-n[2])*o[2];return u=Math.min(u,Math.max(l,m)),!(u<0)&&(r=Math.max(r,Math.min(l,m)),!(r>u)&&r<e)}const z=1e-7,D=z*z,E=e(),F=[e(),e(),e()],G=e();export{a as MeshIntersectionOptions,P as computeInvDir,w as computeInvDirFromDirection,R as computeNormalFromBarycentric,U as intersectAabbInvDir,k as intersectAabbInvDirBefore,g as intersectRayTriangles,T as intersectRayTrianglesWithDisplacementWatertight,v as intersectRayTrianglesWithVerticalOffsetENUGlobal,y as intersectRenderGeometryTriangles,m as intersectTriangleGeometry,M as intersectTriangleGeometry2D,b as intersectTriangles,x as intersectTriangles2d,z as triangleRayParallelTolerance};
2
+ import{sub as n,set as t,cross as o,normalize as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as e,create as s}from"../../../../geometry/support/aaBoundingBox.js";import{boundingInfoSubdivisionThreshold as r}from"./intersectionConstants.js";import{assert as u}from"./Util.js";class f{constructor(n=0,t=!1,o=!0){this.tolerance=n,this.isVerticalRay=t,this.normalRequired=o}}const l=s();function a(t,o,i,c,e,s){if(!t.visible)return;const r=n(D,c,i),{tolerance:l}=o,a=new f(l,!1,o.options.normalRequired);if(t.boundingInfo)u(0===t.type),p(t.boundingInfo,i,r,l,e,a,s);else{const n=t.positionAttribute,o=t.primitivePositionIndices;q(i,r,0,o.length/3,o,n.data,n.stride,e,a,s)}}const m=c();function p(n,t,o,i,c,s,u){if(null==n)return;const f=w(o,m);if(e(l,n.boundingBox),null!=c&&c.applyToAabb(l),C(l,t,f,i)){const{primitiveIndices:e,position:f}=n,l=e?e.length:f.indices.length/3;if(l>r){const e=n.children;if(void 0!==e){for(const n of e)p(n,t,o,i,c,s,u);return}}v(t,o,0,l,f.indices,f.data,f.stride,e,c,s,u)}}const h=c();function d(t,o,i,c,e,s,r,u,f){const{data:l,stride:a}=s;q(t,n(D,o,t),i,c,e,l,a,r,u,f)}function x(n,t,o,i){if(!o.visible)return;const{boundingInfo:c}=o;if(c){const{boundingBox:o}=c;if(n<o[0]||n>o[3]||t<o[1]||t>o[4])return}const e=o.positionAttribute,s=o.primitivePositionIndices;M(n,t,0,s.length/3,s,e,i)}function M(n,t,o,i,c,e,s){const{data:r,stride:u}=e;for(let f=o;f<i;++f){const o=3*f,i=u*c[o],e=u*c[o+1],l=u*c[o+2],a=r[i+0]-n,m=r[i+1]-t,p=r[e+0]-n,h=r[e+1]-t,d=r[l+0]-n,x=r[l+1]-t,M=d*h-x*p,b=a*x-m*d,g=p*m-h*a;(M<0||b<0||g<0)&&(M>0||b>0||g>0)||s(0,null,f)}}function b(n,t,o,i,c,e,s,r,u,f=null,l=0){const a=n[0],m=n[1],p=n[2],d=t[0],x=t[1],M=t[2];for(let b=o;b<i;++b){const n=l+(f?.[b]??b),t=3*n,o=s*c[t],i=e[o],g=e[o+1],y=e[o+2],v=s*c[t+1],q=e[v],T=e[v+1],V=e[v+2],I=s*c[t+2],R=q-i,B=T-g,A=V-y,P=e[I]-i,w=e[I+1]-g,C=e[I+2]-y,U=x*C-w*M,k=M*P-C*d,D=d*w-P*x,E=R*U+B*k+A*D,F=E*E;if(F<=z)continue;const G=a-i,H=m-g,J=p-y,K=(G*U+H*k+J*D)*E;if(K<0||K>F)continue;const L=H*A-B*J,N=J*R-A*G,O=G*B-R*H,Q=(d*L+x*N+M*O)*E;if(Q<0||K+Q>F)continue;const S=(P*L+w*N+C*O)/E;if(S>=0){u(S,r?j(R,B,A,P,w,C,h):null,n)}}}function g(n,t,o,i,c,e,s,r){const u=n[0],f=n[1],l=n[2],a=t[0],m=t[1],p=t[2];for(let d=o;d<i;++d){const n=3*d,t=n+1,o=n+2,i=e*n,x=c[i],M=c[i+1],b=c[i+2],g=e*t,y=e*o,v=c[g]-x,q=c[g+1]-M,T=c[g+2]-b,V=c[y]-x,I=c[y+1]-M,R=c[y+2]-b,B=m*R-I*p,A=p*V-R*a,P=a*I-V*m,w=v*B+q*A+T*P,C=w*w;if(C<=z)continue;const U=u-x,k=f-M,D=l-b,E=(U*B+k*A+D*P)*w;if(E<0||E>C)continue;const F=k*T-q*D,G=D*v-T*U,H=U*q-v*k,J=(a*F+m*G+p*H)*w;if(J<0||E+J>C)continue;const K=(V*F+I*G+R*H)/w;if(K>=0){r(K,s?j(v,q,T,V,I,R,h):null,d)}}}function y(n,t,o,i,c,e,s,r,u,f,l,a=null,m=0){const p=n[0],d=n[1],x=n[2],M=t[0],b=t[1],g=t[2];for(let y=o;y<i;++y){const n=m+(a?.[y]??y),t=3*n,o=s*c[t],i=e[o],v=e[o+1],q=e[o+2],T=s*c[t+1],V=e[T],I=e[T+1],R=e[T+2],B=s*c[t+2],A=e[B],P=e[B+1],w=e[B+2],C=q-u,U=r/Math.sqrt(i*i+v*v+C*C),k=i+i*U,D=v+v*U,E=q+C*U,F=R-u,G=r/Math.sqrt(V*V+I*I+F*F),H=V+V*G,J=I+I*G,K=R+F*G,L=w-u,N=r/Math.sqrt(A*A+P*P+L*L),O=H-k,Q=J-D,S=K-E,W=A+A*N-k,X=P+P*N-D,Y=w+L*N-E,Z=b*Y-X*g,$=g*W-Y*M,_=M*X-W*b,nn=O*Z+Q*$+S*_,tn=nn*nn;if(tn<=z)continue;const on=p-k,cn=d-D,en=x-E,sn=(on*Z+cn*$+en*_)*nn;if(sn<0||sn>tn)continue;const rn=cn*S-Q*en,un=en*O-S*on,fn=on*Q-O*cn,ln=(M*rn+b*un+g*fn)*nn;if(ln<0||sn+ln>tn)continue;const an=(W*rn+X*un+Y*fn)/nn;if(an>=0){l(an,f?j(O,Q,S,W,X,Y,h):null,n)}}}function v(n,t,o,i,c,e,s,r,u,f,l){const a=n[0],m=n[1],p=n[2],d=t[0],x=t[1],M=t[2],{normalRequired:b}=f;for(let g=o;g<i;++g){const n=r[g],t=3*n,o=s*c[t];let i=e[o],f=e[o+1],y=e[o+2];const v=s*c[t+1];let q=e[v],T=e[v+1],V=e[v+2];const I=s*c[t+2];let R=e[I],B=e[I+1],A=e[I+2];null!=u&&([i,f,y]=u.applyToVertex(F,i,f,y,g),[q,T,V]=u.applyToVertex(F,q,T,V,g),[R,B,A]=u.applyToVertex(F,R,B,A,g));const P=q-i,w=T-f,C=V-y,U=R-i,k=B-f,D=A-y,E=x*D-k*M,G=M*U-D*d,H=d*k-U*x,J=P*E+w*G+C*H,K=J*J;if(K<=z)continue;const L=a-i,N=m-f,O=p-y,Q=(L*E+N*G+O*H)*J;if(Q<0||Q>K)continue;const S=N*C-w*O,W=O*P-C*L,X=L*w-P*N,Y=(d*S+x*W+M*X)*J;if(Y<0||Q+Y>K)continue;const Z=(U*S+k*W+D*X)/J;if(Z>=0){l(Z,b?j(P,w,C,U,k,D,h):null,n)}}}function q(o,i,c,e,s,r,u,f,l,a){const m=i,p=E,h=Math.abs(m[0]),d=Math.abs(m[1]),x=Math.abs(m[2]),M=h>=d?h>=x?0:2:d>=x?1:2,b=M,g=m[b]<0?2:1,y=(M+g)%3,v=(M+(3-g))%3,q=m[y]/m[b],j=m[v]/m[b],B=1/m[b],A=T,P=V,w=I,{normalRequired:C}=l;for(let T=c;T<e;++T){const i=3*T,c=u*s[i];t(p[0],r[c+0],r[c+1],r[c+2]);const e=u*s[i+1];t(p[1],r[e+0],r[e+1],r[e+2]);const l=u*s[i+2];t(p[2],r[l+0],r[l+1],r[l+2]),f&&(f.applyToVertex(p[0],p[0][0],p[0][1],p[0][2],T),f.applyToVertex(p[1],p[1][0],p[1][1],p[1][2],T),f.applyToVertex(p[2],p[2][0],p[2][1],p[2][2],T)),n(A,p[0],o),n(P,p[1],o),n(w,p[2],o);const m=A[y]-q*A[b],h=A[v]-j*A[b],d=P[y]-q*P[b],x=P[v]-j*P[b],M=w[y]-q*w[b],g=w[v]-j*w[b],V=M*x-g*d,I=m*g-h*M,U=d*h-x*m;if((V<0||I<0||U<0)&&(V>0||I>0||U>0))continue;const k=V+I+U;if(0===k)continue;const z=V*(B*A[b])+I*(B*P[b])+U*(B*w[b]);if(z*Math.sign(k)<0)continue;const D=z/k;if(D>=0){a(D,C?R(p):null,T)}}}const T=c(),V=c(),I=c();function j(n,c,e,s,r,u,f){return t(B,n,c,e),t(A,s,r,u),o(f,B,A),i(f,f),f}function R(t){return n(B,t[1],t[0]),n(A,t[2],t[0]),o(h,B,A),i(h,h),h}const B=c(),A=c();function P(n,o,i){return t(i,1/(o[0]-n[0]),1/(o[1]-n[1]),1/(o[2]-n[2]))}function w(n,o){return t(o,1/n[0],1/n[1],1/n[2])}function C(n,t,o,i){return U(n,t,o,i,1/0)}function U(n,t,o,i,c){const e=(n[0]-i-t[0])*o[0],s=(n[3]+i-t[0])*o[0];let r=Math.min(e,s),u=Math.max(e,s);const f=(n[1]-i-t[1])*o[1],l=(n[4]+i-t[1])*o[1];if(u=Math.min(u,Math.max(f,l)),u<0)return!1;if(r=Math.max(r,Math.min(f,l)),r>u)return!1;const a=(n[2]-i-t[2])*o[2],m=(n[5]+i-t[2])*o[2];return u=Math.min(u,Math.max(a,m)),!(u<0)&&(r=Math.max(r,Math.min(a,m)),!(r>u)&&r<c)}const k=1e-7,z=k*k,D=c(),E=[c(),c(),c()],F=c();export{f as MeshIntersectionOptions,P as computeInvDir,w as computeInvDirFromDirection,j as computeNormalFromBarycentric,C as intersectAabbInvDir,U as intersectAabbInvDirBefore,b as intersectRayTriangles,q as intersectRayTrianglesWithDisplacementWatertight,y as intersectRayTrianglesWithVerticalOffsetENUGlobal,g as intersectRenderGeometryTriangles,a as intersectTriangleGeometry,x as intersectTriangleGeometry2D,d as intersectTriangles,M as intersectTriangles2d,k as triangleRayParallelTolerance};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{generateUID as t}from"../../../../core/uid.js";import{copy as r,multiply as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{NullSphere as s,Sphere as n}from"../../../../geometry/support/sphere.js";import{maxScale as a}from"../../support/mathUtils.js";class h{constructor(r,i={}){this.geometry=r,this.screenToWorldRatio=1,this._transformation=e(),this._shaderTransformation=null,this._boundingSphere=null,this.id=t(),this.layerViewUid=i.layerViewUid,this.graphicUid=i.graphicUid,this.castShadow=i.castShadow??!1,i.objectShaderTransformation&&this.objectShaderTransformationChanged(i.objectShaderTransformation)}get transformation(){return this._transformation}set transformation(t){r(this._transformation,t),this._boundingSphere=null}get boundingInfo(){return this.geometry.boundingInfo}objectShaderTransformationChanged(t){null==t?this._shaderTransformation=null:(this._shaderTransformation??=e(),i(this._shaderTransformation,t,this.geometry.transformation)),this._boundingSphere=null}get boundingSphere(){return this.boundingInfo?(null==this._boundingSphere&&(this._boundingSphere??=new n,o(this._boundingSphere.center,this.boundingInfo.center,this.shaderTransformation),this._boundingSphere.radius=this.boundingInfo.radius*a(this.shaderTransformation)),this._boundingSphere):s}get material(){return this.geometry.material}get type(){return this.geometry.type}get shaderTransformation(){return this._shaderTransformation??this.transformation}get attributes(){return this.geometry.attributes}get positionAttribute(){return this.geometry.positionAttribute}get primitivePositionIndices(){return this.geometry.primitivePositionIndices}foreachHighlightOptions(t){this.geometry.foreachHighlightOptions(t)}get hasHighlights(){return this.geometry.hasHighlights}get occludees(){return this.geometry.occludees}get visible(){return this.geometry.visible}set visible(t){this.geometry.visible=t}}class m extends h{}export{h as RenderGeometry,m as ValidatedRenderGeometry};
2
+ import{generateUID as t}from"../../../../core/uid.js";import{copy as r,multiply as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{NullSphere as s,Sphere as n}from"../../../../geometry/support/sphere.js";import{maxScale as h}from"../../support/mathUtils.js";class a{constructor(r,i={}){this.geometry=r,this.screenToWorldRatio=1,this._transformation=e(),this._shaderTransformation=null,this._boundingSphere=null,this.id=t(),this.layerViewUid=i.layerViewUid,this.graphicUid=i.graphicUid,this.castShadow=i.castShadow??!1,i.objectShaderTransformation&&this.objectShaderTransformationChanged(i.objectShaderTransformation)}get transformation(){return this._transformation}set transformation(t){r(this._transformation,t),this._boundingSphere=null}get boundingInfo(){return this.geometry.boundingInfo}objectShaderTransformationChanged(t){null==t?this._shaderTransformation=null:(this._shaderTransformation??=e(),i(this._shaderTransformation,t,this.geometry.transformation)),this._boundingSphere=null}get boundingSphere(){return this.boundingInfo?(null==this._boundingSphere&&(this._boundingSphere??=new n,o(this._boundingSphere.center,this.boundingInfo.boundingSphere.center,this.shaderTransformation),this._boundingSphere.radius=this.boundingInfo.boundingSphere.radius*h(this.shaderTransformation)),this._boundingSphere):s}get material(){return this.geometry.material}get type(){return this.geometry.type}get shaderTransformation(){return this._shaderTransformation??this.transformation}get attributes(){return this.geometry.attributes}get positionAttribute(){return this.geometry.positionAttribute}get primitivePositionIndices(){return this.geometry.primitivePositionIndices}foreachHighlightOptions(t){this.geometry.foreachHighlightOptions(t)}get hasHighlights(){return this.geometry.hasHighlights}get occludees(){return this.geometry.occludees}get visible(){return this.geometry.visible}set visible(t){this.geometry.visible=t}}class g extends a{}export{a as RenderGeometry,g as ValidatedRenderGeometry};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/PooledArray.js";import{multiply as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4Z as n,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{lerp as a}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{intersectsSphere as o}from"../../../../geometry/support/frustum.js";import{Sphere as f}from"../../../../geometry/support/sphere.js";import{maxScale as h}from"../../support/mathUtils.js";import{DepthRange as c}from"./DepthRange.js";import{assert as u}from"./Util.js";const l=1e4,d=100,m=500,_=500,g=.1;function p(e,t,r,n){let i=0;if(!t.some(e=>!!e.material&&(i+=e.numGeometries,i>=l)))return W.compute(e,t,n);const a=new c;return r.forEach(t=>a.union(b(e,t))),a}function b(e,t){if(!t.visible)return;const r=new c,n=t.getSpatialQueryAccelerator();return n?w(r,e,n):M(r,e,t.objects),r}function w(e,t,r){const{eye:n,viewForward:i,frustum:a}=t,s=e=>e.visible,o=r.objectCount;if(o<m)S.set(t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(n,i,1,S,(r,n)=>{j(e,t,r),S.far=e.near,n.setRange(S)},a,s),S.set(Math.max(e.far,t.near),t.far),r.forEachInDepthRange(n,i,-1,S,(r,n)=>{j(e,t,r),S.near=e.far,n.setRange(S)},a,s);else{const n=Math.max(Math.min(o,_),Math.ceil(o*g)),f=r.findClosest(i,1,a,s,n),h=r.findClosest(i,-1,a,s,n);f&&h&&(R(e,t,f.boundingVolumeWorldSpace.bounds),R(e,t,h.boundingVolumeWorldSpace.bounds))}}function M(e,t,r){F.clear(),r.forEach(e=>{e.visible&&0!==e.geometries.length&&F.add(e,t)}),F.empty||(F.sort(),S.set(t.near,Math.min(e.near,t.far)),F.forEachInDepthRange(S,1,(r,n)=>{n<e.near&&j(e,t,r)}),S.set(Math.max(e.far,t.near),t.far),F.forEachInDepthRange(S,-1,(t,r,n)=>{e.far=Math.max(e.far,n)}))}function j(e,r,n){if(!n.visible)return;if(!o(r.frustum,n.boundingVolumeWorldSpace.bounds))return;const i=n.transformation,a=E;n.geometries.forEach(n=>{t(a,i,n.transformation);const s=h(a);x(e,r,n.boundingInfo,a,s)})}function x(e,t,r,n,a){if(null==r)return;i(D.center,r.center,n);const{eye:s,viewForward:f}=t,h=f[0]*(D.center[0]-s[0])+f[1]*(D.center[1]-s[1])+f[2]*(D.center[2]-s[2]);if(D.radius=r.radius*a,!(h-D.radius>e.near&&h+D.radius<e.far)&&o(t.frustum,D))if(r.radius>d&&r.getChildren())for(const i of r.getChildren())x(e,t,i,n,a);else N.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,n,r.bbMin,r.bbMax)}function R(e,t,r){const n=t.eye,i=t.viewForward,a=(r.center[0]-n[0])*i[0]+(r.center[1]-n[1])*i[1]+(r.center[2]-n[2])*i[2];e.near=Math.min(e.near,a-r.radius),e.far=Math.max(e.far,a+r.radius)}class v{constructor(){this._items=new e({allocator:e=>e||{object:null,distance:0,near:0,far:0},deallocator:e=>(e.object=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e,t){const r=t.eye,n=t.viewForward,i=e.boundingVolumeWorldSpace.bounds,a=(i.center[0]-r[0])*n[0]+(i.center[1]-r[1])*n[1]+(i.center[2]-r[2])*n[2];if(!Number.isFinite(a))return;const s=this._items.pushNew();s.object=e,s.distance=a,s.near=a-i.radius,s.far=a+i.radius}sort(){this._items.sort((e,t)=>e.distance-t.distance)}forEachInDepthRange(e,t,r){if(1===t)for(let n=0;n<this._items.length;++n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}else for(let n=this._items.length-1;n>=0;--n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}}}class C{constructor(){this._geometries=new Array,this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._looseRange=new c(0,0)}compute(e,t,r){this._reset();const{viewMatrix:i}=e;t.forEach(e=>{e.forEachGeometry(e=>{if(!e.visible||0===r&&!e.castShadow)return;const t=e.boundingSphere,a=n(t.center,i),s=a-t.radius,o=a+t.radius;this._geometries.push(e),this._near.push(-o),this._far.push(-s)})});const a=new c;if(0===this._geometries.length)return a;for(let n=0;n<this._geometries.length;++n)this._near[n]>a.far&&(a.far=this._near[n]),this._near[n]>2&&this._far[n]<a.near&&(a.near=this._far[n]);const s=this._looseRange;s.near=Math.max(.5*a.near,2),s.far=2*a.far;let o=0,f=0;for(let n=0;n<this._geometries.length;++n)this._near[n]<a.near&&(this._near[n]>=s.near?a.near=this._near[n]:this._nearCandidates[o++]=n),this._far[n]>a.far&&(this._far[n]<=s.far?a.far=this._far[n]:this._farCandidates[f++]=n);if(0===this._nearCandidates.length&&0===this._farCandidates.length)return a;this._nearCandidates.sort((e,t)=>this._near[e]<this._near[t]?-1:this._near[e]>this._near[t]?1:0),this._farCandidates.sort((e,t)=>this._far[e]<this._far[t]?1:this._far[e]>this._far[t]?-1:0);for(let n=0;n<this._nearCandidates.length;++n){const t=this._nearCandidates[n];if(this._near[t]<a.near){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:i}=r;this._includeNearBoundingInfoRec(e,n,i,a)}}for(let n=0;n<this._farCandidates.length;++n){const t=this._farCandidates[n];if(this._far[t]>a.far){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:i}=r;this._includeFarBoundingInfoRec(e,n,i,a)}}return this._reset(),a}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0}_isOutsideSidePlanes(e,t){const{center:r,radius:n}=e;return t[0][0]*r[0]+t[0][1]*r[1]+t[0][2]*r[2]+t[0][3]>n||t[1][0]*r[0]+t[1][1]*r[1]+t[1][2]*r[2]+t[1][3]>n||t[2][0]*r[0]+t[2][1]*r[1]+t[2][2]*r[2]+t[2][3]>n||t[3][0]*r[0]+t[3][1]*r[1]+t[3][2]*r[2]+t[3][3]>n}_includeNearBoundingInfoRec(e,t,r,a){if(null==t)return;const s=t.center;i(D.center,s,r),D.radius=t.radius*h(r);const{frustum:o}=e;if(this._isOutsideSidePlanes(D,o))return;const f=D.radius,{viewMatrix:c}=e,u=n(D.center,c),l=u+f;if(!(-(u-f)<2||-l>=a.near))if(-l>this._looseRange.near)a.near=-l;else{if(f>d){const n=t.getChildren();if(void 0!==n){for(const t of n)this._includeNearBoundingInfoRec(e,t,r,a);return}}N.unionDepthRangeWithAABB(a,e.viewProjectionMatrix,r,t.bbMin,t.bbMax)}}_includeFarBoundingInfoRec(e,t,r,a){if(null==t)return;const s=t.center;i(D.center,s,r),D.radius=t.radius*h(r);const{frustum:o}=e;if(this._isOutsideSidePlanes(D,o))return;const{viewMatrix:f,viewProjectionMatrix:c}=e,u=n(D.center,f)-D.radius;if(!(-u<=a.far))if(-u<this._looseRange.far)a.far=-u;else{if(D.radius>d){const n=t.getChildren();if(void 0!==n){for(const t of n)this._includeFarBoundingInfoRec(e,t,r,a);return}}N.unionDepthRangeWithAABB(a,c,r,t.bbMin,t.bbMax)}}}class B{constructor(){this._modelViewProj=r(),this._clipPosition=[s(),s(),s(),s(),s(),s(),s(),s()]}unionDepthRangeWithAABB(e,r,n,i,a){const s=this._modelViewProj;t(s,r,n);let o=!1;for(let t=0;t<8;++t){const e=this._clipPosition[t],r=0===t||3===t||4===t||7===t?i[0]:a[0],n=0===t||1===t||4===t||5===t?i[1]:a[1],o=t<4?i[2]:a[2];e[0]=s[0]*r+s[4]*n+s[8]*o+s[12],e[1]=s[1]*r+s[5]*n+s[9]*o+s[13],e[2]=s[2]*r+s[6]*n+s[10]*o+s[14],e[3]=s[3]*r+s[7]*n+s[11]*o+s[15]}for(let t=0;t<12;++t){const r=I(this._clipPosition[A[t][0]],this._clipPosition[A[t][1]],this._clipPosition[A[t][2]]);let n=!0;for(let e=0;e<r.length;++e){if(r[e][3]>=2){n=!1;break}}if(!n){o=!0;for(let t=0;t<r.length;++t){const n=r[t][3];Number.isFinite(n)&&(e.near=Math.min(n,e.near),e.far=Math.max(n,e.far))}}}return o}}function I(e,t,r){let n=[e,t,r];for(let i=0;i<4;++i){const e=n;n=[];for(let t=0;t<e.length;++t){const r=e[t],a=e[(t+1)%e.length];P(a,i)?(P(r,i)||n.push(y(r,a,i)),n.push(a)):P(r,i)&&n.push(y(r,a,i))}}return n}function P(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void u(!1)}function y(e,t,r){let n=0;return 0===r?n=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?n=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?n=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(n=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),a(s(),e,t,n)}const A=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],D=new f,E=r(),S=new c,F=new v,W=new C,N=new B;export{p as depthRangeFromScene};
2
+ import e from"../../../../core/PooledArray.js";import{multiply as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4Z as n,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{lerp as a}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{intersectsSphere as o}from"../../../../geometry/support/frustum.js";import{Sphere as h}from"../../../../geometry/support/sphere.js";import{maxScale as f}from"../../support/mathUtils.js";import{DepthRange as c}from"./DepthRange.js";import{assert as u}from"./Util.js";const d=1e4,l=100,m=500,g=500,_=.1;function p(e,t,r,n){let i=0;if(!t.some(e=>!!e.material&&(i+=e.numGeometries,i>=d)))return W.compute(e,t,n);const a=new c;return r.forEach(t=>a.union(b(e,t))),a}function b(e,t){if(!t.visible)return;const r=new c,n=t.getSpatialQueryAccelerator();return n?w(r,e,n):j(r,e,t.objects),r}function w(e,t,r){const{eye:n,viewForward:i,frustum:a}=t,s=e=>e.visible,o=r.objectCount;if(o<m)E.set(t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(n,i,1,E,(r,n)=>{x(e,t,r),E.far=e.near,n.setRange(E)},a,s),E.set(Math.max(e.far,t.near),t.far),r.forEachInDepthRange(n,i,-1,E,(r,n)=>{x(e,t,r),E.near=e.far,n.setRange(E)},a,s);else{const n=Math.max(Math.min(o,g),Math.ceil(o*_)),h=r.findClosest(i,1,a,s,n),f=r.findClosest(i,-1,a,s,n);h&&f&&(v(e,t,h.boundingVolumeWorldSpace.bounds),v(e,t,f.boundingVolumeWorldSpace.bounds))}}function j(e,t,r){F.clear(),r.forEach(e=>{e.visible&&0!==e.geometries.length&&F.add(e,t)}),F.empty||(F.sort(),E.set(t.near,Math.min(e.near,t.far)),F.forEachInDepthRange(E,1,(r,n)=>{n<e.near&&x(e,t,r)}),E.set(Math.max(e.far,t.near),t.far),F.forEachInDepthRange(E,-1,(t,r,n)=>{e.far=Math.max(e.far,n)}))}function x(e,r,n){if(!n.visible)return;if(!o(r.frustum,n.boundingVolumeWorldSpace.bounds))return;const i=n.transformation,a=D;n.geometries.forEach(n=>{t(a,i,n.transformation);const s=f(a);R(e,r,n.boundingInfo,a,s)})}function R(e,t,r,n,a){if(null==r)return;i(A.center,r.boundingSphere.center,n);const{eye:s,viewForward:h}=t,f=h[0]*(A.center[0]-s[0])+h[1]*(A.center[1]-s[1])+h[2]*(A.center[2]-s[2]);if(A.radius=r.boundingSphere.radius*a,!(f-A.radius>e.near&&f+A.radius<e.far)&&o(t.frustum,A))if(r.boundingSphere.radius>l&&r.children)for(const i of r.children)R(e,t,i,n,a);else N.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,n,r.boundingBox)}function v(e,t,r){const n=t.eye,i=t.viewForward,a=(r.center[0]-n[0])*i[0]+(r.center[1]-n[1])*i[1]+(r.center[2]-n[2])*i[2];e.near=Math.min(e.near,a-r.radius),e.far=Math.max(e.far,a+r.radius)}class M{constructor(){this._items=new e({allocator:e=>e||{object:null,distance:0,near:0,far:0},deallocator:e=>(e.object=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e,t){const r=t.eye,n=t.viewForward,i=e.boundingVolumeWorldSpace.bounds,a=(i.center[0]-r[0])*n[0]+(i.center[1]-r[1])*n[1]+(i.center[2]-r[2])*n[2];if(!Number.isFinite(a))return;const s=this._items.pushNew();s.object=e,s.distance=a,s.near=a-i.radius,s.far=a+i.radius}sort(){this._items.sort((e,t)=>e.distance-t.distance)}forEachInDepthRange(e,t,r){if(1===t)for(let n=0;n<this._items.length;++n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}else for(let n=this._items.length-1;n>=0;--n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}}}class B{constructor(){this._geometries=new Array,this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._looseRange=new c(0,0)}compute(e,t,r){this._reset();const{viewMatrix:i}=e;t.forEach(e=>{e.forEachGeometry(e=>{if(!e.visible||0===r&&!e.castShadow)return;const t=e.boundingSphere,a=n(t.center,i),s=a-t.radius,o=a+t.radius;this._geometries.push(e),this._near.push(-o),this._far.push(-s)})});const a=new c;if(0===this._geometries.length)return a;for(let n=0;n<this._geometries.length;++n)this._near[n]>a.far&&(a.far=this._near[n]),this._near[n]>2&&this._far[n]<a.near&&(a.near=this._far[n]);const s=this._looseRange;s.near=Math.max(.5*a.near,2),s.far=2*a.far;let o=0,h=0;for(let n=0;n<this._geometries.length;++n)this._near[n]<a.near&&(this._near[n]>=s.near?a.near=this._near[n]:this._nearCandidates[o++]=n),this._far[n]>a.far&&(this._far[n]<=s.far?a.far=this._far[n]:this._farCandidates[h++]=n);if(0===this._nearCandidates.length&&0===this._farCandidates.length)return a;this._nearCandidates.sort((e,t)=>this._near[e]<this._near[t]?-1:this._near[e]>this._near[t]?1:0),this._farCandidates.sort((e,t)=>this._far[e]<this._far[t]?1:this._far[e]>this._far[t]?-1:0);for(let n=0;n<this._nearCandidates.length;++n){const t=this._nearCandidates[n];if(this._near[t]<a.near){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:i}=r;this._includeNearBoundingInfoRec(e,n,i,a)}}for(let n=0;n<this._farCandidates.length;++n){const t=this._farCandidates[n];if(this._far[t]>a.far){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:i}=r;this._includeFarBoundingInfoRec(e,n,i,a)}}return this._reset(),a}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0}_isOutsideSidePlanes(e,t){const{center:r,radius:n}=e;return t[0][0]*r[0]+t[0][1]*r[1]+t[0][2]*r[2]+t[0][3]>n||t[1][0]*r[0]+t[1][1]*r[1]+t[1][2]*r[2]+t[1][3]>n||t[2][0]*r[0]+t[2][1]*r[1]+t[2][2]*r[2]+t[2][3]>n||t[3][0]*r[0]+t[3][1]*r[1]+t[3][2]*r[2]+t[3][3]>n}_includeNearBoundingInfoRec(e,t,r,a){if(null==t)return;i(A.center,t.boundingSphere.center,r),A.radius=t.boundingSphere.radius*f(r);const{frustum:s}=e;if(this._isOutsideSidePlanes(A,s))return;const o=A.radius,{viewMatrix:h}=e,c=n(A.center,h),u=c+o;if(!(-(c-o)<2||-u>=a.near))if(-u>this._looseRange.near)a.near=-u;else{if(o>l){const n=t.children;if(void 0!==n){for(const t of n)this._includeNearBoundingInfoRec(e,t,r,a);return}}N.unionDepthRangeWithAABB(a,e.viewProjectionMatrix,r,t.boundingBox)}}_includeFarBoundingInfoRec(e,t,r,a){if(null==t)return;i(A.center,t.boundingSphere.center,r),A.radius=t.boundingSphere.radius*f(r);const{frustum:s}=e;if(this._isOutsideSidePlanes(A,s))return;const{viewMatrix:o,viewProjectionMatrix:h}=e,c=n(A.center,o)-A.radius;if(!(-c<=a.far))if(-c<this._looseRange.far)a.far=-c;else{if(A.radius>l){const n=t.children;if(void 0!==n){for(const t of n)this._includeFarBoundingInfoRec(e,t,r,a);return}}N.unionDepthRangeWithAABB(a,h,r,t.boundingBox)}}}class C{constructor(){this._modelViewProj=r(),this._clipPosition=[s(),s(),s(),s(),s(),s(),s(),s()]}unionDepthRangeWithAABB(e,r,n,i){const a=this._modelViewProj;t(a,r,n);let s=!1;for(let t=0;t<8;++t){const e=this._clipPosition[t],r=0===t||3===t||4===t||7===t?i[0]:i[3],n=0===t||1===t||4===t||5===t?i[1]:i[4],s=t<4?i[2]:i[5];e[0]=a[0]*r+a[4]*n+a[8]*s+a[12],e[1]=a[1]*r+a[5]*n+a[9]*s+a[13],e[2]=a[2]*r+a[6]*n+a[10]*s+a[14],e[3]=a[3]*r+a[7]*n+a[11]*s+a[15]}for(let t=0;t<12;++t){const r=S(this._clipPosition[y[t][0]],this._clipPosition[y[t][1]],this._clipPosition[y[t][2]]);let n=!0;for(let e=0;e<r.length;++e){if(r[e][3]>=2){n=!1;break}}if(!n){s=!0;for(let t=0;t<r.length;++t){const n=r[t][3];Number.isFinite(n)&&(e.near=Math.min(n,e.near),e.far=Math.max(n,e.far))}}}return s}}function S(e,t,r){let n=[e,t,r];for(let i=0;i<4;++i){const e=n;n=[];for(let t=0;t<e.length;++t){const r=e[t],a=e[(t+1)%e.length];I(a,i)?(I(r,i)||n.push(P(r,a,i)),n.push(a)):I(r,i)&&n.push(P(r,a,i))}}return n}function I(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void u(!1)}function P(e,t,r){let n=0;return 0===r?n=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?n=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?n=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(n=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),a(s(),e,t,n)}const y=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],A=new h,D=r(),E=new c,F=new M,W=new B,N=new C;export{p as depthRangeFromScene};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isSome as e}from"../../../../../core/arrayUtils.js";import{isAborted as o,throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{create as t}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as s,expandWithVec3 as i,center as r,diameter as c}from"../../../../../geometry/support/aaBoundingBox.js";import{getEmissions as u}from"../../effects/emissive/emissions.js";import{LodComponentData as m}from"./LodComponentData.js";class a{static async create(t,s,i){const r=await Promise.allSettled(s.components.map(e=>t.controller.schedule(()=>new m(t,e.geometry),i))),c=r.map(e=>"fulfilled"===e.status?e.value:null).filter(e);if(o(i)||c.length!==r.length){c.forEach(e=>e.destroy()),n(i);for(const e of r)if("rejected"===e.status)throw e.reason}return new a(s.minScreenSpaceRadius,c)}constructor(e,o){this.minScreenSpaceRadius=e,this.components=o}destroy(){this.components.forEach(e=>e.destroy())}intersect(e,o,n,t,s,i,r){this.components.forEach(c=>c.intersect(e,o,n,t,s,i,this.boundingSphere,r))}*intersectScreenPolygon(e,o,n,t,s){for(const i of this.components)i.intersectScreenPolygon(e,o,n,t,this.boundingSphere,s),yield}get boundingBox(){if(null==this._boundingBox){const e=s();this.components.forEach(o=>{null!=o.boundingInfo&&(i(e,o.boundingInfo.bbMin),i(e,o.boundingInfo.bbMax))}),this._boundingBox=e}return this._boundingBox}get boundingSphere(){if(null==this._boundingSphere){const e=this.boundingBox,o=t();r(e,o),this._boundingSphere={center:o,radius:.5*c(e)}}return this._boundingSphere}get triangleCount(){return this.components.reduce((e,o)=>e+o.numTriangles,0)}get emissions(){return u(this.components)}}export{a as LodLevel};
2
+ import{isSome as e}from"../../../../../core/arrayUtils.js";import{isAborted as o,throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{create as t}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as s,expandWithAABB as r,center as i,diameter as c}from"../../../../../geometry/support/aaBoundingBox.js";import{getEmissions as u}from"../../effects/emissive/emissions.js";import{LodComponentData as m}from"./LodComponentData.js";class a{static async create(t,s,r){const i=await Promise.allSettled(s.components.map(e=>t.controller.schedule(()=>new m(t,e.geometry),r))),c=i.map(e=>"fulfilled"===e.status?e.value:null).filter(e);if(o(r)||c.length!==i.length){c.forEach(e=>e.destroy()),n(r);for(const e of i)if("rejected"===e.status)throw e.reason}return new a(s.minScreenSpaceRadius,c)}constructor(e,o){this.minScreenSpaceRadius=e,this.components=o}destroy(){this.components.forEach(e=>e.destroy())}intersect(e,o,n,t,s,r,i){this.components.forEach(c=>c.intersect(e,o,n,t,s,r,this.boundingSphere,i))}*intersectScreenPolygon(e,o,n,t,s){for(const r of this.components)r.intersectScreenPolygon(e,o,n,t,this.boundingSphere,s),yield}get boundingBox(){if(null==this._boundingBox){const e=s();this.components.forEach(o=>{const{boundingInfo:n}=o;null!=n&&r(e,n.boundingBox)}),this._boundingBox=e}return this._boundingBox}get boundingSphere(){if(null==this._boundingSphere){const e=this.boundingBox,o=t();i(e,o),this._boundingSphere={center:o,radius:.5*c(e)}}return this._boundingSphere}get triangleCount(){return this.components.reduce((e,o)=>e+o.numTriangles,0)}get emissions(){return u(this.components)}}export{a as LodLevel};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{createRenderScreenPointArray3 as t,createScreenPointArray as n}from"../../../../core/screenUtils.js";import{copy as r,set as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as i,intersects as s,containsPoint as u,create as f}from"../../../../geometry/support/aaBoundingRect.js";import{distance2 as c,fromPoints as p,create as m}from"../../../../geometry/support/lineSegment.js";import{signedDistance as a,intersectLineSegment as l}from"../../../../geometry/support/plane.js";import{containsPoint2dFromValues as h}from"../../../../geometry/support/triangle.js";function g(t,n){return t.isRectangle?u(t.bounds,n):v(n,t.points)}function M(t,n,r){const o=n[0]-r,e=n[1]-r,u=n[0]+r,f=n[1]+r;if(!s(t.bounds,i(o,e,u,f,A)))return!1;if(g(t,n))return!0;const c=r*r;for(const i of t.points){const t=i[0]-n[0],r=i[1]-n[1];if(t*t+r*r<=c)return!0}for(let i=0;i<t.points.length;i++){if(k(n,t.points[i],t.points[(i+1)%t.points.length])<=c)return!0}return!1}function j(t,n){if(!s(t.bounds,n))return!1;if(t.isRectangle)return!0;for(const r of t.points)if(u(n,r))return!0;for(let r=0;r<4;r++)if(v(z(C,n,r),t.points))return!0;for(let r=0;r<t.points.length;r++){const o=t.points[r],e=r===t.points.length-1?t.points[0]:t.points[r+1];for(let t=0;t<4;t++){if(B(o,e,z(C,n,t),z(D,n,(t+1)%4)))return!0}}return!1}function x(t,n,r,o){const e=Math.min(n[0],r[0],o[0]),s=Math.min(n[1],r[1],o[1]),u=Math.max(n[0],r[0],o[0]),f=Math.max(n[1],r[1],o[1]);if(!j(t,i(e,s,u,f,A)))return!1;if(g(t,n)||g(t,r)||g(t,o))return!0;for(const i of t.points)if(h(n,r,o,i,K))return!0;for(let i=0;i<t.points.length;i++){const e=t.points[i],s=t.points[(i+1)%t.points.length];if(B(n,r,e,s)||B(r,o,e,s)||B(o,n,e,s))return!0}return!1}function d(t,n,r,o){const e=Math.min(n[0],r[0])-o,u=Math.min(n[1],r[1])-o,f=Math.max(n[0],r[0])+o,c=Math.max(n[1],r[1])+o;if(!s(t.bounds,i(e,u,f,c,A)))return!1;if(g(t,n)||g(t,r))return!0;const p=o*o;for(const i of t.points)if(k(i,n,r)<=p)return!0;for(let i=0;i<t.points.length;i++){const o=t.points[i],e=t.points[(i+1)%t.points.length];if(B(n,r,o,e)||U(n,r,o,e)<=p)return!0}return!1}function b(t,n,o,e,i){r(G,n),r(H,o);const s=t.projectToRenderScreen(G,E),u=t.projectToRenderScreen(H,F);if(null==s||null==u)return!1;const f=R(t,G),c=R(t,H);if(f&&c)return!1;if(f!==c){const n=f?G:H,r=f?s:u;if(!S(t,n,f?H:G))return!1;if(!t.projectToRenderScreen(n,r))return!1}return e[0]=s[0],e[1]=s[1],e[2]=0,i[0]=u[0],i[1]=u[1],i[2]=0,!0}function R(t,n){return y(t,n)>0}function y(t,n){return a(t.frustum[4],n)}function S(t,n,r){return T(t,n,r,n)}function T(t,n,r,o){return l(t.frustum[4],p(n,r,J),o)}function v(t,n){let r=!1;for(let o=0,e=n.length-1;o<n.length;e=o++){const i=n[o],s=n[e];if(!(i[1]>t[1]!=s[1]>t[1]))continue;const u=(s[0]-i[0])*(t[1]-i[1])/(s[1]-i[1])+i[0];t[0]<u&&(r=!r)}return r}function B(t,n,r,o){const e=q(t,n,r),i=q(t,n,o),s=q(r,o,t),u=q(r,o,n);return e!==i&&s!==u||(0===e&&w(t,n,r)||0===i&&w(t,n,o)||0===s&&w(r,o,t)||0===u&&w(r,o,n))}function U(t,n,r,o){return B(t,n,r,o)?0:Math.min(k(t,r,o),k(n,r,o),k(r,t,n),k(o,t,n))}function k(t,n,r){return c(p(o(G,n[0],n[1],0),o(H,r[0],r[1],0),J),o(I,t[0],t[1],0))}function q(t,n,r){const o=(n[1]-t[1])*(r[0]-n[0])-(n[0]-t[0])*(r[1]-n[1]);return Math.abs(o)<=K?0:Math.sign(o)}function w(t,n,r){return r[0]>=Math.min(t[0],n[0])-K&&r[0]<=Math.max(t[0],n[0])+K&&r[1]>=Math.min(t[1],n[1])-K&&r[1]<=Math.max(t[1],n[1])+K}function z(t,n,r){return t[0]=0===r||3===r?n[0]:n[2],t[1]=r<2?n[1]:n[3],t}const A=f(),C=n(),D=n(),E=t(),F=t(),G=e(),H=e(),I=e(),J=m(),K=1e-9;export{R as isBehindNearPlane,b as projectWorldLineSegmentToRenderScreen,g as screenPolygonContainsPoint,j as screenPolygonIntersectsBounds,d as screenPolygonIntersectsBufferedSegment,M as screenPolygonIntersectsCircle,x as screenPolygonIntersectsTriangle};
2
+ import{createScreenPointArray as t,createRenderScreenPointArray3 as n}from"../../../../core/screenUtils.js";import{copy as r,set as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as i,intersects as s,containsPoint as u,create as f}from"../../../../geometry/support/aaBoundingRect.js";import{create as c,distance2 as p,fromPoints as m}from"../../../../geometry/support/lineSegment.js";import{signedDistance as a,intersectLineSegment as l}from"../../../../geometry/support/plane.js";import{containsPoint2dFromValues as h}from"../../../../geometry/support/triangle.js";function g(t,n){return t.isRectangle?u(t.bounds,n):v(n,t.points)}function M(t,n,r){const o=n[0]-r,e=n[1]-r,u=n[0]+r,f=n[1]+r;if(!s(t.bounds,i(o,e,u,f,A)))return!1;if(g(t,n))return!0;const c=r*r;for(const i of t.points){const t=i[0]-n[0],r=i[1]-n[1];if(t*t+r*r<=c)return!0}for(let i=0;i<t.points.length;i++){if(k(n,t.points[i],t.points[(i+1)%t.points.length])<=c)return!0}return!1}function j(t,n){if(!s(t.bounds,n))return!1;if(t.isRectangle)return!0;for(const r of t.points)if(u(n,r))return!0;for(let r=0;r<4;r++)if(v(z(C,n,r),t.points))return!0;for(let r=0;r<t.points.length;r++){const o=t.points[r],e=r===t.points.length-1?t.points[0]:t.points[r+1];for(let t=0;t<4;t++){if(B(o,e,z(C,n,t),z(D,n,(t+1)%4)))return!0}}return!1}function x(t,n,r,o){const e=Math.min(n[0],r[0],o[0]),s=Math.min(n[1],r[1],o[1]),u=Math.max(n[0],r[0],o[0]),f=Math.max(n[1],r[1],o[1]);if(!j(t,i(e,s,u,f,A)))return!1;if(g(t,n)||g(t,r)||g(t,o))return!0;for(const i of t.points)if(h(n,r,o,i,K))return!0;for(let i=0;i<t.points.length;i++){const e=t.points[i],s=t.points[(i+1)%t.points.length];if(B(n,r,e,s)||B(r,o,e,s)||B(o,n,e,s))return!0}return!1}function d(t,n,r,o){const e=Math.min(n[0],r[0])-o,u=Math.min(n[1],r[1])-o,f=Math.max(n[0],r[0])+o,c=Math.max(n[1],r[1])+o;if(!s(t.bounds,i(e,u,f,c,A)))return!1;if(g(t,n)||g(t,r))return!0;const p=o*o;for(const i of t.points)if(k(i,n,r)<=p)return!0;for(let i=0;i<t.points.length;i++){const o=t.points[i],e=t.points[(i+1)%t.points.length];if(B(n,r,o,e)||U(n,r,o,e)<=p)return!0}return!1}function b(t,n,o,e,i){r(G,n),r(H,o);const s=t.projectToRenderScreen(G,E),u=t.projectToRenderScreen(H,F);if(null==s||null==u)return!1;const f=R(t,G),c=R(t,H);if(f&&c)return!1;if(f!==c){const n=f?G:H,r=f?s:u;if(!S(t,n,f?H:G))return!1;if(!t.projectToRenderScreen(n,r))return!1}return e[0]=s[0],e[1]=s[1],e[2]=0,i[0]=u[0],i[1]=u[1],i[2]=0,!0}function R(t,n){return y(t,n)>0}function y(t,n){return a(t.frustum[4],n)}function S(t,n,r){return T(t,n,r,n)}function T(t,n,r,o){return l(t.frustum[4],m(n,r,J),o)}function v(t,n){let r=!1;for(let o=0,e=n.length-1;o<n.length;e=o++){const i=n[o],s=n[e];if(!(i[1]>t[1]!=s[1]>t[1]))continue;const u=(s[0]-i[0])*(t[1]-i[1])/(s[1]-i[1])+i[0];t[0]<u&&(r=!r)}return r}function B(t,n,r,o){const e=q(t,n,r),i=q(t,n,o),s=q(r,o,t),u=q(r,o,n);return e!==i&&s!==u||(0===e&&w(t,n,r)||0===i&&w(t,n,o)||0===s&&w(r,o,t)||0===u&&w(r,o,n))}function U(t,n,r,o){return B(t,n,r,o)?0:Math.min(k(t,r,o),k(n,r,o),k(r,t,n),k(o,t,n))}function k(t,n,r){return p(m(o(G,n[0],n[1],0),o(H,r[0],r[1],0),J),o(I,t[0],t[1],0))}function q(t,n,r){const o=(n[1]-t[1])*(r[0]-n[0])-(n[0]-t[0])*(r[1]-n[1]);return Math.abs(o)<=K?0:Math.sign(o)}function w(t,n,r){return r[0]>=Math.min(t[0],n[0])-K&&r[0]<=Math.max(t[0],n[0])+K&&r[1]>=Math.min(t[1],n[1])-K&&r[1]<=Math.max(t[1],n[1])+K}function z(t,n,r){return t[0]=0===r||3===r?n[0]:n[2],t[1]=r<2?n[1]:n[3],t}const A=f(),C=t(),D=t(),E=n(),F=n(),G=e(),H=e(),I=e(),J=c(),K=1e-9;export{R as isBehindNearPlane,b as projectWorldLineSegmentToRenderScreen,g as screenPolygonContainsPoint,j as screenPolygonIntersectsBounds,d as screenPolygonIntersectsBufferedSegment,M as screenPolygonIntersectsCircle,x as screenPolygonIntersectsTriangle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import t from"../../../../core/PooledArray.js";import{createScreenPointArray as e}from"../../../../core/screenUtils.js";import{copy as r,distance as o,squaredDistance as n,set as i,transformMat4 as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as a,setMax as u,create as c}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as m,intersectsTransformedAabbFromMinMax as f}from"../../../../geometry/support/frustum.js";import{clipPolygon as p}from"../../../../geometry/support/plane.js";import{normalFromValues as d,closestPointFromValues as h}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as I}from"./intersectionConstants.js";import{screenPolygonIntersectsTriangle as g}from"./screenPolygonOverlapUtils.js";class b{constructor(t){this.primitiveIndex=t}}class y{constructor(t){this.type=t,this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=l(),this.normal=l()}reset(){this.distance=Number.POSITIVE_INFINITY,this.hasNormal=!1}update(t,e,o,n){this.distance=t,this.primitiveIndex=e,r(this.point,o),this.hasNormal=null!=n,null!=n&&r(this.normal,n)}updateIfCloserFromValues(t,e,r,o){t<this.distance&&this.update(t,e,r,o)}updateIfCloser(t){const{distance:e,primitiveIndex:r,point:o,normal:n}=t;this.updateIfCloserFromValues(e,r,o,t.hasNormal?n:null)}get valid(){return Number.isFinite(this.distance)}}function v(t,e,r,o,n){if(!t.visible||0!==t.type)return null;const i=new y(4);let s;if(t.boundingInfo)s=P(t.boundingInfo,e,r,o,n);else{const i=t.positionAttribute,l=t.primitivePositionIndices;s=j(e,r,o,0,l.length/3,l,i.data,i.stride,n,null,0)}for(const l of s)i.updateIfCloser(l);return i.valid?i:null}function N(t,e,r,o,n){const i=new y(4);for(const s of x(t,e,r,o,n))i.updateIfCloser(s);return i.valid?i:null}function*j(t,e,r,o,n,i,s,l,a,u=null,c=0){const m=(t,r,o,n)=>{const m=(u?.[n]??n)+c,f=null==u?m:n,p=3*m;return T(t,i,s,l,p+0,a,f,e),T(r,i,s,l,p+1,a,f,e),T(o,i,s,l,p+2,a,f,e),m};return yield*x(t,r,o,n,m)}function*x(t,e,r,n,i){if(null==t.camera)return;const{camera:s,screenPolygonPrimitiveProcessor:l}=t;for(let a=r;a<n;++a){const t=i(A[0],A[1],A[2],a),r=E;let n;_.reset();const u=M;for(const i of l.processTriangle(A))if(u.length=0,p(s.frustum[4],i,()=>u.pushNew(),!1),!(u.length<3)){for(let t=0;t<u.length;t++)s.projectToScreen(u.at(t),O[t]);F(e,O,u.length)&&(C(s.eye,u,S),null==n&&(n=d(E,A[0],A[1],A[2])),_.updateIfCloserFromValues(o(s.eye,S),t,S,n?r:null))}_.valid&&(yield _)}}function*P(t,e,r,o,n){let i;if(null!=n?(a(V,t.bbMin),u(V,t.bbMax),n.applyToAabb(V),i=m(o.broadPhaseFrustum,V,r)):i=f(o.broadPhaseFrustum,t.bbMin,t.bbMax,r),!i)return;const{primitiveIndices:s,position:l}=t,c=s?s.length:l.indices.length/3;if(c>I){const i=t.getChildren();if(void 0!==i){for(const t of i)yield*P(t,e,r,o,n);return}}yield*j(e,r,o,0,c,l.indices,l.data,l.stride,n,s,0)}function T(t,e,r,o,n,l,a,u){const c=o*e[n],m=r[c+0],f=r[c+1],p=r[c+2];null!=l?l.applyToVertex(t,m,f,p,a):i(t,m,f,p),u&&s(t,t,u)}function F(t,e,r){for(let o=1;o<r-1;o++)if(g(t,e[0],e[o],e[o+1]))return!0;return!1}function C(t,e,o){let i=Number.POSITIVE_INFINITY;const s=e.at(0);for(let l=1;l<e.length-1;l++){h(Y,t,s,e.at(l),e.at(l+1));const a=n(t,Y);a<i&&(i=a,r(o,Y))}}const V=c(),w=12,A=[l(),l(),l()],M=new t({allocator:t=>t??l()}),O=Array.from({length:w},()=>e()),S=l(),E=l(),Y=l(),_=new y(4);export{b as DrapedHit,y as Hit,j as forEachTriangleRangeScreenPolygonHit,x as forEachTriangleReaderRangeScreenPolygonHit,v as intersectTriangleGeometryScreenPolygon,N as intersectTriangleReaderRangeScreenPolygon};
2
+ import t from"../../../../core/PooledArray.js";import{createScreenPointArray as e}from"../../../../core/screenUtils.js";import{copy as o,distance as r,squaredDistance as n,set as i,transformMat4 as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as a,create as u}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as c}from"../../../../geometry/support/frustum.js";import{clipPolygon as m}from"../../../../geometry/support/plane.js";import{normalFromValues as f,closestPointFromValues as p}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as d}from"./intersectionConstants.js";import{screenPolygonIntersectsTriangle as h}from"./screenPolygonOverlapUtils.js";class I{constructor(t){this.primitiveIndex=t}}class g{constructor(t){this.type=t,this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=l(),this.normal=l()}reset(){this.distance=Number.POSITIVE_INFINITY,this.hasNormal=!1}update(t,e,r,n){this.distance=t,this.primitiveIndex=e,o(this.point,r),this.hasNormal=null!=n,null!=n&&o(this.normal,n)}updateIfCloserFromValues(t,e,o,r){t<this.distance&&this.update(t,e,o,r)}updateIfCloser(t){const{distance:e,primitiveIndex:o,point:r,normal:n}=t;this.updateIfCloserFromValues(e,o,r,t.hasNormal?n:null)}get valid(){return Number.isFinite(this.distance)}}function y(t,e,o,r,n){if(!t.visible||0!==t.type)return null;const i=new g(4);let s;if(t.boundingInfo)s=j(t.boundingInfo,e,o,r,n);else{const i=t.positionAttribute,l=t.primitivePositionIndices;s=v(e,o,r,0,l.length/3,l,i.data,i.stride,n,null,0)}for(const l of s)i.updateIfCloser(l);return i.valid?i:null}function b(t,e,o,r,n){const i=new g(4);for(const s of N(t,e,o,r,n))i.updateIfCloser(s);return i.valid?i:null}function*v(t,e,o,r,n,i,s,l,a,u=null,c=0){const m=(t,o,r,n)=>{const m=(u?.[n]??n)+c,f=null==u?m:n,p=3*m;return x(t,i,s,l,p+0,a,f,e),x(o,i,s,l,p+1,a,f,e),x(r,i,s,l,p+2,a,f,e),m};return yield*N(t,o,r,n,m)}function*N(t,e,o,n,i){if(null==t.camera)return;const{camera:s,screenPolygonPrimitiveProcessor:l}=t;for(let a=o;a<n;++a){const t=i(V[0],V[1],V[2],a),o=O;let n;E.reset();const u=w;for(const i of l.processTriangle(V))if(u.length=0,m(s.frustum[4],i,()=>u.pushNew(),!1),!(u.length<3)){for(let t=0;t<u.length;t++)s.projectToScreen(u.at(t),A[t]);P(e,A,u.length)&&(T(s.eye,u,B),null==n&&(n=f(O,V[0],V[1],V[2])),E.updateIfCloserFromValues(r(s.eye,B),t,B,n?o:null))}E.valid&&(yield E)}}function*j(t,e,o,r,n){let i;if(null!=n?(a(F,t.boundingBox),n.applyToAabb(F),i=c(r.broadPhaseFrustum,F,o)):i=c(r.broadPhaseFrustum,t.boundingBox,o),!i)return;const{primitiveIndices:s,position:l}=t,u=s?s.length:l.indices.length/3;if(u>d){const i=t.children;if(void 0!==i){for(const t of i)yield*j(t,e,o,r,n);return}}yield*v(e,o,r,0,u,l.indices,l.data,l.stride,n,s,0)}function x(t,e,o,r,n,l,a,u){const c=r*e[n],m=o[c+0],f=o[c+1],p=o[c+2];null!=l?l.applyToVertex(t,m,f,p,a):i(t,m,f,p),u&&s(t,t,u)}function P(t,e,o){for(let r=1;r<o-1;r++)if(h(t,e[0],e[r],e[r+1]))return!0;return!1}function T(t,e,r){let i=Number.POSITIVE_INFINITY;const s=e.at(0);for(let l=1;l<e.length-1;l++){p(S,t,s,e.at(l),e.at(l+1));const a=n(t,S);a<i&&(i=a,o(r,S))}}const F=u(),C=12,V=[l(),l(),l()],w=new t({allocator:t=>t??l()}),A=Array.from({length:C},()=>e()),B=l(),O=l(),S=l(),E=new g(4);export{I as DrapedHit,g as Hit,v as forEachTriangleRangeScreenPolygonHit,N as forEachTriangleReaderRangeScreenPolygonHit,y as intersectTriangleGeometryScreenPolygon,b as intersectTriangleReaderRangeScreenPolygon};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{fromValues as t}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewUint32 as e,BufferViewVec3f as i,BufferViewVec2Snorm16 as r,BufferViewSnorm16 as s,BufferViewFloat16 as o,BufferViewFloat as a,BufferViewVec2f as n,BufferViewVec4Unorm8 as h,BufferViewUnorm8 as c}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as u}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as f,is3DGeometry as p,isColor as l}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as g}from"../effects/geometry/olidUtils.js";import m from"../lib/GLMaterial.js";import{isPathGeometry as d}from"../lib/PathGeometry.js";import{offsetPathVertexInfoFrameIndex as b}from"../lib/PathVertexInfo.js";import{MeshIntersectionOptions as y,intersectAabbInvDir as _}from"../lib/RayIntersections.js";import{assert as S}from"../lib/Util.js";import{applyPolygonOffsetToHit as w}from"./intersectWithPolygonOffset.js";import{getLayout as F,getTextureLayout as P}from"./PathLayouts.js";import{PathPassParameters as x,PathTechnique as V}from"./PathTechnique.js";import{PathTechniqueConfiguration as j}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as C}from"./TriangleMaterial.js";import{writeAttributes as R,writePosition as z,writeBufferVec2 as B,writeBufferInt16 as M,writeBufferFloat16 as O,writeBufferFloat as v,writeColor as A,writeBufferUint8 as T,writeOlidColor as I}from"./internal/bufferWriterUtils.js";import{hasShadowHighlights as U}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as L}from"../../../../webscene/support/AlphaCutoff.js";class q extends C{constructor(t,e){super(t,G),this.supportsEdges=!0,this.produces=new Map([[2,t=>(this.parameters.castShadows&&f(t)||p(t))&&!this.transparent],[4,t=>(this.parameters.castShadows&&f(t)||p(t))&&this.transparent]]),this._configuration=new j(e.spherical)}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(t){super.updateConfiguration(t),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=t.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?0:this.parameters.cullFace,this._configuration.offsetBackfaces=this.transparent,l(t.output)?(this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.hasShadowHighlights=U(this._configuration,t),this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.snowCover=t.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(t){return 5!==t&&7!==t&&6!==t||this.parameters.castShadows}get visible(){return this.parameters.opacity>=L}intersectRay(t,e,i,r,s,o){this._intersectRay(t,i,r,s,o)}intersectRayDraped(){}intersectScreenPolygonDraped(){return null}intersectScreenPolygon(t,e,i,r){return d(t)?w(t.intersectScreenPolygon(i,e,r),this._configuration,i.camera.eye):null}_intersectRay(e,i,r,s,o){if(!d(e))return;const a=new y(i.tolerance,!1,i.options.normalRequired),n=e.boundingInfo;if(null==n)return void e.intersectRay(r,s,a,o);const h=t(n.bbMin[0],n.bbMin[1],n.bbMin[2],n.bbMax[0],n.bbMax[1],n.bbMax[2]),c=[s[0]-r[0],s[1]-r[1],s[2]-r[2]],u=Math.sqrt(c[0]*c[0]+c[1]*c[1]+c[2]*c[2]),f=[u/c[0],u/c[1],u/c[2]];_(h,r,f,i.tolerance)&&e.intersectRay(r,s,a,o)}createBufferWriter(){return new W(F(),P(this.parameters))}createGLMaterial(t){return new D(t)}get transparent(){const{parameters:t}=this;return t.drivenOpacity||t.opacity<1}}class D extends m{beginSlot(t){return this.getTechnique(V,t)}}class G extends x{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}}class W{constructor(t,e){this.layout=t,this.textureBufferLayout=e,this.maxTextureBufferItemIndex=u}elementCount(t){return t.get("pathVertexInfo")?.indices.length??0}elementCountTextureBuffer(t){return t.get("position")?.indices.length??0}write(t,e,i,r,s,o,a){null!=s&&this._writeVertexBuffer(t,e,i,s,o),null!=a&&this._writeTextureBuffer(t,i,r,a)}_writeVertexBuffer(t,i,r,s,o){R(r,null,this.layout,t,i,s);const a=o?.from??0,n=s.buffer.getField("pathVertexInfo",e),h=r.get("pathVertexInfo");if(n&&h){S(1===h.size);const{data:t,stride:e,indices:i}=h;for(let r=0;r<i.length;++r){const o=t[e*i[r]];n.set(s.offset+r,b(o,a))}}}_writeTextureBuffer(t,e,u,f){const p=f.offset,l=f.buffer.getField("position",i),m=e.get("position");l&&m&&(S(3===m.size),z(m,t,l,p));const d=f.buffer.getField("profileRight",r),b=e.get("profileRight");d&&b&&(S(2===b.size),B(b,d,p));const y=f.buffer.getField("profileUp",r),_=e.get("profileUp");y&&_&&(S(2===_.size),B(_,y,p));const w=f.buffer.getField("profileRotation",s),F=e.get("profileRotation");w&&F&&(S(1===F.size),M(F,w,p));const P=f.buffer.getField("pathRotationUp",r),x=e.get("pathRotationUp");P&&x&&(S(2===x.size),B(x,P,p));const V=f.buffer.getField("pathMaxStretchDistance",o),j=e.get("pathMaxStretchDistance");V&&j&&(S(1===j.size),O(j,V,p));const C=f.buffer.getField("sizeFeatureAttribute",a),R=e.get("sizeFeatureAttribute");C&&R&&v(R,C,p);const U=f.buffer.getField("size",n),L=e.get("size");U&&L&&(S(2===L.size),B(L,U,p));const q=f.buffer.getField("colorFeatureAttribute",a),D=e.get("colorFeatureAttribute");q&&D&&v(D,q,p);const G=f.buffer.getField("color",h),W=e.get("color");G&&W&&A(W,4,G,p);const H=f.buffer.getField("opacityFeatureAttribute",a),k=e.get("opacityFeatureAttribute");H&&k&&v(k,H,p);const E=f.buffer.getField("opacity",c),J=e.get("opacity");if(E&&J&&(S(1===J.size),T(J,E,p)),g()){const t=f.buffer.getField("olidColor",h),e=m?.indices.length??0;u&&t&&e&&I(u,t,e,p)}}}export{G as Parameters,W as PathBufferWriter,q as PathMaterial};
2
+ import{BufferViewUint32 as t,BufferViewVec3f as e,BufferViewVec2Snorm16 as i,BufferViewSnorm16 as r,BufferViewFloat16 as s,BufferViewFloat as o,BufferViewVec2f as a,BufferViewVec4Unorm8 as n,BufferViewUnorm8 as h}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as c}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as u,is3DGeometry as f,isColor as p}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as l}from"../effects/geometry/olidUtils.js";import g from"../lib/GLMaterial.js";import{isPathGeometry as m}from"../lib/PathGeometry.js";import{offsetPathVertexInfoFrameIndex as d}from"../lib/PathVertexInfo.js";import{MeshIntersectionOptions as y,intersectAabbInvDir as b}from"../lib/RayIntersections.js";import{assert as _}from"../lib/Util.js";import{applyPolygonOffsetToHit as S}from"./intersectWithPolygonOffset.js";import{getLayout as w,getTextureLayout as F}from"./PathLayouts.js";import{PathPassParameters as P,PathTechnique as V}from"./PathTechnique.js";import{PathTechniqueConfiguration as x}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as C}from"./TriangleMaterial.js";import{writeAttributes as R,writePosition as j,writeBufferVec2 as z,writeBufferInt16 as B,writeBufferFloat16 as O,writeBufferFloat as v,writeColor as A,writeBufferUint8 as T,writeOlidColor as M}from"./internal/bufferWriterUtils.js";import{hasShadowHighlights as I}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as U}from"../../../../webscene/support/AlphaCutoff.js";class L extends C{constructor(t,e){super(t,D),this.supportsEdges=!0,this.produces=new Map([[2,t=>(this.parameters.castShadows&&u(t)||f(t))&&!this.transparent],[4,t=>(this.parameters.castShadows&&u(t)||f(t))&&this.transparent]]),this._configuration=new x(e.spherical)}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(t){super.updateConfiguration(t),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=t.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?0:this.parameters.cullFace,this._configuration.offsetBackfaces=this.transparent,p(t.output)?(this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.hasShadowHighlights=I(this._configuration,t),this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.snowCover=t.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(t){return 5!==t&&7!==t&&6!==t||this.parameters.castShadows}get visible(){return this.parameters.opacity>=U}intersectRay(t,e,i,r,s,o){this._intersectRay(t,i,r,s,o)}intersectRayDraped(){}intersectScreenPolygonDraped(){return null}intersectScreenPolygon(t,e,i,r){return m(t)?S(t.intersectScreenPolygon(i,e,r),this._configuration,i.camera.eye):null}_intersectRay(t,e,i,r,s){if(!m(t))return;const o=new y(e.tolerance,!1,e.options.normalRequired),a=t.boundingInfo;if(null==a)return void t.intersectRay(i,r,o,s);const n=a.boundingBox,h=[r[0]-i[0],r[1]-i[1],r[2]-i[2]],c=Math.sqrt(h[0]*h[0]+h[1]*h[1]+h[2]*h[2]),u=[c/h[0],c/h[1],c/h[2]];b(n,i,u,e.tolerance)&&t.intersectRay(i,r,o,s)}createBufferWriter(){return new G(w(),F(this.parameters))}createGLMaterial(t){return new q(t)}get transparent(){const{parameters:t}=this;return t.drivenOpacity||t.opacity<1}}class q extends g{beginSlot(t){return this.getTechnique(V,t)}}class D extends P{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}}class G{constructor(t,e){this.layout=t,this.textureBufferLayout=e,this.maxTextureBufferItemIndex=c}elementCount(t){return t.get("pathVertexInfo")?.indices.length??0}elementCountTextureBuffer(t){return t.get("position")?.indices.length??0}write(t,e,i,r,s,o,a){null!=s&&this._writeVertexBuffer(t,e,i,s,o),null!=a&&this._writeTextureBuffer(t,i,r,a)}_writeVertexBuffer(e,i,r,s,o){R(r,null,this.layout,e,i,s);const a=o?.from??0,n=s.buffer.getField("pathVertexInfo",t),h=r.get("pathVertexInfo");if(n&&h){_(1===h.size);const{data:t,stride:e,indices:i}=h;for(let r=0;r<i.length;++r){const o=t[e*i[r]];n.set(s.offset+r,d(o,a))}}}_writeTextureBuffer(t,c,u,f){const p=f.offset,g=f.buffer.getField("position",e),m=c.get("position");g&&m&&(_(3===m.size),j(m,t,g,p));const d=f.buffer.getField("profileRight",i),y=c.get("profileRight");d&&y&&(_(2===y.size),z(y,d,p));const b=f.buffer.getField("profileUp",i),S=c.get("profileUp");b&&S&&(_(2===S.size),z(S,b,p));const w=f.buffer.getField("profileRotation",r),F=c.get("profileRotation");w&&F&&(_(1===F.size),B(F,w,p));const P=f.buffer.getField("pathRotationUp",i),V=c.get("pathRotationUp");P&&V&&(_(2===V.size),z(V,P,p));const x=f.buffer.getField("pathMaxStretchDistance",s),C=c.get("pathMaxStretchDistance");x&&C&&(_(1===C.size),O(C,x,p));const R=f.buffer.getField("sizeFeatureAttribute",o),I=c.get("sizeFeatureAttribute");R&&I&&v(I,R,p);const U=f.buffer.getField("size",a),L=c.get("size");U&&L&&(_(2===L.size),z(L,U,p));const q=f.buffer.getField("colorFeatureAttribute",o),D=c.get("colorFeatureAttribute");q&&D&&v(D,q,p);const G=f.buffer.getField("color",n),W=c.get("color");G&&W&&A(W,4,G,p);const H=f.buffer.getField("opacityFeatureAttribute",o),k=c.get("opacityFeatureAttribute");H&&k&&v(k,H,p);const E=f.buffer.getField("opacity",h),J=c.get("opacity");if(E&&J&&(_(1===J.size),T(J,E,p)),l()){const t=f.buffer.getField("olidColor",n),e=m?.indices.length??0;u&&t&&e&&M(u,t,e,p)}}}export{D as Parameters,G as PathBufferWriter,L as PathMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r,createScreenPointArray as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as s,Seconds as a}from"../../../../core/time.js";import{copy as n,set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as c,subtract as p,dot as m,scale as h,add as u,copy as f,length as d,distance as g,lerp as _,transformMat4 as b,normalize as S}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as y}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as v,create as w}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as T}from"../../../../geometry/support/float16.js";import{fromPoints as E,distance2 as x,closestLineSegmentPoint as j,projectPoint as L,projectPointFraction as z,create as A}from"../../../../geometry/support/lineSegment.js";import{fromPoints as M,signedDistance as C,getNormal as R,create as O}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as V,BufferViewUint32 as B}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as F,isColor as U,isDepth as I,isColorHighlightOLIDOrDepth as N,is2DGeometryOutput as k}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as W}from"../effects/geometry/olidUtils.js";import D from"../lib/GLMaterial.js";import{Material as Y}from"../lib/Material.js";import{projectWorldLineSegmentToRenderScreen as J,screenPolygonIntersectsBufferedSegment as q}from"../lib/screenPolygonOverlapUtils.js";import{Hit as X,DrapedHit as G}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as H}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as K,assert as Q}from"../lib/Util.js";import{isImagePattern as Z}from"./lineStippleUtils.js";import{VisualVariablePassParameters as $}from"./VisualVariablePassParameters.js";import{r as ee}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as te,getTextureBufferLayout as re}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as ie}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as se}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as ae}from"../../../../webscene/support/AlphaCutoff.js";class ne extends Y{constructor(e,t){super(e,le),this.produces=new Map([[2,e=>F(e)||U(e)&&8===this.parameters.renderOccluded],[3,e=>I(e)],[10,e=>N(e)&&8===this.parameters.renderOccluded],[11,e=>N(e)&&8===this.parameters.renderOccluded],[4,e=>U(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>U(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>k(e)]]),this._configuration=new se(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,r=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,i=r&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=de(this.parameters.join,r),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&fe(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.emissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!i,this._configuration.worldSizedImagePattern=i}get visible(){return this.parameters.color[3]>=ae||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>ae}get emissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e,screenToWorldRatio:r},i,s,a,n){if(!i.options.selectionMode)return;const o=this._getLineSize(e,!0),l=s[0],c=s[1],p=he(o,r);let m=Number.MAX_VALUE,h=0;for(const u of ue(Se,Pe,this.parameters,e)){const e=l-Se[0],r=c-Se[1],i=Pe[0]-Se[0],s=Pe[1]-Se[1],a=t((i*e+s*r)/(i*i+s*s),0,1),n=i*a-e,o=s*a-r,p=n*n+o*o;p<m&&(m=p,h=u)}m<p*p&&a(n.distance,n.normal,h)}intersectRay(t,r,i,s,a,o){const{options:l,camera:_,rayBegin:b,rayEnd:S}=i;if(!l.selectionMode||!t.visible||!_)return;if(!K(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=t.attributes,y=P.get("position").data,v=this._getLineSize(P),w=xe;n(w,i.point);const T=v*_.pixelRatio,L=Je*_.pixelRatio,z=T/2+L;c(Ie[0],w[0]-z,w[1]+z,0),c(Ie[1],w[0]+z,w[1]+z,0),c(Ie[2],w[0]+z,w[1]-z,0),c(Ie[3],w[0]-z,w[1]-z,0);for(let e=0;e<4;e++)if(!_.unprojectFromRenderScreen(Ie[e],Ne[e]))return;M(_.eye,Ne[0],Ne[1],ke),M(_.eye,Ne[1],Ne[2],We),M(_.eye,Ne[2],Ne[3],De),M(_.eye,Ne[3],Ne[0],Ye);let A=Number.MAX_VALUE,O=0;for(const e of this._forEachTransformedLineSegment(_e,be,y,r,me(this.parameters,P))){if(C(ke,_e)<0&&C(ke,be)<0||C(We,_e)<0&&C(We,be)<0||C(De,_e)<0&&C(De,be)<0||C(Ye,_e)<0&&C(Ye,be)<0)continue;const t=_.projectToRenderScreen(_e,je),r=_.projectToRenderScreen(be,Le);if(null==t||null==r)continue;if(t[2]<0&&r[2]>0){p(Te,_e,be);const e=_.frustum,r=-C(e[4],_e)/m(Te,R(e[4]));if(h(Te,Te,r),u(_e,_e,Te),!_.projectToRenderScreen(_e,t))continue}else if(t[2]>0&&r[2]<0){p(Te,be,_e);const e=_.frustum,t=-C(e[4],be)/m(Te,R(e[4]));if(h(Te,Te,t),u(be,be,Te),!_.projectToRenderScreen(be,r))continue}else if(t[2]<0&&r[2]<0)continue;t[2]=0,r[2]=0;const i=E(t,r,Re),s=x(i,w);if(!(s>=A)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(i,_e,be,w,_,v,L);if(s>=e*e)continue}A=s,f(Me,_e),f(Ce,be),O=e}}if(A<z*z){let e=Number.MAX_VALUE;if(j(E(Me,Ce,Re),E(b,S,Oe),Ee)){p(Ee,Ee,b);const t=d(Ee);h(Ee,Ee,1/t),e=t/g(b,S)}o(e,Ee,O)}}intersectScreenPolygon(t,r,i,s){const{options:a,camera:n,screenPolygonPrimitiveProcessor:o}=i;if(!a.selectionMode||!t.visible)return null;if(!K(r))return e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix"),null;const l=t.attributes,c=l.get("position").data,p=this._getLineSize(l),m=Je,h=m*n.pixelRatio,u=new X(4);for(const e of this._forEachTransformedLineSegment(_e,be,c,r,me(this.parameters,l)))for(const[t,r]of o.processLineSegment(qe,_e,be)){if(!J(n,t,r,je,Le))continue;const i=E(je,Le,Re);let a=p/2+m;this.parameters.screenSizePerspective&&(_(xe,je,Le,.5),a=Math.max(a,this.computeScreenSizePerspectiveWidth(i,t,r,xe,n,p,h)/n.pixelRatio)),n.renderToScreen(je,ze),n.renderToScreen(Le,Ae),q(s,ze,Ae,a)&&(L(E(t,r,Oe),n.eye,ye),u.updateIfCloserFromValues(g(n.eye,ye),e,ye,null))}return u}intersectScreenPolygonDraped({attributes:e,screenToWorldRatio:t},r,i,s){if(!i.options.selectionMode)return null;const a=he(this._getLineSize(e,!0),t);for(const n of ue(Se,Pe,this.parameters,e,r))if(q(s,Se,Pe,a))return new G(n);return null}createBufferWriter(){return new ce(te(this.parameters),re(this.parameters),this.parameters)}createGLMaterial(e){return new oe(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:s(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,r,i,s,a,n){const o=z(e,i);_(ye,t,r,o),b(ve,ye,s.viewMatrix);const l=d(ve),c=this.computeCameraAbsCosAngle(ye,s,this._configuration.spherical);ge.update(c,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return ge.apply(a)*s.pixelRatio/2+n}computeCameraAbsCosAngle(e,t,r){return r?S(Ee,e):c(Ee,0,0,1),p(we,e,t.eye),S(we,we),Math.abs(m(Ee,we))}_getLineSize(e,r=!1){let i=this.parameters.width;if(this.parameters.vvSize){const s=e.get("sizeFeatureAttribute").data[0];Number.isNaN(s)?r&&(i*=this.parameters.vvSize.fallback[0]):i*=t(this.parameters.vvSize.offset[0]+s*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has("size")&&(i*=e.get("size").data[0]);return i}*_forEachTransformedLineSegment(e,t,r,i,s){const a=s?r.length-2:r.length-5;for(let n=0;n<a;n+=3){e[0]=r[n]+i[12],e[1]=r[n+1]+i[13],e[2]=r[n+2]+i[14];const s=(n+3)%r.length;t[0]=r[s]+i[12],t[1]=r[s+1]+i[13],t[2]=r[s+2]+i[14],yield n/3}}}class oe extends D{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(ie,e)}}class le extends ${constructor(){super(...arguments),this._width=0,this.color=v,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=a(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=a(0),this.endTime=a(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return Z(this.stipplePattern)&&null!=this.stippleTexture}}class ce{constructor(e,t,r){this.layout=e,this.textureBufferLayout=t,this._parameters=r,this.numJoinSubdivisions=de(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return me(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3+2}elementCount(e){const t=2,r=e.get("position").indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,s,a,n){null!=n&&this._writeTextureBuffer(e,r,n),null!=s&&this._writeVertexBuffer(e,r,i,s,a)}_writeTextureBuffer(e,t,r){const i=t.get("position"),s=i.data.length/3,a=s+2,n=this._isClosed(t),{buffer:o,offset:l}=r,c=o.getField("position",V);Q(null!==c,"Expected valid position field in texture buffer");for(let p=0;p<s;++p)this._getTransformedPosition(Be,i.data,p,e),c.setVec(l+p+1,Be);n?(o.copyItem(l+a-2,l+0),o.copyItem(l+1,l+a-1)):(o.copyItem(l+1,l+0),o.copyItem(l+a-2,l+a-1))}_writeVertexBuffer(e,t,r,i,s){const{buffer:a,offset:n}=i,{layout:o}=this,l=t.get("position"),c=l.indices,p=l.data.length/3,m=p+2,h=t.get("distanceToStart")?.data;c&&c.length!==2*(p-1)&&console.warn("RibbonLineMaterial does not support indices");const u=a.getField("textureElementIndex",B);Q(null!=u,"Missing texture buffer index field"),Q(null!=s,"Using a texture layout, but the texture range for this instance was not provided");const d=s.from;Q(s.numElements===m,"Expected number of elements in TextureBuffer to equal number of points");const _=o.fields.has("sizeFeatureAttribute");let b=1,S=null;if(_){const e=t.get("sizeFeatureAttribute");1===e.data.length?b=e.data[0]:S=e.data}else b=t.get("size")?.data[0]??1;let P=[1,1,1,1],v=0,w=null;const E=o.fields.has("colorFeatureAttribute");if(E){const e=t.get("colorFeatureAttribute");1===e.data.length?v=e.data[0]:w=e.data}else P=t.get("color")?.data??P;const x=t.get("timeStamps")?.data,j=x&&o.fields.has("timeStamps"),L=o.fields.has("opacityFeatureAttribute");let z=0,A=null;if(L){const e=t.get("opacityFeatureAttribute");1===e.data.length?z=e.data[0]:A=e.data}const M=new Float32Array(a.buffer),C=T(a.buffer),R=new Uint8Array(a.buffer),O=new Uint32Array(a.buffer),V=o.stride/4;let F=n*V;const U=F;let I=0;const N=M.BYTES_PER_ELEMENT/C.BYTES_PER_ELEMENT,k=W(),D=this._isClosed(t),Y=(e,t,i,s,a,n,o,l)=>{const c=o+1;O[F]=d+c,F++,M[F++]=l;let p=F*N;if(C[p++]=a,C[p++]=n,F=Math.ceil(p/N),E)M[F]=w?.[o]??v;else{const e=Math.min(4*o,P.length-4),t=4*F;R[t]=255*P[e],R[t+1]=255*P[e+1],R[t+2]=255*P[e+2],R[t+3]=255*P[e+3]}if(F++,M[F++]=S?.[o]??b,L&&(M[F++]=A?.[o]??z),k){let e=4*F;r?(R[e++]=r[0],R[e++]=r[1],R[e++]=r[2],R[e++]=r[3]):(R[e++]=0,R[e++]=0,R[e++]=0,R[e++]=0),F=Math.ceil(.25*e)}j&&(p=F*N,C[p++]=s[0],C[p++]=s[1],C[p++]=s[2],C[p++]=s[3],F=Math.ceil(p/N))},J=()=>{f(Ve,Be),f(Be,Fe)},q=e=>{if(j){const t=4*e;y(Ue,x[t+0],x[t+1],x[t+2],x[t+3])}},X=(e,t,r)=>{null!=h?I=h[r]:I+=g(e,t)};F+=V,this._getTransformedPosition(Be,l.data,0,e),q(0);let G=0,H=0;D?(this._getTransformedPosition(Ve,l.data,p-1,e),G=0,H=p):(this._getTransformedPosition(Fe,l.data,1,e),Y(Be,Be,Fe,Ue,1,-4,0,0),Y(Be,Be,Fe,Ue,1,4,0,0),J(),q(1),G=1,H=p-1);for(let f=G;f<H;f++){this._getTransformedPosition(Fe,l.data,(f+1)%p,e),X(Ve,Be,f),Y(Ve,Be,Fe,Ue,0,-1,f,I),Y(Ve,Be,Fe,Ue,0,1,f,I);const t=this.numJoinSubdivisions;for(let e=0;e<t;++e){const r=(e+1)/(t+1);Y(Ve,Be,Fe,Ue,r,-1,f,I),Y(Ve,Be,Fe,Ue,r,1,f,I)}Y(Ve,Be,Fe,Ue,1,-2,f,I),Y(Ve,Be,Fe,Ue,1,2,f,I),J(),q((f+1)%p)}X(Ve,Be,H),D?(this._getTransformedPosition(Fe,l.data,1,e),Y(Ve,Be,Fe,Ue,0,-1,G,I),Y(Ve,Be,Fe,Ue,0,1,G,I)):(Y(Ve,Be,Be,Ue,0,-5,H,I),Y(Ve,Be,Be,Ue,0,5,H,I)),pe(M,U+V,M,U,V);F=pe(M,F-V,M,F,V),this._parameters.wireframe&&this._addWireframeVertices(a,U,F,V)}_getTransformedPosition(e,t,r,i){const s=3*r;c(e,t[s+0],t[s+1],t[s+2]),i&&b(e,e,i)}_addWireframeVertices(e,t,r,i){const s=new Uint8Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(r-t)*Float32Array.BYTES_PER_ELEMENT),n=i*Float32Array.BYTES_PER_ELEMENT;let o=0;const l=e=>o=pe(a,e,s,o,n);for(let c=0;c<=a.length-4*n;c+=2*n)l(c),l(c+2*n),l(c+1*n),l(c+2*n),l(c+1*n),l(c+3*n)}}function pe(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function me(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function he(e,t){return(e/2+Je)*t}function*ue(e,t,r,i,s){const a=i.get("position").data,l=me(r,i)?a.length-2:a.length-5,c=s?.[0]??0,p=s?.[1]??0;o(e,a[0]+c,a[1]+p);for(let m=3;m<l+3;m+=3){const r=m%a.length;o(t,a[r]+c,a[r+1]+p),yield m/3,n(e,t)}}function fe(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function de(e,t){const r=t?1:0;switch(e){case"miter":case"bevel":return r;case"round":return ee+r}}const ge=new H,_e=P(),be=P(),Se=l(),Pe=l(),ye=P(),ve=P(),we=P(),Te=P(),Ee=P(),xe=P(),je=r(),Le=r(),ze=i(),Ae=i(),Me=P(),Ce=P(),Re=A(),Oe=A(),Ve=P(),Be=P(),Fe=P(),Ue=w(),Ie=[r(),r(),r(),r()],Ne=[P(),P(),P(),P()],ke=O(),We=O(),De=O(),Ye=O(),Je=4,qe=[P(),P()];export{le as Parameters,ne as RibbonLineMaterial};
2
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r,createScreenPointArray as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as s,Seconds as n}from"../../../../core/time.js";import{copy as o,set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as c,subtract as p,dot as u,scale as m,add as h,copy as f,length as d,distance as g,lerp as _,transformMat4 as b,normalize as S}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as v}from"../../../../geometry/support/float16.js";import{create as w,fromPoints as E,distance2 as x,closestLineSegmentPoint as T,projectPoint as j,projectPointFraction as L}from"../../../../geometry/support/lineSegment.js";import{create as z,fromPoints as C,signedDistance as A,getNormal as M}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as R,BufferViewFloat as V,BufferViewVec4Unorm8 as F,BufferViewVec4f16 as O,BufferViewUint32 as B}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as U,isColor as I,isDepth as N,isColorHighlightOLIDOrDepth as W,is2DGeometryOutput as k}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as D}from"../effects/geometry/olidUtils.js";import Y from"../lib/GLMaterial.js";import{Material as J}from"../lib/Material.js";import{projectWorldLineSegmentToRenderScreen as q,screenPolygonIntersectsBufferedSegment as X}from"../lib/screenPolygonOverlapUtils.js";import{Hit as G,DrapedHit as H}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as K}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as Q,assert as Z}from"../lib/Util.js";import{isImagePattern as $}from"./lineStippleUtils.js";import{VisualVariablePassParameters as ee}from"./VisualVariablePassParameters.js";import{writeOlidColor as te}from"./internal/bufferWriterUtils.js";import{r as re}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as ie,getTextureBufferLayout as se}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as ne}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as oe}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as ae}from"../../../../webscene/support/AlphaCutoff.js";class le extends J{constructor(e,t){super(e,pe),this.produces=new Map([[2,e=>U(e)||I(e)&&8===this.parameters.renderOccluded],[3,e=>N(e)],[10,e=>W(e)&&8===this.parameters.renderOccluded],[11,e=>W(e)&&8===this.parameters.renderOccluded],[4,e=>I(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>I(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>k(e)]]),this._configuration=new oe(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,r=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,i=r&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=_e(this.parameters.join,r),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&ge(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.emissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!i,this._configuration.worldSizedImagePattern=i}get visible(){return this.parameters.color[3]>=ae||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>ae}get emissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e,screenToWorldRatio:r},i,s,n,o){if(!i.options.selectionMode)return;const a=this._getLineSize(e,!0),l=s[0],c=s[1],p=fe(a,r);let u=Number.MAX_VALUE,m=0;for(const h of de(ye,ve,this.parameters,e)){const e=l-ye[0],r=c-ye[1],i=ve[0]-ye[0],s=ve[1]-ye[1],n=t((i*e+s*r)/(i*i+s*s),0,1),o=i*n-e,a=s*n-r,p=o*o+a*a;p<u&&(u=p,m=h)}u<p*p&&n(o.distance,o.normal,m)}intersectRay(t,r,i,s,n,a){const{options:l,camera:_,rayBegin:b,rayEnd:S}=i;if(!l.selectionMode||!t.visible||!_)return;if(!Q(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=t.attributes,y=P.get("position").data,v=this._getLineSize(P),w=Le;o(w,i.point);const j=v*_.pixelRatio,L=Je*_.pixelRatio,z=j/2+L;c(Ie[0],w[0]-z,w[1]+z,0),c(Ie[1],w[0]+z,w[1]+z,0),c(Ie[2],w[0]+z,w[1]-z,0),c(Ie[3],w[0]-z,w[1]-z,0);for(let e=0;e<4;e++)if(!_.unprojectFromRenderScreen(Ie[e],Ne[e]))return;C(_.eye,Ne[0],Ne[1],We),C(_.eye,Ne[1],Ne[2],ke),C(_.eye,Ne[2],Ne[3],De),C(_.eye,Ne[3],Ne[0],Ye);let R=Number.MAX_VALUE,V=0;for(const e of this._forEachTransformedLineSegment(Se,Pe,y,r,he(this.parameters,P))){if(A(We,Se)<0&&A(We,Pe)<0||A(ke,Se)<0&&A(ke,Pe)<0||A(De,Se)<0&&A(De,Pe)<0||A(Ye,Se)<0&&A(Ye,Pe)<0)continue;const t=_.projectToRenderScreen(Se,ze),r=_.projectToRenderScreen(Pe,Ce);if(null==t||null==r)continue;if(t[2]<0&&r[2]>0){p(Te,Se,Pe);const e=_.frustum,r=-A(e[4],Se)/u(Te,M(e[4]));if(m(Te,Te,r),h(Se,Se,Te),!_.projectToRenderScreen(Se,t))continue}else if(t[2]>0&&r[2]<0){p(Te,Pe,Se);const e=_.frustum,t=-A(e[4],Pe)/u(Te,M(e[4]));if(m(Te,Te,t),h(Pe,Pe,Te),!_.projectToRenderScreen(Pe,r))continue}else if(t[2]<0&&r[2]<0)continue;t[2]=0,r[2]=0;const i=E(t,r,Fe),s=x(i,w);if(!(s>=R)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(i,Se,Pe,w,_,v,L);if(s>=e*e)continue}R=s,f(Re,Se),f(Ve,Pe),V=e}}if(R<z*z){let e=Number.MAX_VALUE;if(T(E(Re,Ve,Fe),E(b,S,Oe),je)){p(je,je,b);const t=d(je);m(je,je,1/t),e=t/g(b,S)}a(e,je,V)}}intersectScreenPolygon(t,r,i,s){const{options:n,camera:o,screenPolygonPrimitiveProcessor:a}=i;if(!n.selectionMode||!t.visible)return null;if(!Q(r))return e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix"),null;const l=t.attributes,c=l.get("position").data,p=this._getLineSize(l),u=Je,m=u*o.pixelRatio,h=new G(4);for(const e of this._forEachTransformedLineSegment(Se,Pe,c,r,he(this.parameters,l)))for(const[t,r]of a.processLineSegment(qe,Se,Pe)){if(!q(o,t,r,ze,Ce))continue;const i=E(ze,Ce,Fe);let n=p/2+u;this.parameters.screenSizePerspective&&(_(Le,ze,Ce,.5),n=Math.max(n,this.computeScreenSizePerspectiveWidth(i,t,r,Le,o,p,m)/o.pixelRatio)),o.renderToScreen(ze,Ae),o.renderToScreen(Ce,Me),X(s,Ae,Me,n)&&(j(E(t,r,Oe),o.eye,we),h.updateIfCloserFromValues(g(o.eye,we),e,we,null))}return h}intersectScreenPolygonDraped({attributes:e,screenToWorldRatio:t},r,i,s){if(!i.options.selectionMode)return null;const n=fe(this._getLineSize(e,!0),t);for(const o of de(ye,ve,this.parameters,e,r))if(X(s,ye,ve,n))return new H(o);return null}createBufferWriter(){return new ue(ie(this.parameters),se(this.parameters),this.parameters)}createGLMaterial(e){return new ce(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:s(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,r,i,s,n,o){const a=L(e,i);_(we,t,r,a),b(Ee,we,s.viewMatrix);const l=d(Ee),c=this.computeCameraAbsCosAngle(we,s,this._configuration.spherical);be.update(c,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return be.apply(n)*s.pixelRatio/2+o}computeCameraAbsCosAngle(e,t,r){return r?S(je,e):c(je,0,0,1),p(xe,e,t.eye),S(xe,xe),Math.abs(u(je,xe))}_getLineSize(e,r=!1){let i=this.parameters.width;if(this.parameters.vvSize){const s=e.get("sizeFeatureAttribute").data[0];Number.isNaN(s)?r&&(i*=this.parameters.vvSize.fallback[0]):i*=t(this.parameters.vvSize.offset[0]+s*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has("size")&&(i*=e.get("size").data[0]);return i}*_forEachTransformedLineSegment(e,t,r,i,s){const n=s?r.length-2:r.length-5;for(let o=0;o<n;o+=3){e[0]=r[o]+i[12],e[1]=r[o+1]+i[13],e[2]=r[o+2]+i[14];const s=(o+3)%r.length;t[0]=r[s]+i[12],t[1]=r[s+1]+i[13],t[2]=r[s+2]+i[14],yield o/3}}}class ce extends Y{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(ne,e)}}class pe extends ee{constructor(){super(...arguments),this._width=0,this.color=y,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=n(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=n(0),this.endTime=n(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return $(this.stipplePattern)&&null!=this.stippleTexture}}class ue{constructor(e,t,r){this.layout=e,this.textureBufferLayout=t,this._parameters=r,this.numJoinSubdivisions=_e(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return he(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3+(this._isClosed(e)?3:2)}elementCount(e){const t=2,r=e.get("position").indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,s,n,o){null!=o&&this._writeTextureBuffer(e,r,i,o),null!=s&&this._writeVertexBuffer(e,r,i,s,n)}_writeTextureBuffer(e,t,r,i){const s=t.get("position"),n=s.data.length/3,o=this._isClosed(t),{buffer:a,offset:l}=i,c=a.getField("position",R),p=a.getField("u0",V),u=a.getField("sizeFeatureAttribute",V),m=a.getField("size",V),h=a.getField("colorFeatureAttribute",V),d=a.getField("color",F),_=a.getField("olidColor",F),b=a.getField("timeStamps",O),S=a.getField("opacityFeatureAttribute",V),P=t.get("sizeFeatureAttribute")?.data,y=t.get("size")?.data,v=t.get("colorFeatureAttribute")?.data,w=t.get("color")?.data,E=t.get("opacityFeatureAttribute")?.data,x=t.get("distanceToStart")?.data,T=t.get("timeStamps");Z(null!==c,"Expected valid position field in texture buffer"),Z(null!==p,"Expected valid u0 field in texture buffer");let j=0;for(let L=0;L<n;++L){this._getTransformedPosition(Ue,s.data,L,e),L>0&&(null!=x?j=x[L]??j:j+=g(Be,Ue));const t=l+L+1;if(c.setVec(t,Ue),p.set(t,j),f(Be,Ue),u&&u.set(t,1===P?.length?P[0]:P?.[L]??0),m&&m.set(t,1===y?.length?y[0]:y?.[L]??1),h&&h.set(t,1===v?.length?v[0]:v?.[L]??0),d)if(null!=w){const e=Math.min(4*L,w.length-4);d.setValues(t,w[e],w[e+1],w[e+2],w[e+3])}else d.setValues(t,1,1,1,1);S&&S.set(t,1===E?.length?E[0]:E?.[L]??0)}if(null!=b&&null!=T){Z(4===T.size);const e=T.data;for(let t=0;t<n;++t){const r=4*t,i=l+t+1;b.set(i,0,e[r]),b.set(i,1,e[r+1]),b.set(i,2,e[r+2]),b.set(i,3,e[r+3])}}if(o){const e=l,t=l+1,r=l+2,i=l+n,s=i+1,o=i+2;a.copyItem(i,e),a.copyItem(t,s),a.copyItem(r,o),c.getVec(i,Be),c.getVec(t,Ue);const u=j+g(Be,Ue);p.set(s,u)}else{const e=l,t=l+1,r=l+n,i=r+1;a.copyItem(t,e),a.copyItem(r,i)}D()&&null!=r&&null!=_&&te(r,_,n+(o?3:2),l)}_writeVertexBuffer(e,t,r,i,s){const{buffer:n,offset:o}=i,{layout:a}=this,l=t.get("position"),c=l.indices,p=l.data.length/3,u=this._isClosed(t),m=p+(u?3:2);c&&c.length!==2*(p-1)&&console.warn("RibbonLineMaterial does not support indices");const h=n.getField("textureElementIndex",B);Z(null!=h,"Missing texture buffer index field"),Z(null!=s,"Using a texture layout, but the texture range for this instance was not provided");const f=s.from;Z(s.numElements===m,"Expected number of elements in TextureBuffer to equal number of points");const d=new Float32Array(n.buffer),g=v(n.buffer),_=new Uint32Array(n.buffer),b=a.stride/4;let S=o*b;const P=S,y=d.BYTES_PER_ELEMENT/g.BYTES_PER_ELEMENT,w=(e,t,r)=>{const i=r+1;_[S]=f+i,S++;let s=S*y;g[s++]=e,g[s++]=t,S=Math.ceil(s/y)};S+=b;let E=0,x=0;u?(E=0,x=p):(w(1,-4,0),w(1,4,0),E=1,x=p-1);for(let v=E;v<x;v++){w(0,-1,v),w(0,1,v);const e=this.numJoinSubdivisions;for(let t=0;t<e;++t){const r=(t+1)/(e+1);w(r,-1,v),w(r,1,v)}w(1,-2,v),w(1,2,v)}u?(w(0,-1,x),w(0,1,x)):(w(0,-5,x),w(0,5,x)),me(d,P+b,d,P,b);S=me(d,S-b,d,S,b),this._parameters.wireframe&&this._addWireframeVertices(n,P,S,b)}_getTransformedPosition(e,t,r,i){const s=3*r;c(e,t[s+0],t[s+1],t[s+2]),i&&b(e,e,i)}_addWireframeVertices(e,t,r,i){const s=new Uint8Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),n=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(r-t)*Float32Array.BYTES_PER_ELEMENT),o=i*Float32Array.BYTES_PER_ELEMENT;let a=0;const l=e=>a=me(n,e,s,a,o);for(let c=0;c<=n.length-4*o;c+=2*o)l(c),l(c+2*o),l(c+1*o),l(c+2*o),l(c+1*o),l(c+3*o)}}function me(e,t,r,i,s){for(let n=0;n<s;n++)r[i++]=e[t++];return i}function he(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function fe(e,t){return(e/2+Je)*t}function*de(e,t,r,i,s){const n=i.get("position").data,l=he(r,i)?n.length-2:n.length-5,c=s?.[0]??0,p=s?.[1]??0;a(e,n[0]+c,n[1]+p);for(let u=3;u<l+3;u+=3){const r=u%n.length;a(t,n[r]+c,n[r+1]+p),yield u/3,o(e,t)}}function ge(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function _e(e,t){const r=t?1:0;switch(e){case"miter":case"bevel":return r;case"round":return re+r}}const be=new K,Se=P(),Pe=P(),ye=l(),ve=l(),we=P(),Ee=P(),xe=P(),Te=P(),je=P(),Le=P(),ze=r(),Ce=r(),Ae=i(),Me=i(),Re=P(),Ve=P(),Fe=w(),Oe=w(),Be=P(),Ue=P(),Ie=[r(),r(),r(),r()],Ne=[P(),P(),P(),P()],We=z(),ke=z(),De=z(),Ye=z(),Je=4,qe=[P(),P()];export{pe as Parameters,le as RibbonLineMaterial};
@@ -1,15 +1,18 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as t}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fadeInTime as e,fadeOutTime as i}from"../../support/flow/constants.js";import{Float2PassUniform as o}from"../core/shaderModules/Float2PassUniform.js";import{FloatPassUniform as l}from"../core/shaderModules/FloatPassUniform.js";import{glsl as m}from"../core/shaderModules/glsl.js";function n(a,n){const{hasAnimation:s,animation:T}=n;if(!s)return;const{attributes:f,varyings:p,vertex:u,fragment:c}=a;f.add("timeStamps","vec4"),p.add("vTimeStamp","float"),p.add("vFirstTime","float"),p.add("vLastTime","float"),p.add("vTransitionType","float"),u.main.add(m`vTimeStamp = timeStamps.x;
3
- vFirstTime = timeStamps.y;
4
- vLastTime = timeStamps.z;
5
- vTransitionType = timeStamps.w;`),3===T&&c.constants.add("decayRate","float",2.3),c.code.add(m`
2
+ import{set as t}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fadeInTime as e,fadeOutTime as i}from"../../support/flow/constants.js";import{Float2PassUniform as o}from"../core/shaderModules/Float2PassUniform.js";import{FloatPassUniform as m}from"../core/shaderModules/FloatPassUniform.js";import{glsl as l}from"../core/shaderModules/glsl.js";function n(a,n){const{hasAnimation:s,animation:T}=n;if(!s)return;const{attributes:f,varyings:p,vertex:u,fragment:c}=a,h=n.timeStampsExpr??"timeStamps";null==n.timeStampsExpr&&f.add("timeStamps","vec4"),p.add("vTimeStamp","float"),p.add("vFirstTime","float"),p.add("vLastTime","float"),p.add("vTransitionType","float"),u.main.add(l`
3
+ vec4 animatedLineTimeStamps = ${h};
4
+ vTimeStamp = animatedLineTimeStamps.x;
5
+ vFirstTime = animatedLineTimeStamps.y;
6
+ vLastTime = animatedLineTimeStamps.z;
7
+ vTransitionType = animatedLineTimeStamps.w;
8
+ `),3===T&&c.constants.add("decayRate","float",2.3),c.code.add(l`
6
9
  float getTrailOpacity(float x) {
7
10
  if (x < 0.0) {
8
11
  return 0.0;
9
12
  }
10
13
 
11
14
  ${d(T)}
12
- }`),c.uniforms.add(new l("timeElapsed",t=>t.timeElapsed),new l("trailLength",t=>t.trailLength),new l("speed",t=>t.animationSpeed),new o("startEndTime",a=>t(r,a.startTime,a.endTime))),c.constants.add("fadeInTime","float",e),c.constants.add("fadeOutTime","float",i),c.constants.add("incomingTransition","int",0),c.constants.add("outgoingTransition","int",2),c.code.add(m`float fadeIn(float x) {
15
+ }`),c.uniforms.add(new m("timeElapsed",t=>t.timeElapsed),new m("trailLength",t=>t.trailLength),new m("speed",t=>t.animationSpeed),new o("startEndTime",a=>t(r,a.startTime,a.endTime))),c.constants.add("fadeInTime","float",e),c.constants.add("fadeOutTime","float",i),c.constants.add("incomingTransition","int",0),c.constants.add("outgoingTransition","int",2),c.code.add(l`float fadeIn(float x) {
13
16
  return smoothstep(0.0, fadeInTime, x);
14
17
  }
15
18
  float fadeOut(float x) {
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import"../core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import"../core/shaderLibrary/shading/LineStipple.glsl.js";import"../core/shaderLibrary/shading/MarkerSizing.glsl.js";import"../core/shaderLibrary/shading/PiUtils.glsl.js";import"../core/shaderLibrary/shading/PositionOutsideClipSpace.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/NoPerspective.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float2BindUniform.js";import"../core/shaderModules/Float4BindUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatBindUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Matrix4BindUniform.js";import"./alphaCutoff.glsl.js";import"./AnimatedLine.glsl.js";import"./OutputColorHighlightOLID.glsl.js";import"./RibbonLineTextureBuffer.glsl.js";import"../../../webgl/ShaderBuilder.js";export{b as build,r as ribbonlineNumRoundJoinSubdivisions}from"../../../../chunks/RibbonLine.glsl.js";
2
+ import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import"../core/shaderLibrary/shading/LineStipple.glsl.js";import"../core/shaderLibrary/shading/MarkerSizing.glsl.js";import"../core/shaderLibrary/shading/PiUtils.glsl.js";import"../core/shaderLibrary/shading/PositionOutsideClipSpace.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/NoPerspective.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float2BindUniform.js";import"../core/shaderModules/Float4BindUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatBindUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Matrix4BindUniform.js";import"./alphaCutoff.glsl.js";import"./AnimatedLine.glsl.js";import"./OutputColorHighlightOLID.glsl.js";import"./RibbonLineTextureBuffer.glsl.js";import"../../../webgl/ShaderBuilder.js";export{b as build,r as ribbonlineNumRoundJoinSubdivisions}from"../../../../chunks/RibbonLine.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{newLayout as e}from"../../support/buffer/InterleavedLayout.js";import{olidEnabled as t}from"../effects/geometry/olidUtils.js";import{TextureBackedBufferLayout as r}from"../lib/TextureBackedBuffer/TextureBackedBufferLayout.js";function o(r){const o=e().u32("textureElementIndex",{integer:!0}).f32("u0").vec2f16("lineParameters");return r.hasVVColor?o.f32("colorFeatureAttribute"):o.vec4u8("color",{glNormalized:!0}),r.hasVVSize?o.f32("sizeFeatureAttribute"):o.f32("size"),r.hasVVOpacity&&o.f32("opacityFeatureAttribute"),t()&&o.vec4u8("olidColor"),r.hasAnimation&&o.vec4f16("timeStamps"),o}const i=new r([{type:"vec3f32",name:"position"}]);function u(e){return i}export{i as baseTextureBufferLayout,o as getLayout,u as getTextureBufferLayout};
2
+ import{newLayout as e}from"../../support/buffer/InterleavedLayout.js";import{olidEnabled as t}from"../effects/geometry/olidUtils.js";import{TextureBackedBufferLayout as r}from"../lib/TextureBackedBuffer/TextureBackedBufferLayout.js";function o(t){return e().u32("textureElementIndex",{integer:!0}).vec2f16("lineParameters")}const u=[{type:"vec3f32",name:"position"},{type:"f32",name:"u0"}];function n(e){const o=[...u];return e.hasVVColor?o.push({type:"f32",name:"colorFeatureAttribute"}):o.push({type:"vec4unorm8",name:"color"}),e.hasVVSize?o.push({type:"f32",name:"sizeFeatureAttribute"}):o.push({type:"f32",name:"size"}),e.hasVVOpacity&&o.push({type:"f32",name:"opacityFeatureAttribute"}),t()&&o.push({type:"vec4unorm8",name:"olidColor"}),e.hasAnimation&&o.push({type:"vec4f16",name:"timeStamps"}),new r(o)}export{o as getLayout,n as getTextureBufferLayout};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as i}from"../../../../core/accessorSupport/decorators.js";import{glLayout as t}from"../../support/buffer/glUtil.js";import{ReloadableShader as r}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as l}from"../core/shaderTechnique/ShaderTechnique.js";import{depthWrite as s,depthTest as n,blending as o}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBase as c,stencilBaseAllZeros as p,stencilWriteMaskOn as u,stencilToolTransparentOccluder as a,depthCompareAlways as d,stencilToolMaskOccluder as h,stencilWriteMaskOff as m,depthCompareLess as f}from"../lib/StencilUtils.js";import{getRibbonLineLayerPolygonOffset as g}from"../materials/PolygonOffset.js";import{R as b}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as P}from"./RibbonLineLayouts.js";import{PrimitiveType as T}from"../../../webgl/enums.js";import{makePipelineState as W,defaultColorWrite as j,unpremultipliedAlphaToPremultipliedAlpha as _}from"../../../webgl/renderState.js";let O=class extends l{constructor(e,i){super(e,i,t(P(i))),this.shader=new r(b,()=>import("./RibbonLine.glsl.js")),this.ignoreUnused=!0,this.primitiveType=i.wireframe?T.LINES:T.TRIANGLE_STRIP}_makePipelineState(e,i){const{output:t,hasOccludees:r}=e;return W({blending:o(t,!1,e.emissionDimmingPass),depthTest:n(t),depthWrite:s(e),colorWrite:j,stencilWrite:r?u:null,stencilTest:r?i?c:p:null,polygonOffset:g(e)})}initializePipeline(e){if(e.occluder){const{hasOccludees:i}=e;this._occluderPipelineTransparent=W({blending:_,polygonOffset:g(e),depthTest:d,depthWrite:null,colorWrite:j,stencilWrite:null,stencilTest:i?a:null}),this._occluderPipelineOpaque=W({blending:_,polygonOffset:g(e),depthTest:i?d:f,depthWrite:null,colorWrite:j,stencilWrite:i?m:null,stencilTest:i?h:null}),this._occluderPipelineMaskWrite=W({blending:null,polygonOffset:g(e),depthTest:f,depthWrite:null,colorWrite:null,stencilWrite:i?u:null,stencilTest:i?c:null})}return this._occludeePipeline=this._makePipelineState(e,!0),this._makePipelineState(e,!1)}getPipeline(e,i,t){if(t)return this._occludeePipeline;switch(e.occluder){case 11:return this._occluderPipelineTransparent??super.getPipeline(e,i,t);case 10:return this._occluderPipelineOpaque??super.getPipeline(e,i,t);default:e.occluder;case void 0:case null:return this._occluderPipelineMaskWrite??super.getPipeline(e,i,t)}}};O=e([i("esri.views.3d.webgl-engine.shaders.RibbonLineTechnique")],O);export{O as RibbonLineTechnique};
2
+ import{__decorate as e}from"tslib";import{subclass as i}from"../../../../core/accessorSupport/decorators.js";import{glLayout as t}from"../../support/buffer/glUtil.js";import{ReloadableShader as r}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as l}from"../core/shaderTechnique/ShaderTechnique.js";import{depthWrite as s,depthTest as n,blending as o}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBase as c,stencilBaseAllZeros as p,stencilWriteMaskOn as u,stencilToolTransparentOccluder as a,depthCompareAlways as d,stencilToolMaskOccluder as h,stencilWriteMaskOff as m,depthCompareLess as f}from"../lib/StencilUtils.js";import{getRibbonLineLayerPolygonOffset as g}from"../materials/PolygonOffset.js";import{R as b}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as P}from"./RibbonLineLayouts.js";import{PrimitiveType as T}from"../../../webgl/enums.js";import{makePipelineState as W,defaultColorWrite as j,unpremultipliedAlphaToPremultipliedAlpha as _}from"../../../webgl/renderState.js";let O=class extends l{constructor(e,i){super(e,i,t(P())),this.shader=new r(b,()=>import("./RibbonLine.glsl.js")),this.ignoreUnused=!0,this.primitiveType=i.wireframe?T.LINES:T.TRIANGLE_STRIP}_makePipelineState(e,i){const{output:t,hasOccludees:r}=e;return W({blending:o(t,!1,e.emissionDimmingPass),depthTest:n(t),depthWrite:s(e),colorWrite:j,stencilWrite:r?u:null,stencilTest:r?i?c:p:null,polygonOffset:g(e)})}initializePipeline(e){if(e.occluder){const{hasOccludees:i}=e;this._occluderPipelineTransparent=W({blending:_,polygonOffset:g(e),depthTest:d,depthWrite:null,colorWrite:j,stencilWrite:null,stencilTest:i?a:null}),this._occluderPipelineOpaque=W({blending:_,polygonOffset:g(e),depthTest:i?d:f,depthWrite:null,colorWrite:j,stencilWrite:i?m:null,stencilTest:i?h:null}),this._occluderPipelineMaskWrite=W({blending:null,polygonOffset:g(e),depthTest:f,depthWrite:null,colorWrite:null,stencilWrite:i?u:null,stencilTest:i?c:null})}return this._occludeePipeline=this._makePipelineState(e,!0),this._makePipelineState(e,!1)}getPipeline(e,i,t){if(t)return this._occludeePipeline;switch(e.occluder){case 11:return this._occluderPipelineTransparent??super.getPipeline(e,i,t);case 10:return this._occluderPipelineOpaque??super.getPipeline(e,i,t);default:e.occluder;case void 0:case null:return this._occluderPipelineMaskWrite??super.getPipeline(e,i,t)}}};O=e([i("esri.views.3d.webgl-engine.shaders.RibbonLineTechnique")],O);export{O as RibbonLineTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{TextureBackedBufferModule as e}from"../core/shaderLibrary/TextureBackedBuffer.glsl.js";import{Texture2DUintDrawUniform as r}from"../core/shaderModules/Texture2DUintDrawUniform.js";import{baseTextureBufferLayout as o}from"./RibbonLineLayouts.js";const t=new e({layout:o,itemIndexExpression:"textureElementIndex",bufferUniform:new r("componentTextureBuffer",e=>e.textureBuffer)});function n(e){return t}export{n as getTextureBackedBufferModule};
2
+ import{TextureBackedBufferModule as e}from"../core/shaderLibrary/TextureBackedBuffer.glsl.js";import{Texture2DUintDrawUniform as r}from"../core/shaderModules/Texture2DUintDrawUniform.js";import{getTextureBufferLayout as o}from"./RibbonLineLayouts.js";const t=new r("componentTextureBuffer",e=>e.textureBuffer);function n(r){return new e({layout:o(r),itemIndexExpression:"textureElementIndex",bufferUniform:t})}export{n as getTextureBackedBufferModule};