@arcgis/core 5.2.0-next.86 → 5.2.0-next.87

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 (119) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/0993e51d3a9701ed2198.js +1 -0
  3. package/assets/esri/core/workers/chunks/114ba901fd319ce87dc6.js +1 -0
  4. package/assets/esri/core/workers/chunks/{3aeb934ebdab1d8c4608.js → 12a3b55195ce3244259d.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{7c3d46201b11a45f79d0.js → 39c0a3eb6a870953d530.js} +74 -107
  6. package/assets/esri/core/workers/chunks/3b009c05eaec5a7048a8.js +1 -0
  7. package/assets/esri/core/workers/chunks/3b376318df4ff8519370.js +1 -0
  8. package/assets/esri/core/workers/chunks/{a0da026a06de379b8f39.js → 3de20165796fa4f76728.js} +1 -1
  9. package/assets/esri/core/workers/chunks/414093fa4957d17bf551.js +1 -0
  10. package/assets/esri/core/workers/chunks/{4ec306e5c11808b96e07.js → 48b31b8534e7bfe42976.js} +1 -1
  11. package/assets/esri/core/workers/chunks/48f6af09436723f2d861.js +1 -0
  12. package/assets/esri/core/workers/chunks/5536cee0dfc183584a9b.js +1 -0
  13. package/assets/esri/core/workers/chunks/6561c01c67db1f4c546e.js +1 -0
  14. package/assets/esri/core/workers/chunks/68705692335d57522030.js +1 -0
  15. package/assets/esri/core/workers/chunks/{ed5e9718c4dcad1156f7.js → 6f2a9259240769c7cd6e.js} +1 -1
  16. package/assets/esri/core/workers/chunks/7b2174b19d06c16715f0.js +1 -0
  17. package/assets/esri/core/workers/chunks/{b015b8c7a073dbc4a3ad.js → 820c530b8765ecb1f36e.js} +1 -1
  18. package/assets/esri/core/workers/chunks/830daaca32352da6eebe.js +1 -0
  19. package/assets/esri/core/workers/chunks/8c2921081ca3e7fd0385.js +1 -0
  20. package/assets/esri/core/workers/chunks/9407db0584c730591161.js +1 -0
  21. package/assets/esri/core/workers/chunks/9658b46a7111cda53b0d.js +1 -0
  22. package/assets/esri/core/workers/chunks/974bcaf2a059b8cfb153.js +1 -0
  23. package/assets/esri/core/workers/chunks/9c7fc1c97125ea2a7b7e.js +1 -0
  24. package/assets/esri/core/workers/chunks/9ee6e8a6b9bfda758c21.js +1 -0
  25. package/assets/esri/core/workers/chunks/b3c518ca8679fbe16ece.js +1 -0
  26. package/assets/esri/core/workers/chunks/b61b7005edd9ced925e9.js +1 -0
  27. package/assets/esri/core/workers/chunks/c1a7c475ce0c59ffa75a.js +1 -0
  28. package/assets/esri/core/workers/chunks/{3da39efc5f68f15c105f.js → c2b2942456f1b10d0e96.js} +1 -1
  29. package/assets/esri/core/workers/chunks/c5dc2743c7116d0bc0d8.js +1 -0
  30. package/assets/esri/core/workers/chunks/c68cc3b9c170b8de22dc.js +1 -0
  31. package/assets/esri/core/workers/chunks/d56603e1d0031f3c5f3b.js +1 -0
  32. package/assets/esri/core/workers/chunks/e474106292834633e7d4.js +1 -0
  33. package/assets/esri/core/workers/chunks/{d09491b340af3b779505.js → f988d5a6dcc15fe34797.js} +1 -1
  34. package/assets/esri/core/workers/chunks/fbd02e8277fe2252ecd2.js +1 -0
  35. package/assets/esri/themes/base/widgets/_BuildingDisciplinesTree.scss +1 -1
  36. package/assets/esri/themes/base/widgets/_Daylight.scss +2 -2
  37. package/assets/esri/themes/base/widgets/_Editor.scss +1 -1
  38. package/assets/esri/themes/base/widgets/_Sketch.scss +1 -1
  39. package/assets/esri/themes/base/widgets/_SketchTooltipControls.scss +1 -1
  40. package/assets/esri/themes/base/widgets/_Slider.scss +1 -1
  41. package/assets/esri/themes/base/widgets/_SnappingControls.scss +1 -1
  42. package/assets/esri/themes/base/widgets/_TimezonePicker.scss +1 -1
  43. package/chunks/EmissionComposite.glsl.js +2 -2
  44. package/chunks/GlobalIllumination.glsl.js +69 -102
  45. package/chunks/RibbonLine.glsl.js +202 -141
  46. package/config.js +1 -1
  47. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  48. package/geometry/operators/projectOperator.d.ts +1 -1
  49. package/geometry/operators/shapePreservingProjectOperator.d.ts +15 -1
  50. package/geometry/operators/support/GeographicTransformation.d.ts +4 -3
  51. package/geometry/operators/support/GeographicTransformationStep.d.ts +2 -1
  52. package/geometry/operators/support/geographicTransformationUtils.d.ts +22 -15
  53. package/geometry/operators/types.d.ts +2 -1
  54. package/geometry/support/convexPolyhedron.js +2 -0
  55. package/geometry/support/frustum.js +1 -1
  56. package/kernel.js +1 -1
  57. package/layers/LinkChartLayer.js +1 -1
  58. package/layers/support/mediaUtils.js +1 -1
  59. package/package.json +3 -3
  60. package/popup/FeatureContentCollection.js +1 -1
  61. package/support/actions/ActionBase.d.ts +1 -1
  62. package/support/revision.js +1 -1
  63. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  64. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  65. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  66. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  67. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  68. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  69. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  70. package/views/3d/state/utils/navigationUtils.js +1 -1
  71. package/views/3d/state/utils/ropePullUtils.js +2 -0
  72. package/views/3d/support/ElevationAgnosticVisibility.js +2 -0
  73. package/views/3d/support/engineContent/line.js +1 -1
  74. package/views/3d/support/sphericalTileUtils.js +2 -0
  75. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatCovariance.glsl.js +9 -3
  76. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatEvaluation.glsl.js +5 -8
  77. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  78. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  79. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  80. package/views/3d/webgl-engine/lib/Material.js +1 -1
  81. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  82. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  83. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  84. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  85. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  86. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  87. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  88. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  89. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  90. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  91. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  92. package/views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js +39 -51
  93. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  94. package/views/popupAdapter.js +1 -1
  95. package/assets/esri/core/workers/chunks/05acc17cb66fa6c08845.js +0 -1
  96. package/assets/esri/core/workers/chunks/11224af8b037ccbf252c.js +0 -1
  97. package/assets/esri/core/workers/chunks/17a10916114754f1f216.js +0 -1
  98. package/assets/esri/core/workers/chunks/1b4e050a3884fc6fa6cf.js +0 -1
  99. package/assets/esri/core/workers/chunks/2f652b330a9978a68e83.js +0 -1
  100. package/assets/esri/core/workers/chunks/33d6ca59eeb88e739c81.js +0 -1
  101. package/assets/esri/core/workers/chunks/3cecf627827f5d9213a9.js +0 -1
  102. package/assets/esri/core/workers/chunks/40ec85b7813a396ee490.js +0 -1
  103. package/assets/esri/core/workers/chunks/5903dceb172897e5675b.js +0 -1
  104. package/assets/esri/core/workers/chunks/5e5a05abcb41915802f6.js +0 -1
  105. package/assets/esri/core/workers/chunks/62f37d1075390a177ae9.js +0 -1
  106. package/assets/esri/core/workers/chunks/73cb944b87ffce33bb49.js +0 -1
  107. package/assets/esri/core/workers/chunks/86de2d1f13915ab7a51d.js +0 -1
  108. package/assets/esri/core/workers/chunks/9b5e890fb0ab29f3a3f1.js +0 -1
  109. package/assets/esri/core/workers/chunks/ad29b77843a7d93d9f8a.js +0 -1
  110. package/assets/esri/core/workers/chunks/b812f817c465c64e8c63.js +0 -1
  111. package/assets/esri/core/workers/chunks/b94b36581842749863f0.js +0 -1
  112. package/assets/esri/core/workers/chunks/bc6e488f5fbd50f9f3d0.js +0 -1
  113. package/assets/esri/core/workers/chunks/c229325f41f10fe7f732.js +0 -1
  114. package/assets/esri/core/workers/chunks/ca6652c6304ad0e37e8f.js +0 -1
  115. package/assets/esri/core/workers/chunks/d4d2a0d882fef463e7bc.js +0 -1
  116. package/assets/esri/core/workers/chunks/da45d9576b8d66131623.js +0 -1
  117. package/assets/esri/core/workers/chunks/e76662562e03eef52ba4.js +0 -1
  118. package/assets/esri/core/workers/chunks/f1d0208c6b09c1c4b248.js +0 -1
  119. package/assets/esri/core/workers/chunks/f3680b71d496839de72c.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as t,transformMat4 as n,normalize as o,scale as e,add as s,dot as r,cross as l,subtract as h,copy as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as i,fromValues as a,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{clone as p,create as f,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as g}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as m,floatArrayFrom as M}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as y,getZeroIndexArray as A}from"../../../../geometry/support/Indices.js";import{create as b,fromPositionAndNormal as j,intersectRay as d}from"../../../../geometry/support/plane.js";import{wrap as v}from"../../../../geometry/support/ray.js";import{addOlidAttribute as I}from"../../layers/graphics/olidUtils.js";import{timeStampsToAttribute as P,numTimeStampValuesPerVertex as x}from"../../support/engineContent/line.js";import{Attribute as D}from"./Attribute.js";import{scale as z,length as S,normalize as U,add as q}from"./bufferVectorMath.js";import{Geometry as C}from"./Geometry.js";import{assert as F}from"./Util.js";import{getHUDMaterialBaseInstance as O}from"../materials/HUDMaterialBaseInstance.js";const V=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],B=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],G=[0,0,1,0,1,1,0,1],H=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],k=new Array(36);for(let xt=0;xt<6;xt++)for(let t=0;t<6;t++)k[6*xt+t]=xt;const E=new Array(36);for(let xt=0;xt<6;xt++)E[6*xt]=0,E[6*xt+1]=1,E[6*xt+2]=2,E[6*xt+3]=2,E[6*xt+4]=3,E[6*xt+5]=0;function J(t,n){Array.isArray(n)||(n=[n,n,n]);const o=new Array(24);for(let e=0;e<8;e++)o[3*e]=V[e][0]*n[0],o[3*e+1]=V[e][1]*n[1],o[3*e+2]=V[e][2]*n[2];return new C(t,[["position",new D(o,H,3,!0)],["normal",new D(B,k,3)],["uv0",new D(G,E,2)]])}const K=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],L=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],N=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],Q=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function R(t,n){Array.isArray(n)||(n=[n,n,n]);const o=new Array(18);for(let e=0;e<6;e++)o[3*e]=K[e][0]*n[0],o[3*e+1]=K[e][1]*n[1],o[3*e+2]=K[e][2]*n[2];return new C(t,[["position",new D(o,N,3,!0)],["normal",new D(L,Q,3)]])}const T=a(-.5,0,-.5),W=a(.5,0,-.5),X=a(0,0,.5),Y=a(0,.5,0),Z=c(),$=c(),_=c(),tt=c(),nt=c();h(Z,T,Y),h($,T,W),l(_,Z,$),o(_,_),h(Z,W,Y),h($,W,X),l(tt,Z,$),o(tt,tt),h(Z,X,Y),h($,X,T),l(nt,Z,$),o(nt,nt);const ot=[T,W,X,Y],et=[0,-1,0,_[0],_[1],_[2],tt[0],tt[1],tt[2],nt[0],nt[1],nt[2]],st=[0,1,2,3,1,0,3,2,1,3,0,2],rt=[0,0,0,1,1,1,2,2,2,3,3,3];function lt(t,n){Array.isArray(n)||(n=[n,n,n]);const o=new Array(12);for(let e=0;e<4;e++)o[3*e]=ot[e][0]*n[0],o[3*e+1]=ot[e][1]*n[1],o[3*e+2]=ot[e][2]*n[2];return new C(t,[["position",new D(o,st,3,!0)],["normal",new D(et,rt,3)]])}function ht(t,n,o,e,s={uv:!0}){const r=-Math.PI,l=2*Math.PI,h=-Math.PI/2,u=Math.PI,i=Math.max(3,Math.floor(o)),a=Math.max(2,Math.floor(e)),c=(i+1)*(a+1),p=m(3*c),f=m(3*c),w=m(2*c),g=[];let M=0;for(let m=0;m<=a;m++){const t=[],o=m/a,e=h+o*u,s=Math.cos(e);for(let h=0;h<=i;h++){const u=h/i,a=r+u*l,c=Math.cos(a)*s,g=Math.sin(e),m=-Math.sin(a)*s;p[3*M]=c*n,p[3*M+1]=g*n,p[3*M+2]=m*n,f[3*M]=c,f[3*M+1]=g,f[3*M+2]=m,w[2*M]=u,w[2*M+1]=o,t.push(M),++M}g.push(t)}const y=new Array;for(let m=0;m<a;m++)for(let t=0;t<i;t++){const n=g[m][t],o=g[m][t+1],e=g[m+1][t+1],s=g[m+1][t];0===m?(y.push(n),y.push(e),y.push(s)):m===a-1?(y.push(n),y.push(o),y.push(e)):(y.push(n),y.push(o),y.push(e),y.push(e),y.push(s),y.push(n))}const b=[["position",new D(p,y,3,!0)],["normal",new D(f,y,3,!0)]];return s.uv&&b.push(["uv0",new D(w,y,2,!0)]),s.offset&&(b[0][0]="offset",b.push(["position",new D(Float64Array.from(s.offset),A(y.length),3,!0)])),new C(t,b)}function ut(t,n,o,e){const s=it(n,o,e);return new C(t,s)}function it(t,n,o){const e=t;let s,r;if(o)s=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],r=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{const t=e*(1+Math.sqrt(5))/2;s=[-e,t,0,e,t,0,-e,-t,0,e,-t,0,0,-e,t,0,e,t,0,-e,-t,0,e,-t,t,0,-e,t,0,e,-t,0,-e,-t,0,e],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let i=0;i<s.length;i+=3)z(s,i,t/S(s,i));let l={};function h(n,o){n>o&&([n,o]=[o,n]);const e=n.toString()+"."+o.toString();if(l[e])return l[e];let r=s.length;return s.length+=3,q(s,3*n,s,3*o,s,r),z(s,r,t/S(s,r)),r/=3,l[e]=r,r}for(let i=0;i<n;i++){const t=r.length,n=new Array(4*t);for(let o=0;o<t;o+=3){const t=r[o],e=r[o+1],s=r[o+2],l=h(t,e),u=h(e,s),i=h(s,t),a=4*o;n[a]=t,n[a+1]=l,n[a+2]=i,n[a+3]=e,n[a+4]=u,n[a+5]=l,n[a+6]=s,n[a+7]=i,n[a+8]=u,n[a+9]=l,n[a+10]=u,n[a+11]=i}r=n,l={}}const u=M(s);for(let i=0;i<u.length;i+=3)U(u,i);return[["position",new D(M(s),r,3,!0)],["normal",new D(u,r,3,!0)]]}function at(t,{normal:n,position:o,color:e,rotation:s,size:r,centerOffset:l,groundDistance:h,uvi:u,featureAttribute:i,olidColor:a=null}={}){const c=o?p(o):f(),g=n?p(n):w(0,0,1),m=null!=h?[h]:[1],M=A(1),y=[["position",new D(c,M,3,!0)],["normal",new D(g,M,3,!0)]],b=null!=r&&2===r.length?r:null;if(b&&y.push(["size",new D(b,M,2)]),null!=s&&y.push(["rotation",new D([s],M,1,!0)]),e){const t=[e[0],e[1],e[2],e.length>3?e[3]:255];y.push(["color",new D(t,M,4,!0)])}if(u&&y.push(["uvi",new D(u,M,u.length)]),l&&y.push(["centerOffset",new D(l,M,3)]),y.push(["groundDistance",new D(m,M,1)]),i){const t=[i[0],i[1],i[2],i[3]];y.push(["featureAttribute",new D(t,M,4)])}return null!=a&&I(y,a,M),new C(t,y,null,1,void 0,O())}const ct=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function pt(t,n=ct){const o=new Array(12);for(let i=0;i<4;i++)for(let t=0;t<3;t++)o[3*i+t]=n[i][t];const e=[0,1,2,2,3,0],s=[0,0,1],r=[0,0,0,0,0,0],l=[0,0,1,0,1,1,0,1],h=[255,255,255,255],u=[["position",new D(o,e,3,!0)],["normal",new D(s,r,3,!0)],["uv0",new D(l,e,2,!0)],["color",new D(h,r,4,!0)]];return new C(t,u)}function ft(t,n,o,e,s=!0,r=!0){let l=0;const h=n,u=t;let i=a(0,l,0),c=a(0,l+u,0),p=a(0,-1,0),f=a(0,1,0);e&&(l=u,c=a(0,0,0),i=a(0,l,0),p=a(0,1,0),f=a(0,-1,0));const w=[c,i],g=[p,f],M=o+2,y=Math.sqrt(u*u+h*h);if(e)for(let m=o-1;m>=0;m--){const t=m*(2*Math.PI/o),n=a(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const e=a(u*Math.cos(t)/y,-h/y,u*Math.sin(t)/y);g.push(e)}else for(let m=0;m<o;m++){const t=m*(2*Math.PI/o),n=a(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const e=a(u*Math.cos(t)/y,h/y,u*Math.sin(t)/y);g.push(e)}const A=new Array,b=new Array;if(s){for(let t=3;t<w.length;t++)A.push(1),A.push(t-1),A.push(t),b.push(0),b.push(0),b.push(0);A.push(w.length-1),A.push(2),A.push(1),b.push(0),b.push(0),b.push(0)}if(r){for(let t=3;t<w.length;t++)A.push(t),A.push(t-1),A.push(0),b.push(t),b.push(t-1),b.push(1);A.push(0),A.push(2),A.push(w.length-1),b.push(1),b.push(2),b.push(g.length-1)}const j=m(3*M);for(let a=0;a<M;a++)j[3*a]=w[a][0],j[3*a+1]=w[a][1],j[3*a+2]=w[a][2];const d=m(3*M);for(let a=0;a<M;a++)d[3*a]=g[a][0],d[3*a+1]=g[a][1],d[3*a+2]=g[a][2];return[["position",new D(j,A,3,!0)],["normal",new D(d,b,3,!0)]]}function wt(t,n,o,e,s,r=!0,l=!0){return new C(t,ft(n,o,e,s,r,l))}function gt(n,h,u,p,f,w,g){const M=f?i(f):a(1,0,0),y=w?i(w):a(0,0,0);g??=!0;const A=c();o(A,M);const b=c();e(b,A,Math.abs(h));const j=c();e(j,b,-.5),s(j,j,y);const d=a(0,1,0);Math.abs(1-r(A,d))<.2&&t(d,0,0,1);const v=c();l(v,A,d),o(v,v),l(d,v,A);const I=2*p+(g?2:0),P=p+(g?2:0),x=m(3*I),z=m(3*P),S=m(2*I),U=new Array(3*p*(g?4:2)),q=new Array(3*p*(g?4:2));g&&(x[3*(I-2)]=j[0],x[3*(I-2)+1]=j[1],x[3*(I-2)+2]=j[2],S[2*(I-2)]=0,S[2*(I-2)+1]=0,x[3*(I-1)]=x[3*(I-2)]+b[0],x[3*(I-1)+1]=x[3*(I-2)+1]+b[1],x[3*(I-1)+2]=x[3*(I-2)+2]+b[2],S[2*(I-1)]=1,S[2*(I-1)+1]=1,z[3*(P-2)]=-A[0],z[3*(P-2)+1]=-A[1],z[3*(P-2)+2]=-A[2],z[3*(P-1)]=A[0],z[3*(P-1)+1]=A[1],z[3*(P-1)+2]=A[2]);const F=(t,n,o)=>{U[t]=n,q[t]=o};let O=0;const V=c(),B=c();for(let t=0;t<p;t++){const n=t*(2*Math.PI/p);e(V,d,Math.sin(n)),e(B,v,Math.cos(n)),s(V,V,B),z[3*t]=V[0],z[3*t+1]=V[1],z[3*t+2]=V[2],e(V,V,u),s(V,V,j),x[3*t]=V[0],x[3*t+1]=V[1],x[3*t+2]=V[2],S[2*t]=t/p,S[2*t+1]=0,x[3*(t+p)]=x[3*t]+b[0],x[3*(t+p)+1]=x[3*t+1]+b[1],x[3*(t+p)+2]=x[3*t+2]+b[2],S[2*(t+p)]=t/p,S[2*t+1]=1;const o=(t+1)%p;F(O++,t,t),F(O++,t+p,t),F(O++,o,o),F(O++,o,o),F(O++,t+p,t),F(O++,o+p,o)}if(g){for(let t=0;t<p;t++){const n=(t+1)%p;F(O++,I-2,P-2),F(O++,t,P-2),F(O++,n,P-2)}for(let t=0;t<p;t++){const n=(t+1)%p;F(O++,t+p,P-1),F(O++,I-1,P-1),F(O++,n+p,P-1)}}const G=[["position",new D(x,U,3,!0)],["normal",new D(z,q,3,!0)],["uv0",new D(S,U,2,!0)]];return new C(n,G)}function mt(t,n,o,e,s,r){e=e||10,s=null==s||s,F(n.length>1);const l=[[0,0,0]],h=[],u=[];for(let i=0;i<e;i++){h.push([0,-i-1,-(i+1)%e-1]);const t=i/e*2*Math.PI;u.push([Math.cos(t)*o,Math.sin(t)*o])}return Mt(t,u,n,l,h,s,r)}function Mt(n,r,i,c,p,w,g=a(0,0,0)){const M=r.length,y=m(i.length*M*3+(6*c.length||0)),A=m(i.length*M*3+(c?6:0)),I=new Array,P=new Array;let x=0,z=0;const S=f(),U=f(),q=f(),F=f(),O=f(),V=f(),B=f(),G=f(),H=f(),k=f(),E=f(),J=f(),K=f(),L=b();t(H,0,1,0),h(U,i[1],i[0]),o(U,U),w?(s(G,i[0],g),o(q,G)):t(q,0,0,1),vt(U,q,H,H,O,q,It),u(F,q),u(J,O);for(let t=0;t<c.length;t++)e(V,O,c[t][0]),e(G,q,c[t][2]),s(V,V,G),s(V,V,i[0]),y[x++]=V[0],y[x++]=V[1],y[x++]=V[2];A[z++]=-U[0],A[z++]=-U[1],A[z++]=-U[2];for(let t=0;t<p.length;t++)I.push(p[t][0]>0?p[t][0]:-p[t][0]-1+c.length),I.push(p[t][1]>0?p[t][1]:-p[t][1]-1+c.length),I.push(p[t][2]>0?p[t][2]:-p[t][2]-1+c.length),P.push(0),P.push(0),P.push(0);let N=c.length;const Q=c.length-1;for(let t=0;t<i.length;t++){let n=!1;if(t>0){u(S,U),t<i.length-1?(h(U,i[t+1],i[t]),o(U,U)):n=!0,s(k,S,U),o(k,k),s(E,i[t-1],F),j(i[t],k,L);d(L,v(E,S),G)?(h(G,G,i[t]),o(q,G),l(O,k,q),o(O,O)):vt(k,F,J,H,O,q,It),u(F,q),u(J,O)}w&&(s(G,i[t],g),o(K,G));for(let l=0;l<M;l++)if(e(V,O,r[l][0]),e(G,q,r[l][1]),s(V,V,G),o(B,V),A[z++]=B[0],A[z++]=B[1],A[z++]=B[2],s(V,V,i[t]),y[x++]=V[0],y[x++]=V[1],y[x++]=V[2],!n){const t=(l+1)%M;I.push(N+l),I.push(N+M+l),I.push(N+t),I.push(N+t),I.push(N+M+l),I.push(N+M+t);for(let n=0;n<6;n++){const t=I.length-6;P.push(I[t+n]-Q)}}N+=M}const R=i[i.length-1];for(let t=0;t<c.length;t++)e(V,O,c[t][0]),e(G,q,c[t][1]),s(V,V,G),s(V,V,R),y[x++]=V[0],y[x++]=V[1],y[x++]=V[2];const T=z/3;A[z++]=U[0],A[z++]=U[1],A[z++]=U[2];const W=N-M;for(let t=0;t<p.length;t++)I.push(p[t][0]>=0?N+p[t][0]:-p[t][0]-1+W),I.push(p[t][2]>=0?N+p[t][2]:-p[t][2]-1+W),I.push(p[t][1]>=0?N+p[t][1]:-p[t][1]-1+W),P.push(T),P.push(T),P.push(T);const X=[["position",new D(y,I,3,!0)],["normal",new D(A,P,3,!0)]];return new C(n,X)}function yt(t,n,o,e,s){const r=g(3*n.length),l=new Array(2*(n.length-1));let h=0,u=0;for(let a=0;a<n.length;a++){for(let t=0;t<3;t++)r[h++]=n[a][t];a>0&&(l[u++]=a-1,l[u++]=a)}const i=[["position",new D(r,l,3,!0)]];if(o?.length===n.length&&3===o[0].length){const t=m(3*o.length);let e=0;for(let s=0;s<n.length;s++)for(let n=0;n<3;n++)t[e++]=o[s][n];i.push(["normal",new D(t,l,3,!0)])}if(e&&i.push(["color",new D(e,y(e.length/4),4)]),s?.length===n.length){const t=P(s,1);i.push(["timeStamps",new D(t,l,x,!0)])}return new C(t,i,null,2)}function At(t,n,o,e,s,r=0){const l=new Array(18),h=[[-o,r,s/2],[e,r,s/2],[0,n+r,s/2],[-o,r,-s/2],[e,r,-s/2],[0,n+r,-s/2]],u=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let i=0;i<6;i++)l[3*i]=h[i][0],l[3*i+1]=h[i][1],l[3*i+2]=h[i][2];return new C(t,[["position",new D(l,u,3,!0)]])}function bt(o,e){const s=o.getMutableAttribute("position").data;for(let r=0;r<s.length;r+=3){const o=s[r],l=s[r+1],h=s[r+2];t(Pt,o,l,h),n(Pt,Pt,e),s[r]=Pt[0],s[r+1]=Pt[1],s[r+2]=Pt[2]}}function jt(t,n=t){const o=t.attributes,e=o.get("position").data,s=o.get("normal").data;if(s){const t=n.getMutableAttribute("normal").data;for(let n=0;n<s.length;n+=3){const o=s[n+1];t[n+1]=-s[n+2],t[n+2]=o}}if(e){const t=n.getMutableAttribute("position").data;for(let n=0;n<e.length;n+=3){const o=e[n+1];t[n+1]=-e[n+2],t[n+2]=o}}}function dt(t,n,e,s,h){return!(Math.abs(r(n,t))>h)&&(l(e,t,n),o(e,e),l(s,e,t),o(s,s),!0)}function vt(t,n,o,e,s,r,l){return dt(t,n,s,r,l)||dt(t,o,s,r,l)||dt(t,e,s,r,l)}const It=.99619469809,Pt=f();export{jt as cgToGIS,J as createBoxGeometry,wt as createConeGeometry,ft as createConeGeometryData,gt as createCylinderGeometry,R as createDiamondGeometry,At as createExtrudedTriangle,Mt as createPathExtrusionGeometry,at as createPointGeometry,it as createPolySphereData,ut as createPolySphereGeometry,yt as createPolylineGeometry,ht as createSphereGeometry,pt as createSquareGeometry,lt as createTetrahedronGeometry,mt as createTubeGeometry,vt as makeOrthoBasisDirUpFallback,bt as transformInPlace};
2
+ import{set as t,transformMat4 as n,normalize as o,scale as e,add as s,dot as r,cross as l,subtract as h,copy as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as i,fromValues as a,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{clone as p,create as f,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as g}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as m,floatArrayFrom as M}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as y,getZeroIndexArray as A}from"../../../../geometry/support/Indices.js";import{create as b,fromPositionAndNormal as j,intersectRay as d}from"../../../../geometry/support/plane.js";import{wrap as v}from"../../../../geometry/support/ray.js";import{addOlidAttribute as I}from"../../layers/graphics/olidUtils.js";import{timeStampsToAttribute as P,numTimeStampValuesPerVertex as x}from"../../support/engineContent/line.js";import{Attribute as D}from"./Attribute.js";import{scale as z,length as S,normalize as U,add as q}from"./bufferVectorMath.js";import{Geometry as C}from"./Geometry.js";import{assert as F}from"./Util.js";import{getHUDMaterialBaseInstance as O}from"../materials/HUDMaterialBaseInstance.js";const V=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],B=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],G=[0,0,1,0,1,1,0,1],H=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],k=new Array(36);for(let xt=0;xt<6;xt++)for(let t=0;t<6;t++)k[6*xt+t]=xt;const E=new Array(36);for(let xt=0;xt<6;xt++)E[6*xt]=0,E[6*xt+1]=1,E[6*xt+2]=2,E[6*xt+3]=2,E[6*xt+4]=3,E[6*xt+5]=0;function J(t,n){Array.isArray(n)||(n=[n,n,n]);const o=new Array(24);for(let e=0;e<8;e++)o[3*e]=V[e][0]*n[0],o[3*e+1]=V[e][1]*n[1],o[3*e+2]=V[e][2]*n[2];return new C(t,[["position",new D(o,H,3,!0)],["normal",new D(B,k,3)],["uv0",new D(G,E,2)]])}const K=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],L=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],N=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],Q=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function R(t,n){Array.isArray(n)||(n=[n,n,n]);const o=new Array(18);for(let e=0;e<6;e++)o[3*e]=K[e][0]*n[0],o[3*e+1]=K[e][1]*n[1],o[3*e+2]=K[e][2]*n[2];return new C(t,[["position",new D(o,N,3,!0)],["normal",new D(L,Q,3)]])}const T=a(-.5,0,-.5),W=a(.5,0,-.5),X=a(0,0,.5),Y=a(0,.5,0),Z=c(),$=c(),_=c(),tt=c(),nt=c();h(Z,T,Y),h($,T,W),l(_,Z,$),o(_,_),h(Z,W,Y),h($,W,X),l(tt,Z,$),o(tt,tt),h(Z,X,Y),h($,X,T),l(nt,Z,$),o(nt,nt);const ot=[T,W,X,Y],et=[0,-1,0,_[0],_[1],_[2],tt[0],tt[1],tt[2],nt[0],nt[1],nt[2]],st=[0,1,2,3,1,0,3,2,1,3,0,2],rt=[0,0,0,1,1,1,2,2,2,3,3,3];function lt(t,n){Array.isArray(n)||(n=[n,n,n]);const o=new Array(12);for(let e=0;e<4;e++)o[3*e]=ot[e][0]*n[0],o[3*e+1]=ot[e][1]*n[1],o[3*e+2]=ot[e][2]*n[2];return new C(t,[["position",new D(o,st,3,!0)],["normal",new D(et,rt,3)]])}function ht(t,n,o,e,s={uv:!0}){const r=-Math.PI,l=2*Math.PI,h=-Math.PI/2,u=Math.PI,i=Math.max(3,Math.floor(o)),a=Math.max(2,Math.floor(e)),c=(i+1)*(a+1),p=m(3*c),f=m(3*c),w=m(2*c),g=[];let M=0;for(let m=0;m<=a;m++){const t=[],o=m/a,e=h+o*u,s=Math.cos(e);for(let h=0;h<=i;h++){const u=h/i,a=r+u*l,c=Math.cos(a)*s,g=Math.sin(e),m=-Math.sin(a)*s;p[3*M]=c*n,p[3*M+1]=g*n,p[3*M+2]=m*n,f[3*M]=c,f[3*M+1]=g,f[3*M+2]=m,w[2*M]=u,w[2*M+1]=o,t.push(M),++M}g.push(t)}const y=new Array;for(let m=0;m<a;m++)for(let t=0;t<i;t++){const n=g[m][t],o=g[m][t+1],e=g[m+1][t+1],s=g[m+1][t];0===m?(y.push(n),y.push(e),y.push(s)):m===a-1?(y.push(n),y.push(o),y.push(e)):(y.push(n),y.push(o),y.push(e),y.push(e),y.push(s),y.push(n))}const b=[["position",new D(p,y,3,!0)],["normal",new D(f,y,3,!0)]];return s.uv&&b.push(["uv0",new D(w,y,2,!0)]),s.offset&&(b[0][0]="offset",b.push(["position",new D(Float64Array.from(s.offset),A(y.length),3,!0)])),new C(t,b)}function ut(t,n,o,e){const s=it(n,o,e);return new C(t,s)}function it(t,n,o){const e=t;let s,r;if(o)s=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],r=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{const t=e*(1+Math.sqrt(5))/2;s=[-e,t,0,e,t,0,-e,-t,0,e,-t,0,0,-e,t,0,e,t,0,-e,-t,0,e,-t,t,0,-e,t,0,e,-t,0,-e,-t,0,e],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let i=0;i<s.length;i+=3)z(s,i,t/S(s,i));let l={};function h(n,o){n>o&&([n,o]=[o,n]);const e=n.toString()+"."+o.toString();if(l[e])return l[e];let r=s.length;return s.length+=3,q(s,3*n,s,3*o,s,r),z(s,r,t/S(s,r)),r/=3,l[e]=r,r}for(let i=0;i<n;i++){const t=r.length,n=new Array(4*t);for(let o=0;o<t;o+=3){const t=r[o],e=r[o+1],s=r[o+2],l=h(t,e),u=h(e,s),i=h(s,t),a=4*o;n[a]=t,n[a+1]=l,n[a+2]=i,n[a+3]=e,n[a+4]=u,n[a+5]=l,n[a+6]=s,n[a+7]=i,n[a+8]=u,n[a+9]=l,n[a+10]=u,n[a+11]=i}r=n,l={}}const u=M(s);for(let i=0;i<u.length;i+=3)U(u,i);return[["position",new D(M(s),r,3,!0)],["normal",new D(u,r,3,!0)]]}function at(t,{normal:n,position:o,color:e,rotation:s,size:r,centerOffset:l,groundDistance:h,uvi:u,featureAttribute:i,olidColor:a=null}={}){const c=o?p(o):f(),g=n?p(n):w(0,0,1),m=null!=h?[h]:[1],M=A(1),y=[["position",new D(c,M,3,!0)],["normal",new D(g,M,3,!0)]],b=null!=r&&2===r.length?r:null;if(b&&y.push(["size",new D(b,M,2)]),null!=s&&y.push(["rotation",new D([s],M,1,!0)]),e){const t=[e[0],e[1],e[2],e.length>3?e[3]:255];y.push(["color",new D(t,M,4,!0)])}if(u&&y.push(["uvi",new D(u,M,u.length)]),l&&y.push(["centerOffset",new D(l,M,3)]),y.push(["groundDistance",new D(m,M,1)]),i){const t=[i[0],i[1],i[2],i[3]];y.push(["featureAttribute",new D(t,M,4)])}return null!=a&&I(y,a,M),new C(t,y,null,void 0,O())}const ct=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function pt(t,n=ct){const o=new Array(12);for(let i=0;i<4;i++)for(let t=0;t<3;t++)o[3*i+t]=n[i][t];const e=[0,1,2,2,3,0],s=[0,0,1],r=[0,0,0,0,0,0],l=[0,0,1,0,1,1,0,1],h=[255,255,255,255],u=[["position",new D(o,e,3,!0)],["normal",new D(s,r,3,!0)],["uv0",new D(l,e,2,!0)],["color",new D(h,r,4,!0)]];return new C(t,u)}function ft(t,n,o,e,s=!0,r=!0){let l=0;const h=n,u=t;let i=a(0,l,0),c=a(0,l+u,0),p=a(0,-1,0),f=a(0,1,0);e&&(l=u,c=a(0,0,0),i=a(0,l,0),p=a(0,1,0),f=a(0,-1,0));const w=[c,i],g=[p,f],M=o+2,y=Math.sqrt(u*u+h*h);if(e)for(let m=o-1;m>=0;m--){const t=m*(2*Math.PI/o),n=a(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const e=a(u*Math.cos(t)/y,-h/y,u*Math.sin(t)/y);g.push(e)}else for(let m=0;m<o;m++){const t=m*(2*Math.PI/o),n=a(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const e=a(u*Math.cos(t)/y,h/y,u*Math.sin(t)/y);g.push(e)}const A=new Array,b=new Array;if(s){for(let t=3;t<w.length;t++)A.push(1),A.push(t-1),A.push(t),b.push(0),b.push(0),b.push(0);A.push(w.length-1),A.push(2),A.push(1),b.push(0),b.push(0),b.push(0)}if(r){for(let t=3;t<w.length;t++)A.push(t),A.push(t-1),A.push(0),b.push(t),b.push(t-1),b.push(1);A.push(0),A.push(2),A.push(w.length-1),b.push(1),b.push(2),b.push(g.length-1)}const j=m(3*M);for(let a=0;a<M;a++)j[3*a]=w[a][0],j[3*a+1]=w[a][1],j[3*a+2]=w[a][2];const d=m(3*M);for(let a=0;a<M;a++)d[3*a]=g[a][0],d[3*a+1]=g[a][1],d[3*a+2]=g[a][2];return[["position",new D(j,A,3,!0)],["normal",new D(d,b,3,!0)]]}function wt(t,n,o,e,s,r=!0,l=!0){return new C(t,ft(n,o,e,s,r,l))}function gt(n,h,u,p,f,w,g){const M=f?i(f):a(1,0,0),y=w?i(w):a(0,0,0);g??=!0;const A=c();o(A,M);const b=c();e(b,A,Math.abs(h));const j=c();e(j,b,-.5),s(j,j,y);const d=a(0,1,0);Math.abs(1-r(A,d))<.2&&t(d,0,0,1);const v=c();l(v,A,d),o(v,v),l(d,v,A);const I=2*p+(g?2:0),P=p+(g?2:0),x=m(3*I),z=m(3*P),S=m(2*I),U=new Array(3*p*(g?4:2)),q=new Array(3*p*(g?4:2));g&&(x[3*(I-2)]=j[0],x[3*(I-2)+1]=j[1],x[3*(I-2)+2]=j[2],S[2*(I-2)]=0,S[2*(I-2)+1]=0,x[3*(I-1)]=x[3*(I-2)]+b[0],x[3*(I-1)+1]=x[3*(I-2)+1]+b[1],x[3*(I-1)+2]=x[3*(I-2)+2]+b[2],S[2*(I-1)]=1,S[2*(I-1)+1]=1,z[3*(P-2)]=-A[0],z[3*(P-2)+1]=-A[1],z[3*(P-2)+2]=-A[2],z[3*(P-1)]=A[0],z[3*(P-1)+1]=A[1],z[3*(P-1)+2]=A[2]);const F=(t,n,o)=>{U[t]=n,q[t]=o};let O=0;const V=c(),B=c();for(let t=0;t<p;t++){const n=t*(2*Math.PI/p);e(V,d,Math.sin(n)),e(B,v,Math.cos(n)),s(V,V,B),z[3*t]=V[0],z[3*t+1]=V[1],z[3*t+2]=V[2],e(V,V,u),s(V,V,j),x[3*t]=V[0],x[3*t+1]=V[1],x[3*t+2]=V[2],S[2*t]=t/p,S[2*t+1]=0,x[3*(t+p)]=x[3*t]+b[0],x[3*(t+p)+1]=x[3*t+1]+b[1],x[3*(t+p)+2]=x[3*t+2]+b[2],S[2*(t+p)]=t/p,S[2*t+1]=1;const o=(t+1)%p;F(O++,t,t),F(O++,t+p,t),F(O++,o,o),F(O++,o,o),F(O++,t+p,t),F(O++,o+p,o)}if(g){for(let t=0;t<p;t++){const n=(t+1)%p;F(O++,I-2,P-2),F(O++,t,P-2),F(O++,n,P-2)}for(let t=0;t<p;t++){const n=(t+1)%p;F(O++,t+p,P-1),F(O++,I-1,P-1),F(O++,n+p,P-1)}}const G=[["position",new D(x,U,3,!0)],["normal",new D(z,q,3,!0)],["uv0",new D(S,U,2,!0)]];return new C(n,G)}function mt(t,n,o,e,s,r){e=e||10,s=null==s||s,F(n.length>1);const l=[[0,0,0]],h=[],u=[];for(let i=0;i<e;i++){h.push([0,-i-1,-(i+1)%e-1]);const t=i/e*2*Math.PI;u.push([Math.cos(t)*o,Math.sin(t)*o])}return Mt(t,u,n,l,h,s,r)}function Mt(n,r,i,c,p,w,g=a(0,0,0)){const M=r.length,y=m(i.length*M*3+(6*c.length||0)),A=m(i.length*M*3+(c?6:0)),I=new Array,P=new Array;let x=0,z=0;const S=f(),U=f(),q=f(),F=f(),O=f(),V=f(),B=f(),G=f(),H=f(),k=f(),E=f(),J=f(),K=f(),L=b();t(H,0,1,0),h(U,i[1],i[0]),o(U,U),w?(s(G,i[0],g),o(q,G)):t(q,0,0,1),vt(U,q,H,H,O,q,It),u(F,q),u(J,O);for(let t=0;t<c.length;t++)e(V,O,c[t][0]),e(G,q,c[t][2]),s(V,V,G),s(V,V,i[0]),y[x++]=V[0],y[x++]=V[1],y[x++]=V[2];A[z++]=-U[0],A[z++]=-U[1],A[z++]=-U[2];for(let t=0;t<p.length;t++)I.push(p[t][0]>0?p[t][0]:-p[t][0]-1+c.length),I.push(p[t][1]>0?p[t][1]:-p[t][1]-1+c.length),I.push(p[t][2]>0?p[t][2]:-p[t][2]-1+c.length),P.push(0),P.push(0),P.push(0);let N=c.length;const Q=c.length-1;for(let t=0;t<i.length;t++){let n=!1;if(t>0){u(S,U),t<i.length-1?(h(U,i[t+1],i[t]),o(U,U)):n=!0,s(k,S,U),o(k,k),s(E,i[t-1],F),j(i[t],k,L);d(L,v(E,S),G)?(h(G,G,i[t]),o(q,G),l(O,k,q),o(O,O)):vt(k,F,J,H,O,q,It),u(F,q),u(J,O)}w&&(s(G,i[t],g),o(K,G));for(let l=0;l<M;l++)if(e(V,O,r[l][0]),e(G,q,r[l][1]),s(V,V,G),o(B,V),A[z++]=B[0],A[z++]=B[1],A[z++]=B[2],s(V,V,i[t]),y[x++]=V[0],y[x++]=V[1],y[x++]=V[2],!n){const t=(l+1)%M;I.push(N+l),I.push(N+M+l),I.push(N+t),I.push(N+t),I.push(N+M+l),I.push(N+M+t);for(let n=0;n<6;n++){const t=I.length-6;P.push(I[t+n]-Q)}}N+=M}const R=i[i.length-1];for(let t=0;t<c.length;t++)e(V,O,c[t][0]),e(G,q,c[t][1]),s(V,V,G),s(V,V,R),y[x++]=V[0],y[x++]=V[1],y[x++]=V[2];const T=z/3;A[z++]=U[0],A[z++]=U[1],A[z++]=U[2];const W=N-M;for(let t=0;t<p.length;t++)I.push(p[t][0]>=0?N+p[t][0]:-p[t][0]-1+W),I.push(p[t][2]>=0?N+p[t][2]:-p[t][2]-1+W),I.push(p[t][1]>=0?N+p[t][1]:-p[t][1]-1+W),P.push(T),P.push(T),P.push(T);const X=[["position",new D(y,I,3,!0)],["normal",new D(A,P,3,!0)]];return new C(n,X)}function yt(t,n,o,e,s){const r=g(3*n.length),l=new Array(2*(n.length-1));let h=0,u=0;for(let a=0;a<n.length;a++){for(let t=0;t<3;t++)r[h++]=n[a][t];a>0&&(l[u++]=a-1,l[u++]=a)}const i=[["position",new D(r,l,3,!0)]];if(o?.length===n.length&&3===o[0].length){const t=m(3*o.length);let e=0;for(let s=0;s<n.length;s++)for(let n=0;n<3;n++)t[e++]=o[s][n];i.push(["normal",new D(t,l,3,!0)])}if(e&&i.push(["color",new D(e,y(e.length/4),4)]),s?.length===n.length){const t=P(s,1);i.push(["timeStamps",new D(t,l,x,!0)])}return new C(t,i,null)}function At(t,n,o,e,s,r=0){const l=new Array(18),h=[[-o,r,s/2],[e,r,s/2],[0,n+r,s/2],[-o,r,-s/2],[e,r,-s/2],[0,n+r,-s/2]],u=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let i=0;i<6;i++)l[3*i]=h[i][0],l[3*i+1]=h[i][1],l[3*i+2]=h[i][2];return new C(t,[["position",new D(l,u,3,!0)]])}function bt(o,e){const s=o.getMutableAttribute("position").data;for(let r=0;r<s.length;r+=3){const o=s[r],l=s[r+1],h=s[r+2];t(Pt,o,l,h),n(Pt,Pt,e),s[r]=Pt[0],s[r+1]=Pt[1],s[r+2]=Pt[2]}}function jt(t,n=t){const o=t.attributes,e=o.get("position").data,s=o.get("normal").data;if(s){const t=n.getMutableAttribute("normal").data;for(let n=0;n<s.length;n+=3){const o=s[n+1];t[n+1]=-s[n+2],t[n+2]=o}}if(e){const t=n.getMutableAttribute("position").data;for(let n=0;n<e.length;n+=3){const o=e[n+1];t[n+1]=-e[n+2],t[n+2]=o}}}function dt(t,n,e,s,h){return!(Math.abs(r(n,t))>h)&&(l(e,t,n),o(e,e),l(s,e,t),o(s,s),!0)}function vt(t,n,o,e,s,r,l){return dt(t,n,s,r,l)||dt(t,o,s,r,l)||dt(t,e,s,r,l)}const It=.99619469809,Pt=f();export{jt as cgToGIS,J as createBoxGeometry,wt as createConeGeometry,ft as createConeGeometryData,gt as createCylinderGeometry,R as createDiamondGeometry,At as createExtrudedTriangle,Mt as createPathExtrusionGeometry,at as createPointGeometry,it as createPolySphereData,ut as createPolySphereGeometry,yt as createPolylineGeometry,ht as createSphereGeometry,pt as createSquareGeometry,lt as createTetrahedronGeometry,mt as createTubeGeometry,vt as makeOrthoBasisDirUpFallback,bt as transformInPlace};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../core/has.js";import{generateUID as i}from"../../../../core/uid.js";import{getMetersPerUnitForSR as t}from"../../../../core/units.js";import{subtract as r,distance as s}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 o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as n}from"../../../../geometry/projection/projectBuffer.js";import{Attribute as a}from"./Attribute.js";import{Geometry as h}from"./Geometry.js";import{fromValues as c}from"./LocalOriginFactory.js";import{Object3D as g}from"./Object3D.js";import{gridLocalOriginFactory as m}from"./testUtils.js";import{WebGLLayer as _}from"./WebGLLayer.js";import{RibbonLineMaterial as l}from"../materials/RibbonLineMaterial.js";class f{constructor(r){this._originSR=r,this._rootOriginId="root/"+i(),this._origins=new Map,this._objects=new Map,this._gridSize=5e5,this._originSR?.isGeographic&&(this._gridSize/=t(this._originSR)),this._baselineDistance=.5*this._gridSize;const s=this._baselineDistance*d;this._baselineObjectSize=s/p}getOrigin(i){const t=this._origins.get(this._rootOriginId);if(null==t){const t=m.rootOrigin;if(null!=t)return this._origins.set(this._rootOriginId,c(t[0],t[1],t[2],this._rootOriginId)),this.getOrigin(i);const r=c(i[0],i[1],i[2],this._rootOriginId);return this._origins.set(this._rootOriginId,r),r}const s=this._gridSize,e=Math.round(i[0]/s),o=Math.round(i[1]/s),n=Math.round(i[2]/s),a=`${e}/${o}/${n}`;let h=this._origins.get(a);const g=.5*s;if(r(b,i,t.vec3),b[0]=Math.abs(b[0]),b[1]=Math.abs(b[1]),b[2]=Math.abs(b[2]),b[0]<g&&b[1]<g&&b[2]<g){if(h){const t=Math.max(...b);r(b,i,h.vec3),b[0]=Math.abs(b[0]),b[1]=Math.abs(b[1]),b[2]=Math.abs(b[2]);if(Math.max(...b)<t)return h}return t}return h||(h=c(e*s,o*s,n*s,a),this._origins.set(a,h)),h}needsOriginUpdate(i,t,r){const e=s(i.vec3,t),o=Math.max(1,r/this._baselineObjectSize);return e>this._baselineDistance*o}_drawOriginBox(i,t=o(1,1,0,1)){const r=window.view,s=r.stage,e=t.toString();if(!this._objects.has(e)){this._material=new l({width:2,color:t},!1);const i=new _(s,{pickable:!1}),r=new g({castShadow:!1});i.add(r),this._objects.set(e,r)}const c=this._objects.get(e),m=[0,1,5,4,0,2,1,7,6,2,0,1,3,7,5,4,6,2,0],f=m.length,b=new Array(3*f),d=new Array,p=.5*this._gridSize;for(let o=0;o<f;o++)b[3*o]=i[0]+(1&m[o]?p:-p),b[3*o+1]=i[1]+(2&m[o]?p:-p),b[3*o+2]=i[2]+(4&m[o]?p:-p),o>0&&d.push(o-1,o);n(b,this._originSR,0,b,r.renderSpatialReference,0,f);const j=new h(this._material,[["position",new a(b,d,3,!0)]],null,2);c.addGeometry(j)}get test(){}}const b=e(),d=2**-23,p=.05;export{f as GridLocalOriginFactory};
2
+ import"../../../../core/has.js";import{generateUID as i}from"../../../../core/uid.js";import{getMetersPerUnitForSR as t}from"../../../../core/units.js";import{subtract as r,distance as s}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 o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as n}from"../../../../geometry/projection/projectBuffer.js";import{Attribute as a}from"./Attribute.js";import{Geometry as h}from"./Geometry.js";import{fromValues as c}from"./LocalOriginFactory.js";import{Object3D as g}from"./Object3D.js";import{gridLocalOriginFactory as m}from"./testUtils.js";import{WebGLLayer as _}from"./WebGLLayer.js";import{RibbonLineMaterial as l}from"../materials/RibbonLineMaterial.js";class f{constructor(r){this._originSR=r,this._rootOriginId="root/"+i(),this._origins=new Map,this._objects=new Map,this._gridSize=5e5,this._originSR?.isGeographic&&(this._gridSize/=t(this._originSR)),this._baselineDistance=.5*this._gridSize;const s=this._baselineDistance*d;this._baselineObjectSize=s/p}getOrigin(i){const t=this._origins.get(this._rootOriginId);if(null==t){const t=m.rootOrigin;if(null!=t)return this._origins.set(this._rootOriginId,c(t[0],t[1],t[2],this._rootOriginId)),this.getOrigin(i);const r=c(i[0],i[1],i[2],this._rootOriginId);return this._origins.set(this._rootOriginId,r),r}const s=this._gridSize,e=Math.round(i[0]/s),o=Math.round(i[1]/s),n=Math.round(i[2]/s),a=`${e}/${o}/${n}`;let h=this._origins.get(a);const g=.5*s;if(r(b,i,t.vec3),b[0]=Math.abs(b[0]),b[1]=Math.abs(b[1]),b[2]=Math.abs(b[2]),b[0]<g&&b[1]<g&&b[2]<g){if(h){const t=Math.max(...b);r(b,i,h.vec3),b[0]=Math.abs(b[0]),b[1]=Math.abs(b[1]),b[2]=Math.abs(b[2]);if(Math.max(...b)<t)return h}return t}return h||(h=c(e*s,o*s,n*s,a),this._origins.set(a,h)),h}needsOriginUpdate(i,t,r){const e=s(i.vec3,t),o=Math.max(1,r/this._baselineObjectSize);return e>this._baselineDistance*o}_drawOriginBox(i,t=o(1,1,0,1)){const r=window.view,s=r.stage,e=t.toString();if(!this._objects.has(e)){this._material=new l({width:2,color:t},!1);const i=new _(s,{pickable:!1}),r=new g({castShadow:!1});i.add(r),this._objects.set(e,r)}const c=this._objects.get(e),m=[0,1,5,4,0,2,1,7,6,2,0,1,3,7,5,4,6,2,0],f=m.length,b=new Array(3*f),d=new Array,p=.5*this._gridSize;for(let o=0;o<f;o++)b[3*o]=i[0]+(1&m[o]?p:-p),b[3*o+1]=i[1]+(2&m[o]?p:-p),b[3*o+2]=i[2]+(4&m[o]?p:-p),o>0&&d.push(o-1,o);n(b,this._originSR,0,b,r.renderSpatialReference,0,f);const j=new h(this._material,[["position",new a(b,d,3,!0)]],null);c.addGeometry(j)}get test(){}}const b=e(),d=2**-23,p=.05;export{f as GridLocalOriginFactory};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{generateUID as r}from"../../../../core/uid.js";import{isColor as t}from"../core/shaderLibrary/ShaderOutput.js";import{updateParameters as e}from"../materials/internal/MaterialUtil.js";import{NoParameters as i}from"../../../webgl/NoParameters.js";class s{constructor(t,i){this.id=r(),this.supportsEdges=!1,this._renderPriority=0,this._parameters=new i,e(this._parameters,t),this.validateParameters(this._parameters)}get useIndexing(){return this.parameters.useIndexing??!1}get parameters(){return this._parameters}update(r){return!1}setParameters(r,t=!0){e(this._parameters,r)&&(this.validateParameters(this._parameters),t&&this._parametersChanged())}validateParameters(r){}shouldRender(r){return this.visible&&this.isVisibleForOutput(r.output)&&(!this.parameters.isDecoration||r.bind.decorations)&&0!==(this.parameters.renderOccluded&r.renderOccludedMask)}isVisibleForOutput(r){return!0}get renderPriority(){return this._renderPriority}set renderPriority(r){r!==this._renderPriority&&(this._renderPriority=r,this._parametersChanged())}_parametersChanged(){this.repository?.materialChanged(this)}get renderOccludedFlags(){return this.visible?this.parameters.renderOccluded:0}get testsTransparentRenderOrder(){return this.parameters.testsTransparentRenderOrder}get emissions(){return 0}getConfiguration(r){return this.updateConfiguration(r),this._configuration}updateConfiguration(r){this._configuration.output=r.output,this._configuration.hasEmission=r.hasEmission&&t(r.output),this._configuration.hasHighlightMixTexture=10===r.output&&null!=r.highlightMixTexture,this._configuration.useFloatBlend=r.useFloatBlend.value,this._configuration.emissionDimmingPass=r.transparentWithoutDepthEmissionDimmingPass&&t(r.output)}}class a extends i{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1}}export{s as Material,a as MaterialParameters};
2
+ import{generateUID as e}from"../../../../core/uid.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import{updateParameters as t}from"../materials/internal/MaterialUtil.js";import{NoParameters as i}from"../../../webgl/NoParameters.js";class s{constructor(r,i){this.id=e(),this.supportsEdges=!1,this.geometryType=0,this._renderPriority=0,this._parameters=new i,t(this._parameters,r),this.validateParameters(this._parameters)}get useIndexing(){return this.parameters.useIndexing??!1}get parameters(){return this._parameters}update(e){return!1}setParameters(e,r=!0){t(this._parameters,e)&&(this.validateParameters(this._parameters),r&&this._parametersChanged())}validateParameters(e){}shouldRender(e){return this.visible&&this.isVisibleForOutput(e.output)&&(!this.parameters.isDecoration||e.bind.decorations)&&0!==(this.parameters.renderOccluded&e.renderOccludedMask)}isVisibleForOutput(e){return!0}get renderPriority(){return this._renderPriority}set renderPriority(e){e!==this._renderPriority&&(this._renderPriority=e,this._parametersChanged())}_parametersChanged(){this.repository?.materialChanged(this)}get renderOccludedFlags(){return this.visible?this.parameters.renderOccluded:0}get testsTransparentRenderOrder(){return this.parameters.testsTransparentRenderOrder}get emissions(){return 0}getConfiguration(e){return this.updateConfiguration(e),this._configuration}updateConfiguration(e){this._configuration.output=e.output,this._configuration.hasEmission=e.hasEmission&&r(e.output),this._configuration.hasHighlightMixTexture=10===e.output&&null!=e.highlightMixTexture,this._configuration.useFloatBlend=e.useFloatBlend.value,this._configuration.emissionDimmingPass=e.transparentWithoutDepthEmissionDimmingPass&&r(e.output)}}class a extends i{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1}}export{s as Material,a as MaterialParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as t}from"../../../../core/mathUtils.js";import{set as i,copy as e,exactEquals as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as o,clone as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{newFloatArray as a}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as n,getZeroIndexArray as l}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as u}from"../../layers/graphics/olidUtils.js";import{Attribute as h}from"./Attribute.js";import{Geometry as p}from"./Geometry.js";import{getPathVertexFrameIndex as c}from"./PathVertexInfo.js";import{createPositionReader as m}from"./PositionReader.js";class f extends p{constructor(t,i,e,s){const{vertexIndices:r,framePositionIndices:a,numExtrusionFrames:p}=i,c=n(p),m=l(p),f=[["position",new h(i.positions,a,3,!0)],["profileRight",new h(i.profileRightAxes,c,2,!0)],["profileUp",new h(i.profileUpAxes,c,2,!0)],["profileRotation",new h(i.profileRotations,c,1,!0)],["pathMaxStretchDistance",new h(i.pathMaxStretchDistances,c,1,!0)],["pathVertexInfo",new h(i.pathVertexInfos,r,1,!0)]];i.profileRotationFrameUpAxes&&f.push(["pathRotationUp",new h(i.profileRotationFrameUpAxes,c,2,!0)]),null!=e.sizeAttributeValue&&f.push(["sizeFeatureAttribute",new h([e.sizeAttributeValue],m,1,!0)]),null!=e.size&&f.push(["size",new h([...e.size],m,2,!0)]),null!=e.colorAttributeValue&&f.push(["colorFeatureAttribute",new h([e.colorAttributeValue],m,1,!0)]),null!=e.color&&f.push(["color",new h([...e.color],m,4,!0)]),null!=e.opacityAttributeValue&&f.push(["opacityFeatureAttribute",new h([e.opacityAttributeValue],m,1,!0)]),null!=e.opacity&&f.push(["opacity",new h([e.opacity],m,1,!0)]),null!=s&&u(f,s,m),super(t,f,null,0,0),this.builder=i,this.visualVariablesState=e,this._lastSize=o()}get indexCount(){return this.attributes.get("pathVertexInfo")?.indices.length??0}get readPrimitivePosition(){if(this._invalidateOnSizeChange(),null==this._readPrimitivePosition){const{builder:t,size:i}=this,{vertexIndices:e,numVerticesTotal:s,evaluator:o}=t,r=a(3*s);for(let a=0;a<s;++a)o.evaluateVertexPosition(r,i,a,a);this._readPrimitivePosition=m(r,e,3)}return this._readPrimitivePosition}onPathChanged(){this.builder.onPathChanged(),this.invalidateBoundingInfo(),i(this._lastSize,-1,-1),this._invalidateReadPrimitivePosition()}get size(){const{parameters:i}=this.material,s=r(i.size);if(i.vvSize){const{offset:e,factor:o,minSize:r,maxSize:a,fallback:n}=i.vvSize,l=this.visualVariablesState.sizeAttributeValue??NaN;Number.isNaN(l)?(s[0]*=n[0],s[1]*=n[2]):(s[0]*=t(e[0]+l*o[0],r[0],a[0]),s[1]*=t(e[2]+l*o[2],r[2],a[2]))}else i.hasPathSize&&this.visualVariablesState.size&&e(s,this.visualVariablesState.size);return s}_computePrimitivePositionIndices(){const t=this.attributes.get("pathVertexInfo"),i=this.attributes.get("position");if(t&&i){const e=i.indices,s=t.indices,o=t.data;return s.map(i=>e[c(o[t.stride*i])])}return i?.indices??null}get boundingInfo(){return this._invalidateOnSizeChange(),super.boundingInfo}_invalidateOnSizeChange(){const{size:t}=this;s(t,this._lastSize)||(e(this._lastSize,t),this.invalidateBoundingInfo(),this._invalidateReadPrimitivePosition())}}function d(t){return t instanceof f}export{f as PathGeometry,d as isPathGeometry};
2
+ import{clamp as t}from"../../../../core/mathUtils.js";import{set as i,copy as e,exactEquals as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as o,clone as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{newFloatArray as a}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as n,getZeroIndexArray as l}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as u}from"../../layers/graphics/olidUtils.js";import{Attribute as h}from"./Attribute.js";import{Geometry as p}from"./Geometry.js";import{getPathVertexFrameIndex as c}from"./PathVertexInfo.js";import{createPositionReader as m}from"./PositionReader.js";class f extends p{constructor(t,i,e,s){const{vertexIndices:r,framePositionIndices:a,numExtrusionFrames:p}=i,c=n(p),m=l(p),f=[["position",new h(i.positions,a,3,!0)],["profileRight",new h(i.profileRightAxes,c,2,!0)],["profileUp",new h(i.profileUpAxes,c,2,!0)],["profileRotation",new h(i.profileRotations,c,1,!0)],["pathMaxStretchDistance",new h(i.pathMaxStretchDistances,c,1,!0)],["pathVertexInfo",new h(i.pathVertexInfos,r,1,!0)]];i.profileRotationFrameUpAxes&&f.push(["pathRotationUp",new h(i.profileRotationFrameUpAxes,c,2,!0)]),null!=e.sizeAttributeValue&&f.push(["sizeFeatureAttribute",new h([e.sizeAttributeValue],m,1,!0)]),null!=e.size&&f.push(["size",new h([...e.size],m,2,!0)]),null!=e.colorAttributeValue&&f.push(["colorFeatureAttribute",new h([e.colorAttributeValue],m,1,!0)]),null!=e.color&&f.push(["color",new h([...e.color],m,4,!0)]),null!=e.opacityAttributeValue&&f.push(["opacityFeatureAttribute",new h([e.opacityAttributeValue],m,1,!0)]),null!=e.opacity&&f.push(["opacity",new h([e.opacity],m,1,!0)]),null!=s&&u(f,s,m),super(t,f,null,0),this.builder=i,this.visualVariablesState=e,this._lastSize=o()}get indexCount(){return this.attributes.get("pathVertexInfo")?.indices.length??0}get readPrimitivePosition(){if(this._invalidateOnSizeChange(),null==this._readPrimitivePosition){const{builder:t,size:i}=this,{vertexIndices:e,numVerticesTotal:s,evaluator:o}=t,r=a(3*s);for(let a=0;a<s;++a)o.evaluateVertexPosition(r,i,a,a);this._readPrimitivePosition=m(r,e,3)}return this._readPrimitivePosition}onPathChanged(){this.builder.onPathChanged(),this.invalidateBoundingInfo(),i(this._lastSize,-1,-1),this._invalidateReadPrimitivePosition()}get size(){const{parameters:i}=this.material,s=r(i.size);if(i.vvSize){const{offset:e,factor:o,minSize:r,maxSize:a,fallback:n}=i.vvSize,l=this.visualVariablesState.sizeAttributeValue??NaN;Number.isNaN(l)?(s[0]*=n[0],s[1]*=n[2]):(s[0]*=t(e[0]+l*o[0],r[0],a[0]),s[1]*=t(e[2]+l*o[2],r[2],a[2]))}else i.hasPathSize&&this.visualVariablesState.size&&e(s,this.visualVariablesState.size);return s}_computePrimitivePositionIndices(){const t=this.attributes.get("pathVertexInfo"),i=this.attributes.get("position");if(t&&i){const e=i.indices,s=t.indices,o=t.data;return s.map(i=>e[c(o[t.stride*i])])}return i?.indices??null}get boundingInfo(){return this._invalidateOnSizeChange(),super.boundingInfo}_invalidateOnSizeChange(){const{size:t}=this;s(t,this._lastSize)||(e(this._lastSize,t),this.invalidateBoundingInfo(),this._invalidateReadPrimitivePosition())}}function d(t){return t instanceof f}export{f as PathGeometry,d as isPathGeometry};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
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 r}from"../../../../geometry/support/aaBoundingBox.js";import{boundingInfoSubdivisionThreshold as s}from"./intersectionConstants.js";import{assert as f}from"./Util.js";class u{constructor(n=0,t=!1,o=!0){this.tolerance=n,this.isVerticalRay=t,this.normalRequired=o}}const a=r();function l(t,o,i,c,e,r){if(!t.visible)return;const s=n(D,c,i),{tolerance:a}=o,l=new u(a,!1,o.options.normalRequired);if(t.boundingInfo)f(0===t.type),p(t.readPrimitivePosition,t.boundingInfo,i,s,a,e,l,r);else{const n=t.readPrimitivePosition;q(i,s,0,t.faceCount,n,e,l,r)}}const m=c();function p(n,t,o,i,c,r,f,u){if(null==t)return;const l=w(i,m);if(e(a,t.box),null!=r&&r.applyToAabb(a),A(a,o,l,c)){const{primitiveIndices:e}=t,a=e.length;if(a>s){const e=t.children;if(void 0!==e){for(const t of e)p(n,t,o,i,c,r,f,u);return}}v(o,i,0,a,n,e,r,f,u)}}const h=c();function x(t,o,i,c,e,r,s,f){q(t,n(D,o,t),i,c,e,r,s,f)}function M(n,t,o,i){if(!o.visible)return;const{boundingInfo:c}=o;if(c){const{box:o}=c;if(n<o[0]||n>o[3]||t<o[1]||t>o[4])return}b(n,t,0,o.faceCount,o.readPrimitivePosition,i)}function b(n,t,o,i,c,e){for(let r=o;r<i;++r){const o=3*r,[i,s]=c(G,o),[f,u]=c(G,o+1),[a,l]=c(G,o+2),m=i-n,p=s-t,h=f-n,x=u-t,M=a-n,b=l-t,d=M*x-b*h,y=m*b-p*M,g=h*p-x*m;(d<0||y<0||g<0)&&(d>0||y>0||g>0)||e(0,0,null,r)}}function d(n,t,o,i,c,e,r,s,f,u=null,a=0){const l=n[0],m=n[1],p=n[2],x=t[0],M=t[1],b=t[2];for(let d=o;d<i;++d){const n=a+(u?.[d]??d),t=3*n,o=r*c[t],i=e[o],y=e[o+1],g=e[o+2],v=r*c[t+1],q=e[v],T=e[v+1],V=e[v+2],P=r*c[t+2],R=q-i,I=T-y,C=V-g,B=e[P]-i,w=e[P+1]-y,A=e[P+2]-g,U=M*A-w*b,k=b*B-A*x,D=x*w-B*M,E=R*U+I*k+C*D,F=E*E;if(F<=z)continue;const G=l-i,H=m-y,J=p-g,K=(G*U+H*k+J*D)*E;if(K<0||K>F)continue;const L=H*C-I*J,N=J*R-C*G,O=G*I-R*H,Q=(x*L+M*N+b*O)*E;if(Q<0||K+Q>F)continue;const S=(B*L+w*N+A*O)/E;if(S>=0){f(S,S,s?j(R,I,C,B,w,A,h):null,n)}}}function y(n,t,o,i,c,e,r,s){const f=n[0],u=n[1],a=n[2],l=t[0],m=t[1],p=t[2];for(let x=o;x<i;++x){const n=3*x,t=n+1,o=n+2,i=e*n,M=c[i],b=c[i+1],d=c[i+2],y=e*t,g=e*o,v=c[y]-M,q=c[y+1]-b,T=c[y+2]-d,V=c[g]-M,P=c[g+1]-b,R=c[g+2]-d,I=m*R-P*p,C=p*V-R*l,B=l*P-V*m,w=v*I+q*C+T*B,A=w*w;if(A<=z)continue;const U=f-M,k=u-b,D=a-d,E=(U*I+k*C+D*B)*w;if(E<0||E>A)continue;const F=k*T-q*D,G=D*v-T*U,H=U*q-v*k,J=(l*F+m*G+p*H)*w;if(J<0||E+J>A)continue;const K=(V*F+P*G+R*H)/w;if(K>=0){s(K,K,r?j(v,q,T,V,P,R,h):null,x)}}}function g(n,t,o,i,c,e,r,s,f,u,a,l=null,m=0){const p=n[0],x=n[1],M=n[2],b=t[0],d=t[1],y=t[2];for(let g=o;g<i;++g){const n=m+(l?.[g]??g),t=3*n,o=r*c[t],i=e[o],v=e[o+1],q=e[o+2],T=r*c[t+1],V=e[T],P=e[T+1],R=e[T+2],I=r*c[t+2],C=e[I],B=e[I+1],w=e[I+2],A=q-f,U=s/Math.sqrt(i*i+v*v+A*A),k=i+i*U,D=v+v*U,E=q+A*U,F=R-f,G=s/Math.sqrt(V*V+P*P+F*F),H=V+V*G,J=P+P*G,K=R+F*G,L=w-f,N=s/Math.sqrt(C*C+B*B+L*L),O=H-k,Q=J-D,S=K-E,W=C+C*N-k,X=B+B*N-D,Y=w+L*N-E,Z=d*Y-X*y,$=y*W-Y*b,_=b*X-W*d,nn=O*Z+Q*$+S*_,tn=nn*nn;if(tn<=z)continue;const on=p-k,cn=x-D,en=M-E,rn=(on*Z+cn*$+en*_)*nn;if(rn<0||rn>tn)continue;const sn=cn*S-Q*en,fn=en*O-S*on,un=on*Q-O*cn,an=(b*sn+d*fn+y*un)*nn;if(an<0||rn+an>tn)continue;const ln=(W*sn+X*fn+Y*un)/nn;if(ln>=0){a(ln,ln,u?j(O,Q,S,W,X,Y,h):null,n)}}}function v(n,t,o,i,c,e,r,s,f){const u=n[0],a=n[1],l=n[2],m=t[0],p=t[1],x=t[2],{normalRequired:M}=s;for(let b=o;b<i;++b){const n=e[b],t=3*n;let[o,i,s]=c(G,t),[d,y,g]=c(G,t+1),[v,q,T]=c(G,t+2);null!=r&&([o,i,s]=r.applyToVertex(F,o,i,s,b),[d,y,g]=r.applyToVertex(F,d,y,g,b),[v,q,T]=r.applyToVertex(F,v,q,T,b));const V=d-o,P=y-i,R=g-s,I=v-o,C=q-i,B=T-s,w=p*B-C*x,A=x*I-B*m,U=m*C-I*p,k=V*w+P*A+R*U,D=k*k;if(D<=z)continue;const E=u-o,H=a-i,J=l-s,K=(E*w+H*A+J*U)*k;if(K<0||K>D)continue;const L=H*R-P*J,N=J*V-R*E,O=E*P-V*H,Q=(m*L+p*N+x*O)*k;if(Q<0||K+Q>D)continue;const S=(I*L+C*N+B*O)/k;if(S>=0){f(S,S,M?j(V,P,R,I,C,B,h):null,n)}}}function q(t,o,i,c,e,r,s,f){const u=o,a=E,l=Math.abs(u[0]),m=Math.abs(u[1]),p=Math.abs(u[2]),h=l>=m?l>=p?0:2:m>=p?1:2,x=h,M=u[x]<0?2:1,b=(h+M)%3,d=(h+(3-M))%3,y=u[b]/u[x],g=u[d]/u[x],v=1/u[x],q=T,j=V,I=P,{normalRequired:C}=s;for(let T=i;T<c;++T){const o=3*T;e(a[0],o),e(a[1],o+1),e(a[2],o+2),r&&(r.applyToVertex(a[0],a[0][0],a[0][1],a[0][2],T),r.applyToVertex(a[1],a[1][0],a[1][1],a[1][2],T),r.applyToVertex(a[2],a[2][0],a[2][1],a[2][2],T)),n(q,a[0],t),n(j,a[1],t),n(I,a[2],t);const i=q[b]-y*q[x],c=q[d]-g*q[x],s=j[b]-y*j[x],u=j[d]-g*j[x],l=I[b]-y*I[x],m=I[d]-g*I[x],p=l*u-m*s,h=i*m-c*l,M=s*c-u*i;if((p<0||h<0||M<0)&&(p>0||h>0||M>0))continue;const V=p+h+M;if(0===V)continue;const P=p*(v*q[x])+h*(v*j[x])+M*(v*I[x]);if(P*Math.sign(V)<0)continue;const B=P/V;if(B>=0){f(B,B,C?R(a):null,T)}}}const T=c(),V=c(),P=c();function j(n,c,e,r,s,f,u){return t(I,n,c,e),t(C,r,s,f),o(u,I,C),i(u,u),u}function R(t){return n(I,t[1],t[0]),n(C,t[2],t[0]),o(h,I,C),i(h,h),h}const I=c(),C=c();function B(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 A(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],r=(n[3]+i-t[0])*o[0];let s=Math.min(e,r),f=Math.max(e,r);const u=(n[1]-i-t[1])*o[1],a=(n[4]+i-t[1])*o[1];if(f=Math.min(f,Math.max(u,a)),f<0)return!1;if(s=Math.max(s,Math.min(u,a)),s>f)return!1;const l=(n[2]-i-t[2])*o[2],m=(n[5]+i-t[2])*o[2];return f=Math.min(f,Math.max(l,m)),!(f<0)&&(s=Math.max(s,Math.min(l,m)),!(s>f)&&s<c)}const k=1e-7,z=k*k,D=c(),E=[c(),c(),c()],F=c(),G=c();export{u as MeshIntersectionOptions,B as computeInvDir,A as intersectAabbInvDir,U as intersectAabbInvDirBefore,d as intersectRayTriangles,q as intersectRayTrianglesWithDisplacementWatertight,g as intersectRayTrianglesWithVerticalOffsetENUGlobal,y as intersectRenderGeometryTriangles,l as intersectTriangleGeometry,M as intersectTriangleGeometry2D,x as intersectTriangles,b as intersectTriangles2d,k 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 r}from"../../../../geometry/support/aaBoundingBox.js";import{boundingInfoSubdivisionThreshold as s}from"./intersectionConstants.js";class u{constructor(n=0,t=!1,o=!0){this.tolerance=n,this.isVerticalRay=t,this.normalRequired=o}}const f=r();function a(t,o,i,c,e,r){if(!t.visible)return;const s=n(D,c,i),{tolerance:f}=o,a=new u(f,!1,o.options.normalRequired);if(t.boundingInfo)m(t.readPrimitivePosition,t.boundingInfo,i,s,f,e,a,r);else{const n=t.readPrimitivePosition;y(i,s,0,t.faceCount,n,e,a,r)}}const l=c();function m(n,t,o,i,c,r,u,a){if(null==t)return;const h=B(i,l);if(e(f,t.box),null!=r&&r.applyToAabb(f),w(f,o,h,c)){const{primitiveIndices:e}=t,f=e.length;if(f>s){const e=t.children;if(void 0!==e){for(const t of e)m(n,t,o,i,c,r,u,a);return}}v(o,i,0,f,n,e,r,u,a)}}const h=c();function p(t,o,i,c,e,r,s,u){y(t,n(D,o,t),i,c,e,r,s,u)}function x(n,t,o,i){if(!o.visible)return;const{boundingInfo:c}=o;if(c){const{box:o}=c;if(n<o[0]||n>o[3]||t<o[1]||t>o[4])return}M(n,t,0,o.faceCount,o.readPrimitivePosition,i)}function M(n,t,o,i,c,e){for(let r=o;r<i;++r){const o=3*r,[i,s]=c(G,o),[u,f]=c(G,o+1),[a,l]=c(G,o+2),m=i-n,h=s-t,p=u-n,x=f-t,M=a-n,b=l-t,d=M*x-b*p,g=m*b-h*M,v=p*h-x*m;(d<0||g<0||v<0)&&(d>0||g>0||v>0)||e(0,0,null,r)}}function b(n,t,o,i,c,e,r,s,u,f=null,a=0){const l=n[0],m=n[1],p=n[2],x=t[0],M=t[1],b=t[2];for(let d=o;d<i;++d){const n=a+(f?.[d]??d),t=3*n,o=r*c[t],i=e[o],g=e[o+1],v=e[o+2],y=r*c[t+1],q=e[y],T=e[y+1],V=e[y+2],R=r*c[t+2],j=q-i,I=T-g,C=V-v,B=e[R]-i,w=e[R+1]-g,A=e[R+2]-v,k=M*A-w*b,D=b*B-A*x,E=x*w-B*M,F=j*k+I*D+C*E,G=F*F;if(G<=z)continue;const H=l-i,J=m-g,K=p-v,L=(H*k+J*D+K*E)*F;if(L<0||L>G)continue;const N=J*C-I*K,O=K*j-C*H,Q=H*I-j*J,S=(x*N+M*O+b*Q)*F;if(S<0||L+S>G)continue;const U=(B*N+w*O+A*Q)/F;if(U>=0){u(U,U,s?P(j,I,C,B,w,A,h):null,n)}}}function d(n,t,o,i,c,e,r,s){const u=n[0],f=n[1],a=n[2],l=t[0],m=t[1],p=t[2];for(let x=o;x<i;++x){const n=3*x,t=n+1,o=n+2,i=e*n,M=c[i],b=c[i+1],d=c[i+2],g=e*t,v=e*o,y=c[g]-M,q=c[g+1]-b,T=c[g+2]-d,V=c[v]-M,R=c[v+1]-b,j=c[v+2]-d,I=m*j-R*p,C=p*V-j*l,B=l*R-V*m,w=y*I+q*C+T*B,A=w*w;if(A<=z)continue;const k=u-M,D=f-b,E=a-d,F=(k*I+D*C+E*B)*w;if(F<0||F>A)continue;const G=D*T-q*E,H=E*y-T*k,J=k*q-y*D,K=(l*G+m*H+p*J)*w;if(K<0||F+K>A)continue;const L=(V*G+R*H+j*J)/w;if(L>=0){s(L,L,r?P(y,q,T,V,R,j,h):null,x)}}}function g(n,t,o,i,c,e,r,s,u,f,a,l=null,m=0){const p=n[0],x=n[1],M=n[2],b=t[0],d=t[1],g=t[2];for(let v=o;v<i;++v){const n=m+(l?.[v]??v),t=3*n,o=r*c[t],i=e[o],y=e[o+1],q=e[o+2],T=r*c[t+1],V=e[T],R=e[T+1],j=e[T+2],I=r*c[t+2],C=e[I],B=e[I+1],w=e[I+2],A=q-u,k=s/Math.sqrt(i*i+y*y+A*A),D=i+i*k,E=y+y*k,F=q+A*k,G=j-u,H=s/Math.sqrt(V*V+R*R+G*G),J=V+V*H,K=R+R*H,L=j+G*H,N=w-u,O=s/Math.sqrt(C*C+B*B+N*N),Q=J-D,S=K-E,U=L-F,W=C+C*O-D,X=B+B*O-E,Y=w+N*O-F,Z=d*Y-X*g,$=g*W-Y*b,_=b*X-W*d,nn=Q*Z+S*$+U*_,tn=nn*nn;if(tn<=z)continue;const on=p-D,cn=x-E,en=M-F,rn=(on*Z+cn*$+en*_)*nn;if(rn<0||rn>tn)continue;const sn=cn*U-S*en,un=en*Q-U*on,fn=on*S-Q*cn,an=(b*sn+d*un+g*fn)*nn;if(an<0||rn+an>tn)continue;const ln=(W*sn+X*un+Y*fn)/nn;if(ln>=0){a(ln,ln,f?P(Q,S,U,W,X,Y,h):null,n)}}}function v(n,t,o,i,c,e,r,s,u){const f=n[0],a=n[1],l=n[2],m=t[0],p=t[1],x=t[2],{normalRequired:M}=s;for(let b=o;b<i;++b){const n=e[b],t=3*n;let[o,i,s]=c(G,t),[d,g,v]=c(G,t+1),[y,q,T]=c(G,t+2);null!=r&&([o,i,s]=r.applyToVertex(F,o,i,s,b),[d,g,v]=r.applyToVertex(F,d,g,v,b),[y,q,T]=r.applyToVertex(F,y,q,T,b));const V=d-o,R=g-i,j=v-s,I=y-o,C=q-i,B=T-s,w=p*B-C*x,A=x*I-B*m,k=m*C-I*p,D=V*w+R*A+j*k,E=D*D;if(E<=z)continue;const H=f-o,J=a-i,K=l-s,L=(H*w+J*A+K*k)*D;if(L<0||L>E)continue;const N=J*j-R*K,O=K*V-j*H,Q=H*R-V*J,S=(m*N+p*O+x*Q)*D;if(S<0||L+S>E)continue;const U=(I*N+C*O+B*Q)/D;if(U>=0){u(U,U,M?P(V,R,j,I,C,B,h):null,n)}}}function y(t,o,i,c,e,r,s,u){const f=o,a=E,l=Math.abs(f[0]),m=Math.abs(f[1]),h=Math.abs(f[2]),p=l>=m?l>=h?0:2:m>=h?1:2,x=p,M=f[x]<0?2:1,b=(p+M)%3,d=(p+(3-M))%3,g=f[b]/f[x],v=f[d]/f[x],y=1/f[x],P=q,j=T,I=V,{normalRequired:C}=s;for(let q=i;q<c;++q){const o=3*q;e(a[0],o),e(a[1],o+1),e(a[2],o+2),r&&(r.applyToVertex(a[0],a[0][0],a[0][1],a[0][2],q),r.applyToVertex(a[1],a[1][0],a[1][1],a[1][2],q),r.applyToVertex(a[2],a[2][0],a[2][1],a[2][2],q)),n(P,a[0],t),n(j,a[1],t),n(I,a[2],t);const i=P[b]-g*P[x],c=P[d]-v*P[x],s=j[b]-g*j[x],f=j[d]-v*j[x],l=I[b]-g*I[x],m=I[d]-v*I[x],h=l*f-m*s,p=i*m-c*l,M=s*c-f*i;if((h<0||p<0||M<0)&&(h>0||p>0||M>0))continue;const T=h+p+M;if(0===T)continue;const V=h*(y*P[x])+p*(y*j[x])+M*(y*I[x]);if(V*Math.sign(T)<0)continue;const B=V/T;if(B>=0){u(B,B,C?R(a):null,q)}}}const q=c(),T=c(),V=c();function P(n,c,e,r,s,u,f){return t(j,n,c,e),t(I,r,s,u),o(f,j,I),i(f,f),f}function R(t){return n(j,t[1],t[0]),n(I,t[2],t[0]),o(h,j,I),i(h,h),h}const j=c(),I=c();function C(n,o,i){return t(i,1/(o[0]-n[0]),1/(o[1]-n[1]),1/(o[2]-n[2]))}function B(n,o){return t(o,1/n[0],1/n[1],1/n[2])}function w(n,t,o,i){return A(n,t,o,i,1/0)}function A(n,t,o,i,c){const e=(n[0]-i-t[0])*o[0],r=(n[3]+i-t[0])*o[0];let s=Math.min(e,r),u=Math.max(e,r);const f=(n[1]-i-t[1])*o[1],a=(n[4]+i-t[1])*o[1];if(u=Math.min(u,Math.max(f,a)),u<0)return!1;if(s=Math.max(s,Math.min(f,a)),s>u)return!1;const l=(n[2]-i-t[2])*o[2],m=(n[5]+i-t[2])*o[2];return u=Math.min(u,Math.max(l,m)),!(u<0)&&(s=Math.max(s,Math.min(l,m)),!(s>u)&&s<c)}const k=1e-7,z=k*k,D=c(),E=[c(),c(),c()],F=c(),G=c();export{u as MeshIntersectionOptions,C as computeInvDir,w as intersectAabbInvDir,A as intersectAabbInvDirBefore,b as intersectRayTriangles,y as intersectRayTrianglesWithDisplacementWatertight,g as intersectRayTrianglesWithVerticalOffsetENUGlobal,d as intersectRenderGeometryTriangles,a as intersectTriangleGeometry,x as intersectTriangleGeometry2D,p 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 e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}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,e={}){this.geometry=r,this.screenToWorldRatio=1,this._transformation=i(),this._shaderTransformation=null,this._boundingSphere=null,this.id=t(),this.layerViewUid=e.layerViewUid,this.graphicUid=e.graphicUid,this.castShadow=e.castShadow??!1,e.objectShaderTransformation&&this.objectShaderTransformationChanged(e.objectShaderTransformation)}get indexCount(){return this.geometry.indexCount}get faceCount(){return this.geometry.faceCount}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??=i(),e(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.sphere.center,this.shaderTransformation),this._boundingSphere.radius=this.boundingInfo.sphere.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}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}get readPrimitivePosition(){return this.geometry.readPrimitivePosition}}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 e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}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,e={}){this.geometry=r,this.screenToWorldRatio=1,this._transformation=i(),this._shaderTransformation=null,this._boundingSphere=null,this.id=t(),this.layerViewUid=e.layerViewUid,this.graphicUid=e.graphicUid,this.castShadow=e.castShadow??!1,e.objectShaderTransformation&&this.objectShaderTransformationChanged(e.objectShaderTransformation)}get indexCount(){return this.geometry.indexCount}get faceCount(){return this.geometry.faceCount}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??=i(),e(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.sphere.center,this.shaderTransformation),this._boundingSphere.radius=this.boundingInfo.sphere.radius*a(this.shaderTransformation)),this._boundingSphere):s}get material(){return this.geometry.material}get shaderTransformation(){return this._shaderTransformation??this.transformation}get attributes(){return this.geometry.attributes}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}get readPrimitivePosition(){return this.geometry.readPrimitivePosition}}class m extends h{}export{h as RenderGeometry,m as ValidatedRenderGeometry};
@@ -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{distance as r,copy as o,set as i,transformMat4 as n,squaredDistance 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,i){this.distance=t,this.primitiveIndex=e,o(this.point,r),this.hasNormal=null!=i,null!=i&&o(this.normal,i)}updateIfCloserFromValues(t,e,r,o){t<this.distance&&this.update(t,e,r,o)}updateIfCloser(t){const{distance:e,primitiveIndex:r,point:o,normal:i}=t;this.updateIfCloserFromValues(e,r,o,t.hasNormal?i:null)}get valid(){return Number.isFinite(this.distance)}}function y(t,e,r,o,i){if(!t.visible||0!==t.type)return null;const n=new g(4);let s;s=t.boundingInfo?b(t.readPrimitivePosition,t.boundingInfo,e,r,o,i):v(e,r,o,0,t.faceCount,t.readPrimitivePosition,i,null,0);for(const l of s)n.updateIfCloser(l);return n.valid?n:null}function*v(t,e,o,i,n,s,l,a=null,u=0){if(null==t.camera)return;const{camera:c,screenPolygonPrimitiveProcessor:p}=t;for(let d=i;d<n;++d){const t=(a?.[d]??d)+u,i=null==a?t:d,n=3*t;N(F[0],s,n+0,l,i,e),N(F[1],s,n+1,l,i,e),N(F[2],s,n+2,l,i,e);const h=O;let I;A.reset();const g=C;for(const e of p.processTriangle(F))if(g.length=0,m(c.frustum[4],e,()=>g.pushNew(),!1),!(g.length<3)){for(let t=0;t<g.length;t++)c.projectToScreen(g.at(t),V[t]);P(o,V,g.length)&&(j(c.eye,g,w),null==I&&(I=f(O,F[0],F[1],F[2])),A.updateIfCloserFromValues(r(c.eye,w),t,w,I?h:null))}A.valid&&(yield A)}}function*b(t,e,r,o,i,n){let s;if(null!=n?(a(x,e.box),n.applyToAabb(x),s=c(i.broadPhaseFrustum,x,o)):s=c(i.broadPhaseFrustum,e.box,o),!s)return;const{primitiveIndices:l}=e,u=l.length;if(u>d){const s=e.children;if(void 0!==s){for(const e of s)yield*b(t,e,r,o,i,n);return}}yield*v(r,o,i,0,u,t,n,l,0)}function N(t,e,r,o,s,l){const[a,u,c]=e(t,r);null!=o?o.applyToVertex(t,a,u,c,s):i(t,a,u,c),l&&n(t,t,l)}function P(t,e,r){for(let o=1;o<r-1;o++)if(h(t,e[0],e[o],e[o+1]))return!0;return!1}function j(t,e,r){let i=Number.POSITIVE_INFINITY;const n=e.at(0);for(let l=1;l<e.length-1;l++){p(S,t,n,e.at(l),e.at(l+1));const a=s(t,S);a<i&&(i=a,o(r,S))}}const x=u(),T=12,F=[l(),l(),l()],C=new t({allocator:t=>t??l()}),V=Array.from({length:T},()=>e()),w=l(),O=l(),S=l(),A=new g(4);export{I as DrapedHit,g as Hit,v as forEachTriangleRangeScreenPolygonHit,y as intersectTriangleGeometryScreenPolygon};
2
+ import t from"../../../../core/PooledArray.js";import{createScreenPointArray as e}from"../../../../core/screenUtils.js";import{distance as r,copy as o,set as i,transformMat4 as n,squaredDistance 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,i){this.distance=t,this.primitiveIndex=e,o(this.point,r),this.hasNormal=null!=i,null!=i&&o(this.normal,i)}updateIfCloserFromValues(t,e,r,o){t<this.distance&&this.update(t,e,r,o)}updateIfCloser(t){const{distance:e,primitiveIndex:r,point:o,normal:i}=t;this.updateIfCloserFromValues(e,r,o,t.hasNormal?i:null)}get valid(){return Number.isFinite(this.distance)}}function y(t,e,r,o,i){if(!t.visible)return null;const n=new g(4);let s;s=t.boundingInfo?b(t.readPrimitivePosition,t.boundingInfo,e,r,o,i):v(e,r,o,0,t.faceCount,t.readPrimitivePosition,i,null,0);for(const l of s)n.updateIfCloser(l);return n.valid?n:null}function*v(t,e,o,i,n,s,l,a=null,u=0){if(null==t.camera)return;const{camera:c,screenPolygonPrimitiveProcessor:p}=t;for(let d=i;d<n;++d){const t=(a?.[d]??d)+u,i=null==a?t:d,n=3*t;N(F[0],s,n+0,l,i,e),N(F[1],s,n+1,l,i,e),N(F[2],s,n+2,l,i,e);const h=O;let I;A.reset();const g=C;for(const e of p.processTriangle(F))if(g.length=0,m(c.frustum[4],e,()=>g.pushNew(),!1),!(g.length<3)){for(let t=0;t<g.length;t++)c.projectToScreen(g.at(t),V[t]);P(o,V,g.length)&&(j(c.eye,g,w),null==I&&(I=f(O,F[0],F[1],F[2])),A.updateIfCloserFromValues(r(c.eye,w),t,w,I?h:null))}A.valid&&(yield A)}}function*b(t,e,r,o,i,n){let s;if(null!=n?(a(x,e.box),n.applyToAabb(x),s=c(i.broadPhaseFrustum,x,o)):s=c(i.broadPhaseFrustum,e.box,o),!s)return;const{primitiveIndices:l}=e,u=l.length;if(u>d){const s=e.children;if(void 0!==s){for(const e of s)yield*b(t,e,r,o,i,n);return}}yield*v(r,o,i,0,u,t,n,l,0)}function N(t,e,r,o,s,l){const[a,u,c]=e(t,r);null!=o?o.applyToVertex(t,a,u,c,s):i(t,a,u,c),l&&n(t,t,l)}function P(t,e,r){for(let o=1;o<r-1;o++)if(h(t,e[0],e[o],e[o+1]))return!0;return!1}function j(t,e,r){let i=Number.POSITIVE_INFINITY;const n=e.at(0);for(let l=1;l<e.length-1;l++){p(S,t,n,e.at(l),e.at(l+1));const a=s(t,S);a<i&&(i=a,o(r,S))}}const x=u(),T=12,F=[l(),l(),l()],C=new t({allocator:t=>t??l()}),V=Array.from({length:T},()=>e()),w=l(),O=l(),S=l(),A=new g(4);export{I as DrapedHit,g as Hit,v as forEachTriangleRangeScreenPolygonHit,y as intersectTriangleGeometryScreenPolygon};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as s}from"../../../../core/screenUtils.js";import{fromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as a,set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as f,length as p,scale as u,distance as d,transformMat4 as m,set as g,normalize as S,subtract as x,transformMat3 as b,scaleAndAdd as v,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as V,ONES as D,create as R}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as C,empty as w,expandPointInPlace as A}from"../../../../geometry/support/aaBoundingRect.js";import{evaluateModelTransformScale as j}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as U}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as M,isColor as T,isOIT as _}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as L}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as I,GLTextureMaterial as E}from"../lib/GLTextureMaterial.js";import{Material as F}from"../lib/Material.js";import{screenPolygonIntersectsBounds as B,screenPolygonIntersectsTriangle as H}from"../lib/screenPolygonOverlapUtils.js";import{DrapedHit as W,Hit as N}from"../lib/screenPolygonTriangleIntersections.js";import{SeparateScreenSizePerspectiveEvaluators as G}from"../lib/screenSizePerspectiveUtils.js";import{assert as q}from"../lib/Util.js";import{writePosition as X,writeNormal as Y,writeColor as k,writeBufferVec2 as J,writeBufferFloat as K,writeBufferVec3 as Q,writeBufferZeros as Z,writeBufferVec4 as $}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as ee}from"./internal/MaterialUtil.js";import{a as te}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as se,getInstanceLayout as re,HUDMaterialTechnique as ie}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ae}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as ne}from"../../../../webscene/support/AlphaCutoff.js";class oe extends F{constructor(e,t,s=!1){super(e,He),this.produces=new Map([[12,e=>M(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[13,e=>M(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[14,e=>M(e)&&this.parameters.drawAsLabel],[18,e=>this.parameters.draped&&M(e)]]),this._visible=!0,this._configuration=new ae(t,s)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:s}=this,r=t.draped;s.enableOITOffset=e.enableOITOffset,s.hasSlicePlane=this.parameters.hasSlicePlane,s.hasVerticalOffset=!!this.parameters.verticalOffset,s.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,s.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,s.polygonOffset=this.parameters.polygonOffset,s.draped=r,s.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,s.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,s.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,s.hasRotation=this.parameters.hasRotation,s.hasVVSize=!!this.parameters.vvSize,s.hasVVColor=!!this.parameters.vvColor,s.occludedFragmentFade=!r&&!!this.parameters.occludedFragmentOpacity,s.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,s.depthTestEnabled=this.parameters.depthEnabled,s.hasVertexColor=this.parameters.hasVertexColor,s.hasVertexSize=this.parameters.hasVertexSize,s.hasVertexRotation=this.parameters.hasVertexRotation,s.hasVertexUVi=this.parameters.hasVertexUVi,s.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,T(e.output)&&(s.debugDrawLabelBorder=!!U.LABELS_SHOW_BORDER),s.hasOcclusionTexture=!t.drawAsLabel&&s.transparentOccluded&&_(e.output)}intersectRay(e,t,s,r,i,a){const{options:{selectionMode:n,hud:o,excludeLabels:l},point:c,camera:h}=s,{parameters:g}=this;if(n&&o&&(!l||!g.isLabel)&&e.visible&&c&&h)for(const{renderScreenPosition:S,screenSize:x,pixelRatioTolerance:b,halfOutlineSize:v,rotationAngle:O,anchor:z,centerView:P}of this._forEachScreenSpaceHUDInstance(Te,e,t,h))if(fe(c,S[0],S[1],x,b,v,O,g,z)){const e=s.ray;if(xe[0]=c[0],xe[1]=c[1],xe[2]=S[2],h.unprojectFromRenderScreen(xe,me)){const t=y();f(t,e.direction);const s=1/p(t);u(t,t,s);const r=d(e.origin,me)*s,i=y();m(i,P,h.inverseViewMatrix),a(r,r,t,-1,i)}}}*_forEachScreenSpaceHUDInstance(e,t,s,i){const{parameters:n}=this,o=t.attributes.get("featureAttribute"),l=null==o?null:V(o.data,Ve),{scaleX:c,scaleY:h}=Ne(l,n,i.pixelRatio),p=t.attributes.get("position"),d=t.attributes.get("size"),O=t.attributes.get("normal"),z=t.attributes.get("rotation"),y=t.attributes.get("centerOffset"),P=n.size,D=r(ze,s);q(p.size>=3);const R="screen"===n.centerOffsetUnits;for(let r=0;r<p.data.length/p.size;r++){const t=r*p.size;if(g(me,p.data[t],p.data[t+1],p.data[t+2]),m(me,me,s),m(me,me,i.viewMatrix),y){const e=r*y.size;g(ye,y.data[e],y.data[e+1],y.data[e+2])}else g(ye,0,0,0);if(!R&&(me[0]+=ye[0],me[1]+=ye[1],0!==ye[2])){const e=ye[2];S(ye,me),x(me,me,u(ye,ye,e))}const o=r*O.size;g(ge,O.data[o],O.data[o+1],O.data[o+2]),b(ge,ge,D);const{normal:l,cosAngle:V}=he(ge,i,Le),C=qe(n,me,V,i,de);if(v(me,me,l,C),i.applyProjection(me,Se),Se[0]>-1){if(R&&(ye[0]||ye[1])&&(Se[0]+=ye[0]*i.pixelRatio,0!==ye[1]&&(Se[1]+=de.alignmentEvaluator.apply(ye[1])*i.pixelRatio),i.unapplyProjection(Se,me)),Se[0]+=n.screenOffset[0]*i.pixelRatio,Se[1]+=n.screenOffset[1]*i.pixelRatio,Se[0]=Math.floor(Se[0]),Se[1]=Math.floor(Se[1]),Fe[0]=P[0],Fe[1]=P[1],null!=d){const e=r*d.size;Fe[0]*=d.data[e],Fe[1]*=d.data[e+1]}de.evaluator.applyVec2(Fe,Fe);let t=0;if(n.textureIsSignedDistanceField){t=Math.min(n.outlineSize,.5*Fe[0])*i.pixelRatio/2}Fe[0]*=c,Fe[1]*=h,f(e.centerView,me),g(e.renderScreenPosition,Se[0],Se[1],Se[2]),a(e.screenSize,Fe),e.pixelRatioTolerance=Ie*i.pixelRatio,e.halfOutlineSize=t,e.rotationAngle=n.rotation+(null!=z?z.data[r*z.size]:0),e.anchor=te(n),yield e}}}*_forEachDrapedHUDInstance(e,t){const s=t.attributes.get("position"),r=t.attributes.get("size"),i=t.attributes.get("rotation"),n=this.parameters,o=n.size,l=t.attributes.get("featureAttribute"),c=null==l?null:V(l.data,Ve),{scaleX:h,scaleY:f}=Ne(c,n,t.screenToWorldRatio);e.pixelRatioTolerance=Ee*t.screenToWorldRatio,e.anchor=te(n);for(let p=0;p<s.data.length/s.size;p++){const l=p*s.size;if(e.x=s.data[l],e.y=s.data[l+1],Fe[0]=o[0],Fe[1]=o[1],null!=r){const e=p*r.size;Fe[0]*=r.data[e],Fe[1]*=r.data[e+1]}if(e.halfOutlineSize=0,n.textureIsSignedDistanceField){const s=Math.min(n.outlineSize,.5*Fe[0]);e.halfOutlineSize=s*t.screenToWorldRatio/2}Fe[0]*=h,Fe[1]*=f,a(e.screenSize,Fe),e.rotationAngle=n.rotation+(null!=i?i.data[p*i.size]:0),yield e}}intersectRayDraped(e,t,s,r,i){const a=this.parameters;for(const{x:n,y:o,screenSize:l,pixelRatioTolerance:c,halfOutlineSize:h,rotationAngle:f,anchor:p}of this._forEachDrapedHUDInstance(_e,e))fe(s,n,o,l,c,h,f,a,p)&&r(i.distance,i.renderDistance,i.normal,-1)}intersectScreenPolygonDraped(e,t,s,r){if(!s.options.selectionMode||s.options.excludeLabels&&this.parameters.isLabel)return null;const i=this.parameters;for(const{x:a,y:n,screenSize:o,pixelRatioTolerance:l,halfOutlineSize:c,rotationAngle:h,anchor:f}of this._forEachDrapedHUDInstance(_e,e))if(pe(r,a+t[0],n+t[1],o,l,c,h,i,f,!1))return new W(-1);return null}intersectScreenPolygon(e,t,s,r){const{options:{selectionMode:i,hud:a,excludeLabels:n},camera:o}=s,{parameters:l}=this;if(!i||!a||n&&l.isLabel||!e.visible||null==t)return null;const c=new N(1),h=1/o.pixelRatio;for(const{renderScreenPosition:f,screenSize:p,pixelRatioTolerance:u,halfOutlineSize:g,rotationAngle:S,anchor:x,centerView:b}of this._forEachScreenSpaceHUDInstance(Te,e,t,o)){const e=m(me,b,o.inverseViewMatrix);if(!s.screenPolygonPrimitiveProcessor?.validatePoint(e))continue;const t=f[0]*h,i=(o.fullHeight-f[1])*h;if(je[0]=p[0]*h,je[1]=p[1]*h,pe(r,t,i,je,u*h,g*h,S,l,x,!0)){const t=d(o.eye,e);c.updateIfCloserFromValues(t,-1,e,null)}}return c.valid?c:null}createBufferWriter(){return new We(this.parameters)}applyShaderOffsets(e,t,s,i,a,n,o,l){b(be,s,r(ze,i));const c=he(be,o,Le),h=Ge(p(t),o),f=qe(this.parameters,t,c.cosAngle,o,l);v(t,t,c.normal,f+h),v(e,e,be,f+h);const u=n+f;this._applyPolygonOffsetView(t,c,u,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,s,r,i,a){return this._applyCenterOffsetNDC(e,t,r,i),null!=a&&f(a,i),this._applyPolygonOffsetNDC(i,s,r,i),i}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return f(a,t);const c=e(Math.abs(s.cosAngle),.01,1),h=1-Math.sqrt(1-c*c)/c/i.viewport[2];return u(a,t,l>0?h:1/h),a}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&f(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(S(ge,s),O(s,s,u(ge,ge,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&f(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&f(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t);r[2]-=(a||e)*i}return r}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:s}=this.parameters,r=e[3]>=ne||t>=ne&&s[3]>=ne;return this._visible&&r}createGLMaterial(e){return new le(e)}calculateRelativeScreenBounds(e,t,s=C()){return ce(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}}class le extends E{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(ie,e)}}function ce(e,t,s,r){r[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*s,r[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*s}function he(e,t,s){return m(s.normal,e,t.viewInverseTransposeMatrix),s.cosAngle=z(s.normal,Be),s}function fe(e,s,r,i,a,l,c,h,f){const p=ue(s,r,i,a,l,h,f,De);return n(Oe,s,r),o(ve,e,Oe,t(c)),ve[0]>p[0]&&ve[0]<p[2]&&ve[1]>p[1]&&ve[1]<p[3]}function pe(e,s,r,i,a,l,c,h,f,p){const u=ue(s,r,i,a,l,h,f,De,p);if(n(Re,u[0],u[1]),n(Ce,u[2],u[1]),n(we,u[2],u[3]),n(Ae,u[0],u[3]),0!==c){const e=t(c);n(Oe,s,r),o(Re,Re,Oe,e),o(Ce,Ce,Oe,e),o(we,we,Oe,e),o(Ae,Ae,Oe,e),w(u),A(u,Re),A(u,Ce),A(u,we),A(u,Ae)}return!!B(e,u)&&(H(e,Re,Ce,we)||H(e,Re,we,Ae))}function ue(e,t,s,r,i,a,n,o,l=!1){let c=e-r-s[0]*n[0],h=c+s[0]+2*r;const f=l?1-n[1]:n[1];let p=t-r-s[1]*f,u=p+s[1]+2*r;const d=a.distanceFieldBoundingBox;return a.textureIsSignedDistanceField&&null!=d&&(c+=s[0]*d[0],p+=s[1]*(l?1-d[3]:d[1]),h-=s[0]*(1-d[2]),u-=s[1]*(l?d[1]:1-d[3]),c-=i,h+=i,p-=i,u+=i),o[0]=c,o[1]=p,o[2]=h,o[3]=u,o}const de=new G,me=y(),ge=y(),Se=R(),xe=s(),be=y(),ve=h(),Oe=h(),ze=i(),ye=y(),Pe=y(),Ve=R(),De=C(),Re=h(),Ce=h(),we=h(),Ae=h(),je=h();class Ue{constructor(){this.renderScreenPosition=y(),this.screenSize=h(),this.centerView=y(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=h()}}class Me{constructor(){this.x=0,this.y=0,this.screenSize=h(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=h()}}const Te=new Ue,_e=new Me,Le={normal:y(),cosAngle:0},Ie=1,Ee=2,Fe=c(0,0),Be=P(0,0,1);class He extends I{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=D,this.size=l,this.polygonOffset=0,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=D,this.outlineSize=0,this.distanceFieldBoundingBox=R(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class We{constructor(e){this.baseInstanceLayout=se,this.layout=re(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,s,r){if(null==r)return;const{buffer:i,offset:a}=r,{position:n,normal:o,color:l,size:c,rotation:h,centerOffset:f,groundDistance:p,featureAttribute:u,uvi:d,olidColor:m}=i;X(s.get("position"),e,n,a),Y(s.get("normal"),t,o,a);const g=s.get("position").indices.length;if(d){const e=s.get("uvi")?.data;if(e&&e.length>=4){const[t,s,r,i]=e;for(let e=0;e<g;++e){const n=a+e;d.setValues(n,t,s,r,i)}}}if(l&&k(s.get("color"),4,l,a),c&&J(s.get("size"),c,a),h&&K(s.get("rotation"),h,a),f&&(s.get("centerOffset")?Q(s.get("centerOffset"),f,a):Z(f,a,g)),s.get("groundDistance")?K(s.get("groundDistance"),p,a):Z(p,a,g),u&&(s.get("featureAttribute")?$(s.get("featureAttribute"),u,a):Z(u,a,g)),null!=m){const e=s.get("olidColor");null!=e?k(e,4,m,a):Z(m,a,g)}}writeBaseInstance(e,t){const{uv0:s}=t;J(e.get("uv0"),s,0)}}function Ne(e,t,s){return null==e||null==t.vvSize?{scaleX:s,scaleY:s}:(j(Pe,t,e),{scaleX:Pe[0]*s,scaleY:Pe[1]*s})}function Ge(e,t){const s=t.computeRenderPixelSizeAtDist(e)*L;return(t.aboveGround?1:-1)*s}function qe(e,t,s,r,i){if(!e.verticalOffset?.screenLength){const r=p(t);return i.update(s,r,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=p(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=ee(r,a,e.verticalOffset,s,n,e.screenSizePerspectiveMinPixelReferenceSize);return i.update(s,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{oe as HUDMaterial,He as Parameters};
2
+ import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as s}from"../../../../core/screenUtils.js";import{fromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as a,set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as f,length as p,scale as u,distance as d,transformMat4 as m,set as g,normalize as S,subtract as x,transformMat3 as b,scaleAndAdd as v,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as V,ONES as D,create as R}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as C,empty as w,expandPointInPlace as A}from"../../../../geometry/support/aaBoundingRect.js";import{evaluateModelTransformScale as j}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as T}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as U,isColor as M,isOIT as _}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as L}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as I,GLTextureMaterial as E}from"../lib/GLTextureMaterial.js";import{Material as F}from"../lib/Material.js";import{screenPolygonIntersectsBounds as B,screenPolygonIntersectsTriangle as H}from"../lib/screenPolygonOverlapUtils.js";import{DrapedHit as W,Hit as N}from"../lib/screenPolygonTriangleIntersections.js";import{SeparateScreenSizePerspectiveEvaluators as G}from"../lib/screenSizePerspectiveUtils.js";import{assert as q}from"../lib/Util.js";import{writePosition as X,writeNormal as Y,writeColor as k,writeBufferVec2 as J,writeBufferFloat as K,writeBufferVec3 as Q,writeBufferZeros as Z,writeBufferVec4 as $}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as ee}from"./internal/MaterialUtil.js";import{a as te}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as se,getInstanceLayout as re,HUDMaterialTechnique as ie}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ae}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as ne}from"../../../../webscene/support/AlphaCutoff.js";class oe extends F{constructor(e,t,s=!1){super(e,He),this.geometryType=1,this.produces=new Map([[12,e=>U(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[13,e=>U(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[14,e=>U(e)&&this.parameters.drawAsLabel],[18,e=>this.parameters.draped&&U(e)]]),this._visible=!0,this._configuration=new ae(t,s)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:s}=this,r=t.draped;s.enableOITOffset=e.enableOITOffset,s.hasSlicePlane=this.parameters.hasSlicePlane,s.hasVerticalOffset=!!this.parameters.verticalOffset,s.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,s.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,s.polygonOffset=this.parameters.polygonOffset,s.draped=r,s.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,s.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,s.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,s.hasRotation=this.parameters.hasRotation,s.hasVVSize=!!this.parameters.vvSize,s.hasVVColor=!!this.parameters.vvColor,s.occludedFragmentFade=!r&&!!this.parameters.occludedFragmentOpacity,s.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,s.depthTestEnabled=this.parameters.depthEnabled,s.hasVertexColor=this.parameters.hasVertexColor,s.hasVertexSize=this.parameters.hasVertexSize,s.hasVertexRotation=this.parameters.hasVertexRotation,s.hasVertexUVi=this.parameters.hasVertexUVi,s.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,M(e.output)&&(s.debugDrawLabelBorder=!!T.LABELS_SHOW_BORDER),s.hasOcclusionTexture=!t.drawAsLabel&&s.transparentOccluded&&_(e.output)}intersectRay(e,t,s,r,i,a){const{options:{selectionMode:n,hud:o,excludeLabels:l},point:c,camera:h}=s,{parameters:g}=this;if(n&&o&&(!l||!g.isLabel)&&e.visible&&c&&h)for(const{renderScreenPosition:S,screenSize:x,pixelRatioTolerance:b,halfOutlineSize:v,rotationAngle:O,anchor:z,centerView:P}of this._forEachScreenSpaceHUDInstance(Me,e,t,h))if(fe(c,S[0],S[1],x,b,v,O,g,z)){const e=s.ray;if(xe[0]=c[0],xe[1]=c[1],xe[2]=S[2],h.unprojectFromRenderScreen(xe,me)){const t=y();f(t,e.direction);const s=1/p(t);u(t,t,s);const r=d(e.origin,me)*s,i=y();m(i,P,h.inverseViewMatrix),a(r,r,t,-1,i)}}}*_forEachScreenSpaceHUDInstance(e,t,s,i){const{parameters:n}=this,o=t.attributes.get("featureAttribute"),l=null==o?null:V(o.data,Ve),{scaleX:c,scaleY:h}=Ne(l,n,i.pixelRatio),p=t.attributes.get("position"),d=t.attributes.get("size"),O=t.attributes.get("normal"),z=t.attributes.get("rotation"),y=t.attributes.get("centerOffset"),P=n.size,D=r(ze,s);q(p.size>=3);const R="screen"===n.centerOffsetUnits;for(let r=0;r<p.data.length/p.size;r++){const t=r*p.size;if(g(me,p.data[t],p.data[t+1],p.data[t+2]),m(me,me,s),m(me,me,i.viewMatrix),y){const e=r*y.size;g(ye,y.data[e],y.data[e+1],y.data[e+2])}else g(ye,0,0,0);if(!R&&(me[0]+=ye[0],me[1]+=ye[1],0!==ye[2])){const e=ye[2];S(ye,me),x(me,me,u(ye,ye,e))}const o=r*O.size;g(ge,O.data[o],O.data[o+1],O.data[o+2]),b(ge,ge,D);const{normal:l,cosAngle:V}=he(ge,i,Le),C=qe(n,me,V,i,de);if(v(me,me,l,C),i.applyProjection(me,Se),Se[0]>-1){if(R&&(ye[0]||ye[1])&&(Se[0]+=ye[0]*i.pixelRatio,0!==ye[1]&&(Se[1]+=de.alignmentEvaluator.apply(ye[1])*i.pixelRatio),i.unapplyProjection(Se,me)),Se[0]+=n.screenOffset[0]*i.pixelRatio,Se[1]+=n.screenOffset[1]*i.pixelRatio,Se[0]=Math.floor(Se[0]),Se[1]=Math.floor(Se[1]),Fe[0]=P[0],Fe[1]=P[1],null!=d){const e=r*d.size;Fe[0]*=d.data[e],Fe[1]*=d.data[e+1]}de.evaluator.applyVec2(Fe,Fe);let t=0;if(n.textureIsSignedDistanceField){t=Math.min(n.outlineSize,.5*Fe[0])*i.pixelRatio/2}Fe[0]*=c,Fe[1]*=h,f(e.centerView,me),g(e.renderScreenPosition,Se[0],Se[1],Se[2]),a(e.screenSize,Fe),e.pixelRatioTolerance=Ie*i.pixelRatio,e.halfOutlineSize=t,e.rotationAngle=n.rotation+(null!=z?z.data[r*z.size]:0),e.anchor=te(n),yield e}}}*_forEachDrapedHUDInstance(e,t){const s=t.attributes.get("position"),r=t.attributes.get("size"),i=t.attributes.get("rotation"),n=this.parameters,o=n.size,l=t.attributes.get("featureAttribute"),c=null==l?null:V(l.data,Ve),{scaleX:h,scaleY:f}=Ne(c,n,t.screenToWorldRatio);e.pixelRatioTolerance=Ee*t.screenToWorldRatio,e.anchor=te(n);for(let p=0;p<s.data.length/s.size;p++){const l=p*s.size;if(e.x=s.data[l],e.y=s.data[l+1],Fe[0]=o[0],Fe[1]=o[1],null!=r){const e=p*r.size;Fe[0]*=r.data[e],Fe[1]*=r.data[e+1]}if(e.halfOutlineSize=0,n.textureIsSignedDistanceField){const s=Math.min(n.outlineSize,.5*Fe[0]);e.halfOutlineSize=s*t.screenToWorldRatio/2}Fe[0]*=h,Fe[1]*=f,a(e.screenSize,Fe),e.rotationAngle=n.rotation+(null!=i?i.data[p*i.size]:0),yield e}}intersectRayDraped(e,t,s,r,i){const a=this.parameters;for(const{x:n,y:o,screenSize:l,pixelRatioTolerance:c,halfOutlineSize:h,rotationAngle:f,anchor:p}of this._forEachDrapedHUDInstance(_e,e))fe(s,n,o,l,c,h,f,a,p)&&r(i.distance,i.renderDistance,i.normal,-1)}intersectScreenPolygonDraped(e,t,s,r){if(!s.options.selectionMode||s.options.excludeLabels&&this.parameters.isLabel)return null;const i=this.parameters;for(const{x:a,y:n,screenSize:o,pixelRatioTolerance:l,halfOutlineSize:c,rotationAngle:h,anchor:f}of this._forEachDrapedHUDInstance(_e,e))if(pe(r,a+t[0],n+t[1],o,l,c,h,i,f,!1))return new W(-1);return null}intersectScreenPolygon(e,t,s,r){const{options:{selectionMode:i,hud:a,excludeLabels:n},camera:o}=s,{parameters:l}=this;if(!i||!a||n&&l.isLabel||!e.visible||null==t)return null;const c=new N(1),h=1/o.pixelRatio;for(const{renderScreenPosition:f,screenSize:p,pixelRatioTolerance:u,halfOutlineSize:g,rotationAngle:S,anchor:x,centerView:b}of this._forEachScreenSpaceHUDInstance(Me,e,t,o)){const e=m(me,b,o.inverseViewMatrix);if(!s.screenPolygonPrimitiveProcessor?.validatePoint(e))continue;const t=f[0]*h,i=(o.fullHeight-f[1])*h;if(je[0]=p[0]*h,je[1]=p[1]*h,pe(r,t,i,je,u*h,g*h,S,l,x,!0)){const t=d(o.eye,e);c.updateIfCloserFromValues(t,-1,e,null)}}return c.valid?c:null}createBufferWriter(){return new We(this.parameters)}applyShaderOffsets(e,t,s,i,a,n,o,l){b(be,s,r(ze,i));const c=he(be,o,Le),h=Ge(p(t),o),f=qe(this.parameters,t,c.cosAngle,o,l);v(t,t,c.normal,f+h),v(e,e,be,f+h);const u=n+f;this._applyPolygonOffsetView(t,c,u,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,s,r,i,a){return this._applyCenterOffsetNDC(e,t,r,i),null!=a&&f(a,i),this._applyPolygonOffsetNDC(i,s,r,i),i}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return f(a,t);const c=e(Math.abs(s.cosAngle),.01,1),h=1-Math.sqrt(1-c*c)/c/i.viewport[2];return u(a,t,l>0?h:1/h),a}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&f(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(S(ge,s),O(s,s,u(ge,ge,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&f(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&f(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t);r[2]-=(a||e)*i}return r}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:s}=this.parameters,r=e[3]>=ne||t>=ne&&s[3]>=ne;return this._visible&&r}createGLMaterial(e){return new le(e)}calculateRelativeScreenBounds(e,t,s=C()){return ce(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}}class le extends E{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(ie,e)}}function ce(e,t,s,r){r[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*s,r[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*s}function he(e,t,s){return m(s.normal,e,t.viewInverseTransposeMatrix),s.cosAngle=z(s.normal,Be),s}function fe(e,s,r,i,a,l,c,h,f){const p=ue(s,r,i,a,l,h,f,De);return n(Oe,s,r),o(ve,e,Oe,t(c)),ve[0]>p[0]&&ve[0]<p[2]&&ve[1]>p[1]&&ve[1]<p[3]}function pe(e,s,r,i,a,l,c,h,f,p){const u=ue(s,r,i,a,l,h,f,De,p);if(n(Re,u[0],u[1]),n(Ce,u[2],u[1]),n(we,u[2],u[3]),n(Ae,u[0],u[3]),0!==c){const e=t(c);n(Oe,s,r),o(Re,Re,Oe,e),o(Ce,Ce,Oe,e),o(we,we,Oe,e),o(Ae,Ae,Oe,e),w(u),A(u,Re),A(u,Ce),A(u,we),A(u,Ae)}return!!B(e,u)&&(H(e,Re,Ce,we)||H(e,Re,we,Ae))}function ue(e,t,s,r,i,a,n,o,l=!1){let c=e-r-s[0]*n[0],h=c+s[0]+2*r;const f=l?1-n[1]:n[1];let p=t-r-s[1]*f,u=p+s[1]+2*r;const d=a.distanceFieldBoundingBox;return a.textureIsSignedDistanceField&&null!=d&&(c+=s[0]*d[0],p+=s[1]*(l?1-d[3]:d[1]),h-=s[0]*(1-d[2]),u-=s[1]*(l?d[1]:1-d[3]),c-=i,h+=i,p-=i,u+=i),o[0]=c,o[1]=p,o[2]=h,o[3]=u,o}const de=new G,me=y(),ge=y(),Se=R(),xe=s(),be=y(),ve=h(),Oe=h(),ze=i(),ye=y(),Pe=y(),Ve=R(),De=C(),Re=h(),Ce=h(),we=h(),Ae=h(),je=h();class Te{constructor(){this.renderScreenPosition=y(),this.screenSize=h(),this.centerView=y(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=h()}}class Ue{constructor(){this.x=0,this.y=0,this.screenSize=h(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=h()}}const Me=new Te,_e=new Ue,Le={normal:y(),cosAngle:0},Ie=1,Ee=2,Fe=c(0,0),Be=P(0,0,1);class He extends I{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=D,this.size=l,this.polygonOffset=0,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=D,this.outlineSize=0,this.distanceFieldBoundingBox=R(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class We{constructor(e){this.baseInstanceLayout=se,this.layout=re(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,s,r){if(null==r)return;const{buffer:i,offset:a}=r,{position:n,normal:o,color:l,size:c,rotation:h,centerOffset:f,groundDistance:p,featureAttribute:u,uvi:d,olidColor:m}=i;X(s.get("position"),e,n,a),Y(s.get("normal"),t,o,a);const g=s.get("position").indices.length;if(d){const e=s.get("uvi")?.data;if(e&&e.length>=4){const[t,s,r,i]=e;for(let e=0;e<g;++e){const n=a+e;d.setValues(n,t,s,r,i)}}}if(l&&k(s.get("color"),4,l,a),c&&J(s.get("size"),c,a),h&&K(s.get("rotation"),h,a),f&&(s.get("centerOffset")?Q(s.get("centerOffset"),f,a):Z(f,a,g)),s.get("groundDistance")?K(s.get("groundDistance"),p,a):Z(p,a,g),u&&(s.get("featureAttribute")?$(s.get("featureAttribute"),u,a):Z(u,a,g)),null!=m){const e=s.get("olidColor");null!=e?k(e,4,m,a):Z(m,a,g)}}writeBaseInstance(e,t){const{uv0:s}=t;J(e.get("uv0"),s,0)}}function Ne(e,t,s){return null==e||null==t.vvSize?{scaleX:s,scaleY:s}:(j(Pe,t,e),{scaleX:Pe[0]*s,scaleY:Pe[1]*s})}function Ge(e,t){const s=t.computeRenderPixelSizeAtDist(e)*L;return(t.aboveGround?1:-1)*s}function qe(e,t,s,r,i){if(!e.verticalOffset?.screenLength){const r=p(t);return i.update(s,r,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=p(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=ee(r,a,e.verticalOffset,s,n,e.screenSizePerspectiveMinPixelReferenceSize);return i.update(s,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{oe as HUDMaterial,He as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as n}from"../lib/Material.js";import{writePosition2d as a,writeBufferFloat as o}from"./internal/bufferWriterUtils.js";import{attributeDrivenInstanceLayout as u,instanceLayout as c,HeatmapDensityPassParameters as l,HeatmapDensityTechnique as f,baseLayout as p}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as m}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const h=2;class d extends l{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class b extends n{constructor(t){super(t,d),this.visible=!0,this.produces=new Map([[18,t=>s(t)]]),this.intersectScreenPolygonDraped=void 0,this._configuration=new m}updateConfiguration(t){super.updateConfiguration(t),this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats}createGLMaterial(t){return new g(t)}intersectRay(){}intersectRayDraped(r,s,i,n,a){const o=r.attributes.get("position"),{parameters:u}=this,{searchRadius:c}=u,{screenToWorldRatio:l}=r,f=c*l+h*l,p=f*f,m=o.data.length/o.size;for(let h=0;h<m;h++){const r=h*o.size,s=t(y,o.data[r],o.data[r+1]);e(s,i)<p&&n(a.distance,a.renderDistance,a.normal,-1)}}intersectScreenPolygon(){return null}createBufferWriter(){return new v(this.parameters.isAttributeDriven?u:c)}}class g extends i{beginSlot(t){return this.getTechnique(f,t)}}class v{constructor(t){this.layout=t,this.baseInstanceLayout=p}elementCount(t){return t.get("position").indices.length}elementCountBaseInstance(){return 4}write(t,e,r,s){if(null==s)return;const{buffer:i,offset:n}=s;a(r.get("position"),t,i.position,n);const u="featureAttribute"in i?i.featureAttribute:null;u&&o(r.get("featureAttribute"),u,n)}writeBaseInstance(t,e){const r=e.uv0;r.setValues(0,-1,-1),r.setValues(1,-1,1),r.setValues(2,1,-1),r.setValues(3,1,1)}}const y=r();export{b as HeatmapDensityMaterial,d as Parameters};
2
+ import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as n}from"../lib/Material.js";import{writePosition2d as a,writeBufferFloat as o}from"./internal/bufferWriterUtils.js";import{attributeDrivenInstanceLayout as u,instanceLayout as c,HeatmapDensityPassParameters as l,HeatmapDensityTechnique as f,baseLayout as p}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as m}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const h=2;class d extends l{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class g extends n{constructor(t){super(t,d),this.geometryType=1,this.visible=!0,this.produces=new Map([[18,t=>s(t)]]),this.intersectScreenPolygonDraped=void 0,this._configuration=new m}updateConfiguration(t){super.updateConfiguration(t),this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats}createGLMaterial(t){return new b(t)}intersectRay(){}intersectRayDraped(r,s,i,n,a){const o=r.attributes.get("position"),{parameters:u}=this,{searchRadius:c}=u,{screenToWorldRatio:l}=r,f=c*l+h*l,p=f*f,m=o.data.length/o.size;for(let h=0;h<m;h++){const r=h*o.size,s=t(v,o.data[r],o.data[r+1]);e(s,i)<p&&n(a.distance,a.renderDistance,a.normal,-1)}}intersectScreenPolygon(){return null}createBufferWriter(){return new y(this.parameters.isAttributeDriven?u:c)}}class b extends i{beginSlot(t){return this.getTechnique(f,t)}}class y{constructor(t){this.layout=t,this.baseInstanceLayout=p}elementCount(t){return t.get("position").indices.length}elementCountBaseInstance(){return 4}write(t,e,r,s){if(null==s)return;const{buffer:i,offset:n}=s;a(r.get("position"),t,i.position,n);const u="featureAttribute"in i?i.featureAttribute:null;u&&o(r.get("featureAttribute"),u,n)}writeBaseInstance(t,e){const r=e.uv0;r.setValues(0,-1,-1),r.setValues(1,-1,1),r.setValues(2,1,-1),r.setValues(3,1,1)}}const v=r();export{g as HeatmapDensityMaterial,d as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as s,MaterialParameters as n}from"../lib/Material.js";import{writeBufferVec2 as a,writePosition as o,writeNormal as c,writeBufferVec3 as l,writeBufferFloat as u}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h,layout as f,baseLayout as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as d}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class m extends s{constructor(e,t){super(e,$),this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this.produces=new Map([[15,e=>r(e)],[16,e=>r(e)]]),this._configuration=new d(t),this._uniqueMaterialIdentifier=S(this.parameters)}passParameters(){return this.parameters}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=16===e.slot,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane}get visible(){return this.parameters.color[3]>=g||(this.parameters.borderColor?.[3]??0)>=g}intersectRay(){}intersectScreenPolygon(){return null}createGLMaterial(e){return new O(e)}createBufferWriter(){return new b}validateParameters(e){this._uniqueMaterialIdentifier=S(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function S({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,shaderPolygonOffset:a,hudDepthAlignStart:o,centerOffsetUnits:c,hasSlicePlane:l,screenSizePerspective:u,verticalOffset:h,borderColor:f}){return e`${t}:${r}:${i}:[${s}]:${n}:${a}:${o}:${c}:${l}:${null!=u}:{${h?.screenLength}:${h?.minWorldLength}:${h?.maxWorldLength}}:[${f}]`}class O extends i{beginSlot(e){return this.getTechnique(h,e)}}class $ extends n{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=t(0,0,0,1),this.size=1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}class b{constructor(){this.layout=f,this.baseInstanceLayout=p}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}writeBaseInstance(e,t){const{uv0:r}=t;a(e.get("uv0"),r,0)}write(e,t,r,i){if(null==i)return;const{buffer:s,offset:n}=i;o(r.get("position"),e,s.position,n),c(r.get("normal"),t,s.normal,n),l(r.get("centerOffset"),s.centerOffset,n),u(r.get("groundDistance"),s.groundDistance,n)}}export{m as LineCalloutMaterial,$ as Parameters,S as uniqueMaterialIdentifier};
2
+ import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as s,MaterialParameters as n}from"../lib/Material.js";import{writeBufferVec2 as a,writePosition as o,writeNormal as c,writeBufferVec3 as l,writeBufferFloat as u}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h,layout as f,baseLayout as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as d}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class m extends s{constructor(e,t){super(e,$),this.geometryType=1,this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this.produces=new Map([[15,e=>r(e)],[16,e=>r(e)]]),this._configuration=new d(t),this._uniqueMaterialIdentifier=S(this.parameters)}passParameters(){return this.parameters}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=16===e.slot,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane}get visible(){return this.parameters.color[3]>=g||(this.parameters.borderColor?.[3]??0)>=g}intersectRay(){}intersectScreenPolygon(){return null}createGLMaterial(e){return new O(e)}createBufferWriter(){return new b}validateParameters(e){this._uniqueMaterialIdentifier=S(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function S({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,shaderPolygonOffset:a,hudDepthAlignStart:o,centerOffsetUnits:c,hasSlicePlane:l,screenSizePerspective:u,verticalOffset:h,borderColor:f}){return e`${t}:${r}:${i}:[${s}]:${n}:${a}:${o}:${c}:${l}:${null!=u}:{${h?.screenLength}:${h?.minWorldLength}:${h?.maxWorldLength}}:[${f}]`}class O extends i{beginSlot(e){return this.getTechnique(h,e)}}class $ extends n{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=t(0,0,0,1),this.size=1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}class b{constructor(){this.layout=f,this.baseInstanceLayout=p}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}writeBaseInstance(e,t){const{uv0:r}=t;a(e.get("uv0"),r,0)}write(e,t,r,i){if(null==i)return;const{buffer:s,offset:n}=i;o(r.get("position"),e,s.position,n),c(r.get("normal"),t,s.normal,n),l(r.get("centerOffset"),s.centerOffset,n),u(r.get("groundDistance"),s.groundDistance,n)}}export{m as LineCalloutMaterial,$ as Parameters,S as uniqueMaterialIdentifier};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as e,equals as t,transformMat4 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{makeFloat16Array as s}from"../../../../geometry/support/float16.js";import{isColor as a,isDepth as o,isColorHighlightOLIDOrDepth as n}from"../core/shaderLibrary/ShaderOutput.js";import h from"../lib/GLMaterial.js";import{Material as c}from"../lib/Material.js";import{VisualVariablePassParameters as l}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as m}from"./internal/bufferWriterUtils.js";import{getLayout as p,LineMarkerTechnique as u}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d}from"../shaders/LineMarkerTechniqueConfiguration.js";import{alphaCutoff as f}from"../../../../webscene/support/AlphaCutoff.js";class g extends c{constructor(e,t){super(e,v),this.produces=new Map([[2,e=>10===e||a(e)&&8===this.parameters.renderOccluded],[3,e=>o(e)],[10,e=>n(e)&&8===this.parameters.renderOccluded],[11,e=>n(e)&&8===this.parameters.renderOccluded],[4,e=>a(e)],[18,e=>a(e)||10===e]]),this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this._configuration=new d(t)}updateConfiguration(e){super.updateConfiguration(e),this._configuration.space=18===e.slot?0:this.parameters.worldSpace?2:1,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=0!==this.parameters.cap,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=e.hasOccludees,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective}get visible(){return this.parameters.color[3]>=f}intersectRay(){}intersectScreenPolygon(){return null}createBufferWriter(){return new S(p(this.parameters),this.parameters)}createGLMaterial(e){return new _(e)}}class _ extends h{dispose(){super.dispose(),this._markerTextures?.release(this._markerPrimitive),this._markerPrimitive=null}beginSlot(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this.getTechnique(u,e)}}class v extends l{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=0,this.anchor=0,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.stipplePattern=null,this.markerTexture=null}}class S{constructor(e,t){this.layout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,a,o,n){if(null==n)return;const{buffer:h,offset:c}=n,l=o.get("position").data,p=l.length/3;let u=[1,0,0];const d=o.get("normal");this._parameters.worldSpace&&null!=d&&(u=d.data);let f=1,g=0;this._parameters.vvSize?g=o.get("sizeFeatureAttribute").data[0]:o.has("size")&&(f=o.get("size").data[0]);let _=[1,1,1,1],v=0;this._parameters.vvColor?v=o.get("colorFeatureAttribute").data[0]:o.has("color")&&(_=o.get("color").data);let S=0;this._parameters.vvOpacity&&(S=o.get("opacityFeatureAttribute").data[0]);const w=new Float32Array(h.buffer),y=s(h.buffer),O=new Uint8Array(h.buffer);let T=c*(this.layout.stride/4);const V=w.BYTES_PER_ELEMENT/y.BYTES_PER_ELEMENT,k=4/V,j=(e,t,r,i)=>{w[T++]=e[0],w[T++]=e[1],w[T++]=e[2],m(t,e,y,T*V),T+=k;let s=T*V;if(y[s++]=r[0],y[s++]=r[1],T=Math.ceil(s/V),this._parameters.vvColor)w[T++]=v;else{const e=Math.min(4*i,_.length-4),t=4*T++;O[t]=255*_[e],O[t+1]=255*_[e+1],O[t+2]=255*_[e+2],O[t+3]=255*_[e+3]}this._parameters.vvOpacity&&(w[T++]=S),s=T*V,this._parameters.vvSize?(w[T++]=g,s+=2):y[s++]=f,this._parameters.worldSpace&&(y[s++]=u[0],y[s++]=u[1],y[s++]=u[2]),T=Math.ceil(s/V)},M=(s,a)=>{const o=e(b,l[3*s],l[3*s+1],l[3*s+2]),n=P;let h=s+a;do{e(n,l[3*h],l[3*h+1],l[3*h+2]),h+=a}while(t(o,n)&&h>=0&&h<p);i&&(r(o,o,i),r(n,n,i)),j(o,n,[-1,-1],s),j(o,n,[1,-1],s),j(o,n,[1,1],s),j(o,n,[-1,-1],s),j(o,n,[1,1],s),j(o,n,[-1,1],s)},x=this._parameters.placement;"begin"!==x&&"begin-end"!==x||M(0,1),"end"!==x&&"begin-end"!==x||M(p-1,-1)}}const b=i(),P=i();export{g as LineMarkerMaterial,v as Parameters};
2
+ import{set as e,equals as t,transformMat4 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{makeFloat16Array as s}from"../../../../geometry/support/float16.js";import{isColor as a,isDepth as o,isColorHighlightOLIDOrDepth as n}from"../core/shaderLibrary/ShaderOutput.js";import h from"../lib/GLMaterial.js";import{Material as c}from"../lib/Material.js";import{VisualVariablePassParameters as l}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as m}from"./internal/bufferWriterUtils.js";import{getLayout as p,LineMarkerTechnique as u}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d}from"../shaders/LineMarkerTechniqueConfiguration.js";import{alphaCutoff as f}from"../../../../webscene/support/AlphaCutoff.js";class g extends c{constructor(e,t){super(e,v),this.geometryType=2,this.produces=new Map([[2,e=>10===e||a(e)&&8===this.parameters.renderOccluded],[3,e=>o(e)],[10,e=>n(e)&&8===this.parameters.renderOccluded],[11,e=>n(e)&&8===this.parameters.renderOccluded],[4,e=>a(e)],[18,e=>a(e)||10===e]]),this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this._configuration=new d(t)}updateConfiguration(e){super.updateConfiguration(e),this._configuration.space=18===e.slot?0:this.parameters.worldSpace?2:1,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=0!==this.parameters.cap,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=e.hasOccludees,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective}get visible(){return this.parameters.color[3]>=f}intersectRay(){}intersectScreenPolygon(){return null}createBufferWriter(){return new S(p(this.parameters),this.parameters)}createGLMaterial(e){return new _(e)}}class _ extends h{dispose(){super.dispose(),this._markerTextures?.release(this._markerPrimitive),this._markerPrimitive=null}beginSlot(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this.getTechnique(u,e)}}class v extends l{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=0,this.anchor=0,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.stipplePattern=null,this.markerTexture=null}}class S{constructor(e,t){this.layout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,a,o,n){if(null==n)return;const{buffer:h,offset:c}=n,l=o.get("position").data,p=l.length/3;let u=[1,0,0];const d=o.get("normal");this._parameters.worldSpace&&null!=d&&(u=d.data);let f=1,g=0;this._parameters.vvSize?g=o.get("sizeFeatureAttribute").data[0]:o.has("size")&&(f=o.get("size").data[0]);let _=[1,1,1,1],v=0;this._parameters.vvColor?v=o.get("colorFeatureAttribute").data[0]:o.has("color")&&(_=o.get("color").data);let S=0;this._parameters.vvOpacity&&(S=o.get("opacityFeatureAttribute").data[0]);const y=new Float32Array(h.buffer),w=s(h.buffer),T=new Uint8Array(h.buffer);let O=c*(this.layout.stride/4);const V=y.BYTES_PER_ELEMENT/w.BYTES_PER_ELEMENT,k=4/V,j=(e,t,r,i)=>{y[O++]=e[0],y[O++]=e[1],y[O++]=e[2],m(t,e,w,O*V),O+=k;let s=O*V;if(w[s++]=r[0],w[s++]=r[1],O=Math.ceil(s/V),this._parameters.vvColor)y[O++]=v;else{const e=Math.min(4*i,_.length-4),t=4*O++;T[t]=255*_[e],T[t+1]=255*_[e+1],T[t+2]=255*_[e+2],T[t+3]=255*_[e+3]}this._parameters.vvOpacity&&(y[O++]=S),s=O*V,this._parameters.vvSize?(y[O++]=g,s+=2):w[s++]=f,this._parameters.worldSpace&&(w[s++]=u[0],w[s++]=u[1],w[s++]=u[2]),O=Math.ceil(s/V)},M=(s,a)=>{const o=e(b,l[3*s],l[3*s+1],l[3*s+2]),n=P;let h=s+a;do{e(n,l[3*h],l[3*h+1],l[3*h+2]),h+=a}while(t(o,n)&&h>=0&&h<p);i&&(r(o,o,i),r(n,n,i)),j(o,n,[-1,-1],s),j(o,n,[1,-1],s),j(o,n,[1,1],s),j(o,n,[-1,-1],s),j(o,n,[1,1],s),j(o,n,[-1,1],s)},x=this._parameters.placement;"begin"!==x&&"begin-end"!==x||M(0,1),"end"!==x&&"begin-end"!==x||M(p-1,-1)}}const b=i(),P=i();export{g as LineMarkerMaterial,v as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as t,normalize as e,subtract as r,cross as s,distance as o,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as c}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{Material as u,MaterialParameters as p}from"../lib/Material.js";import{MeasurementArrowTechnique as f,layout as h}from"../shaders/MeasurementArrowTechnique.js";import{MeasurementArrowTechniqueConfiguration as m}from"../shaders/MeasurementArrowTechniqueConfiguration.js";import{alphaCutoff as d}from"../../../../webscene/support/AlphaCutoff.js";class g extends u{constructor(t){super(t,b),this._configuration=new m,this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this.produces=new Map([[2,t=>!this._transparent&&c(t)],[8,t=>this._transparent&&c(t)]])}updateConfiguration(t){super.updateConfiguration(t),this._configuration.enableOITOffset=t.enableOITOffset,this._configuration.transparent=this._transparent,this._configuration.writeDepth=2===t.slot}get visible(){const{outlineColor:t,stripeEvenColor:e,stripeOddColor:r}=this.parameters;return t[3]>=d||e[3]>=d||r[3]>=d}intersectRay(){}intersectScreenPolygon(){return null}createGLMaterial(t){return new C(t)}createBufferWriter(){return new _}get _transparent(){const{parameters:t}=this;return t.outlineColor[3]<1||t.stripeEvenColor[3]<1||t.stripeOddColor[3]<1}}class C extends l{beginSlot(t){return this.getTechnique(f,t)}}class b extends p{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=a(1,.5,0,1),this.stripeEvenColor=a(1,1,1,1),this.stripeOddColor=a(1,.5,0,1),this.stripeLength=1}}const w=n(),v=n(),j=n(),M=n(),O=n();class _{constructor(){this.layout=h}elementCount(t){return 2*(t.get("position").indices.length/2+1)}write(n,a,c,l){if(null==l)return;const{buffer:u,offset:p}=l,{data:f,indices:h}=c.get("position"),m=c.get("normal").data,d=f.length/3;h&&h.length!==2*(d-1)&&console.warn("MeasurementArrowMaterial does not support indices");const g=w,C=v,b=j,_=M,x=O,y=u.position,S=u.normal,T=u.uv0;let A=0;for(let w=0;w<d;++w){const c=3*w;if(t(g,f[c],f[c+1],f[c+2]),w<d-1){const o=3*(w+1);t(C,f[o],f[o+1],f[o+2]),t(x,m[o],m[o+1],m[o+2]),e(x,x),r(b,C,g),e(b,b),s(_,x,b),e(_,_)}const l=o(g,C);n&&a&&(i(g,g,n),i(C,C,n),i(_,_,a));const u=p+2*w,h=u+1;y.setVec(u,g),y.setVec(h,g),S.setVec(u,_),S.setVec(h,_),T.set(u,0,A),T.set(u,1,-1),T.set(h,0,A),T.set(h,1,1),w<d-1&&(A+=l)}const L=u.length;for(let t=0;t<2*d;++t)L.set(p+t,A)}}export{g as MeasurementArrowMaterial,b as Parameters};
2
+ import{set as t,normalize as e,subtract as r,cross as s,distance as o,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as c}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{Material as u,MaterialParameters as p}from"../lib/Material.js";import{MeasurementArrowTechnique as h,layout as f}from"../shaders/MeasurementArrowTechnique.js";import{MeasurementArrowTechniqueConfiguration as m}from"../shaders/MeasurementArrowTechniqueConfiguration.js";import{alphaCutoff as d}from"../../../../webscene/support/AlphaCutoff.js";class g extends u{constructor(t){super(t,b),this._configuration=new m,this.geometryType=2,this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this.produces=new Map([[2,t=>!this._transparent&&c(t)],[8,t=>this._transparent&&c(t)]])}updateConfiguration(t){super.updateConfiguration(t),this._configuration.enableOITOffset=t.enableOITOffset,this._configuration.transparent=this._transparent,this._configuration.writeDepth=2===t.slot}get visible(){const{outlineColor:t,stripeEvenColor:e,stripeOddColor:r}=this.parameters;return t[3]>=d||e[3]>=d||r[3]>=d}intersectRay(){}intersectScreenPolygon(){return null}createGLMaterial(t){return new C(t)}createBufferWriter(){return new O}get _transparent(){const{parameters:t}=this;return t.outlineColor[3]<1||t.stripeEvenColor[3]<1||t.stripeOddColor[3]<1}}class C extends l{beginSlot(t){return this.getTechnique(h,t)}}class b extends p{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=a(1,.5,0,1),this.stripeEvenColor=a(1,1,1,1),this.stripeOddColor=a(1,.5,0,1),this.stripeLength=1}}const w=n(),v=n(),j=n(),y=n(),M=n();class O{constructor(){this.layout=f}elementCount(t){return 2*(t.get("position").indices.length/2+1)}write(n,a,c,l){if(null==l)return;const{buffer:u,offset:p}=l,{data:h,indices:f}=c.get("position"),m=c.get("normal").data,d=h.length/3;f&&f.length!==2*(d-1)&&console.warn("MeasurementArrowMaterial does not support indices");const g=w,C=v,b=j,O=y,_=M,x=u.position,T=u.normal,S=u.uv0;let A=0;for(let w=0;w<d;++w){const c=3*w;if(t(g,h[c],h[c+1],h[c+2]),w<d-1){const o=3*(w+1);t(C,h[o],h[o+1],h[o+2]),t(_,m[o],m[o+1],m[o+2]),e(_,_),r(b,C,g),e(b,b),s(O,_,b),e(O,O)}const l=o(g,C);n&&a&&(i(g,g,n),i(C,C,n),i(O,O,a));const u=p+2*w,f=u+1;x.setVec(u,g),x.setVec(f,g),T.setVec(u,O),T.setVec(f,O),S.set(u,0,A),S.set(u,1,-1),S.set(f,0,A),S.set(f,1,1),w<d-1&&(A+=l)}const L=u.length;for(let t=0;t<2*d;++t)L.set(p+t,A)}}export{g as MeasurementArrowMaterial,b as Parameters};
@@ -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 r}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as t,createScreenPointArray as o}from"../../../../core/screenUtils.js";import{copy as i,set as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as a,subtract as c,dot as l,scale as f,add as m,copy as u,length as p,distance as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as d}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{distance2 as j,fromPoints as b,closestLineSegmentPoint as y,projectPoint as v,create as x}from"../../../../geometry/support/lineSegment.js";import{fromPoints as S,signedDistance as L,getNormal as w,create as M}from"../../../../geometry/support/plane.js";import{isColorHighlightOrOLID as P}from"../core/shaderLibrary/ShaderOutput.js";import T from"../lib/GLMaterial.js";import{Material as C,MaterialParameters as R}from"../lib/Material.js";import{projectWorldLineSegmentToRenderScreen as V,screenPolygonIntersectsBufferedSegment as _}from"../lib/screenPolygonOverlapUtils.js";import{Hit as A,DrapedHit as N}from"../lib/screenPolygonTriangleIntersections.js";import{isTranslationMatrix as U}from"../lib/Util.js";import{DefaultBufferWriter as D}from"./DefaultBufferWriter.js";import{PositionColorLayout as E,PositionLayout as O}from"./DefaultLayouts.js";import{NativeLineTechnique as q}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as B}from"../shaders/NativeLineTechniqueConfiguration.js";import{alphaCutoff as W}from"../../../../webscene/support/AlphaCutoff.js";class X extends C{constructor(e){super(e,k),this._configuration=new B,this.produces=new Map([[2,e=>P(e)]])}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.hasOccludees=e.hasOccludees}get visible(){return this.parameters.color[3]>=W}intersectRay(r,t,o,s,n,h){const{options:d,camera:v,rayBegin:x,rayEnd:M}=o;if(!d.selectionMode||!r.visible||!v)return;if(!U(t))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const P=r.attributes.get("position").data,T=oe;i(T,o.point);const C=ge*v.pixelRatio;a(ce[0],T[0]-C,T[1]+C,0),a(ce[1],T[0]+C,T[1]+C,0),a(ce[2],T[0]+C,T[1]-C,0),a(ce[3],T[0]-C,T[1]-C,0);for(let e=0;e<4;e++)if(!v.unprojectFromRenderScreen(ce[e],le[e]))return;S(v.eye,le[0],le[1],fe),S(v.eye,le[1],le[2],me),S(v.eye,le[2],le[3],ue),S(v.eye,le[3],le[0],pe);let R=Number.MAX_VALUE,V=0;for(const e of G(H,J,P,t)){if(L(fe,H)<0&&L(fe,J)<0||L(me,H)<0&&L(me,J)<0||L(ue,H)<0&&L(ue,J)<0||L(pe,H)<0&&L(pe,J)<0)continue;const r=v.projectToRenderScreen(H,Y),t=v.projectToRenderScreen(J,Z);if(null==r||null==t)continue;if(r[2]<0&&t[2]>0){c(K,H,J);const e=v.frustum,t=-L(e[4],H)/l(K,w(e[4]));if(f(K,K,t),m(H,H,K),!v.projectToRenderScreen(H,r))continue}else if(r[2]>0&&t[2]<0){c(K,J,H);const e=v.frustum,r=-L(e[4],J)/l(K,w(e[4]));if(f(K,K,r),m(J,J,K),!v.projectToRenderScreen(J,t))continue}else if(r[2]<0&&t[2]<0)continue;r[2]=0,t[2]=0;const o=j(b(r,t,re),T);o<R&&(R=o,u($,H),u(ee,J),V=e)}if(R<C*C){let e=Number.MAX_VALUE;if(y(b($,ee,re),b(x,M,te),Q)){c(Q,Q,x);const r=p(Q);f(Q,Q,1/r),e=r/g(x,M)}h(e,e,Q,V)}}intersectScreenPolygon(r,t,o,i){const{options:s,camera:n,screenPolygonPrimitiveProcessor:a}=o;if(!s.selectionMode||!r.visible)return null;if(!U(t))return e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix"),null;const c=r.attributes.get("position").data,l=new A(4);for(const e of G(H,J,c,t))for(const[r,t]of a.processLineSegment(he,H,J))V(n,r,t,Y,Z)&&(n.renderToScreen(Y,ie),n.renderToScreen(Z,se),_(i,ie,se,ge)&&(v(b(r,t,te),n.eye,oe),l.updateIfCloserFromValues(g(n.eye,oe),e,oe,null)));return l}intersectRayDraped(e,t,o,i,s){if(!t.options.selectionMode)return;const n=o[0],a=o[1],c=I(e);let l=Number.MAX_VALUE,f=0;for(const m of z(ne,ae,e)){const e=n-ne[0],t=a-ne[1],o=ae[0]-ne[0],i=ae[1]-ne[1],s=r((o*e+i*t)/(o*o+i*i),0,1),c=o*s-e,u=i*s-t,p=c*c+u*u;p<l&&(l=p,f=m)}l<c*c&&i(s.distance,s.renderDistance,s.normal,f)}intersectScreenPolygonDraped(e,r,t,o){if(!t.options.selectionMode)return null;const i=I(e);for(const s of z(ne,ae,e,r))if(_(o,ne,ae,i))return new N(s);return null}createGLMaterial(e){return new F(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?E:O;return new D(e)}}class F extends T{beginSlot(e){return this.getTechnique(q,e)}}function*G(e,r,t,o){for(let i=0;i<t.length-5;i+=3)e[0]=t[i]+o[12],e[1]=t[i+1]+o[13],e[2]=t[i+2]+o[14],r[0]=t[i+3]+o[12],r[1]=t[i+4]+o[13],r[2]=t[i+5]+o[14],yield i/3}function I(e){const r=e.attributes.get("size");return(((r?r.data[0]:0)+1)/2+4)*e.screenToWorldRatio}function*z(e,r,t,o){const n=t.attributes.get("position").data,a=o?.[0]??0,c=o?.[1]??0;s(e,n[0]+a,n[1]+c);for(let l=3;l<n.length-2;l+=3){const t=l%n.length;s(r,n[t]+a,n[t+1]+c),yield l/3,i(e,r)}}class k extends R{constructor(){super(...arguments),this.color=d,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1}}const H=h(),J=h(),K=h(),Q=h(),Y=t(),Z=t(),$=h(),ee=h(),re=x(),te=x(),oe=h(),ie=o(),se=o(),ne=n(),ae=n(),ce=[t(),t(),t(),t()],le=[h(),h(),h(),h()],fe=M(),me=M(),ue=M(),pe=M(),ge=2,he=[h(),h()];export{X as NativeLineMaterial,k as Parameters};
2
+ import e from"../../../../core/Logger.js";import{clamp as r}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as t,createScreenPointArray as o}from"../../../../core/screenUtils.js";import{copy as i,set as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as a,subtract as c,dot as l,scale as f,add as m,copy as u,length as p,distance as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as d}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{distance2 as j,fromPoints as y,closestLineSegmentPoint as b,projectPoint as v,create as x}from"../../../../geometry/support/lineSegment.js";import{fromPoints as S,signedDistance as L,getNormal as w,create as M}from"../../../../geometry/support/plane.js";import{isColorHighlightOrOLID as T}from"../core/shaderLibrary/ShaderOutput.js";import P from"../lib/GLMaterial.js";import{Material as C,MaterialParameters as R}from"../lib/Material.js";import{projectWorldLineSegmentToRenderScreen as V,screenPolygonIntersectsBufferedSegment as _}from"../lib/screenPolygonOverlapUtils.js";import{Hit as A,DrapedHit as N}from"../lib/screenPolygonTriangleIntersections.js";import{isTranslationMatrix as U}from"../lib/Util.js";import{DefaultBufferWriter as D}from"./DefaultBufferWriter.js";import{PositionColorLayout as E,PositionLayout as O}from"./DefaultLayouts.js";import{NativeLineTechnique as q}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as B}from"../shaders/NativeLineTechniqueConfiguration.js";import{alphaCutoff as W}from"../../../../webscene/support/AlphaCutoff.js";class X extends C{constructor(e){super(e,k),this._configuration=new B,this.geometryType=2,this.produces=new Map([[2,e=>T(e)]])}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.hasOccludees=e.hasOccludees}get visible(){return this.parameters.color[3]>=W}intersectRay(r,t,o,s,n,h){const{options:d,camera:v,rayBegin:x,rayEnd:M}=o;if(!d.selectionMode||!r.visible||!v)return;if(!U(t))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const T=r.attributes.get("position").data,P=oe;i(P,o.point);const C=ge*v.pixelRatio;a(ce[0],P[0]-C,P[1]+C,0),a(ce[1],P[0]+C,P[1]+C,0),a(ce[2],P[0]+C,P[1]-C,0),a(ce[3],P[0]-C,P[1]-C,0);for(let e=0;e<4;e++)if(!v.unprojectFromRenderScreen(ce[e],le[e]))return;S(v.eye,le[0],le[1],fe),S(v.eye,le[1],le[2],me),S(v.eye,le[2],le[3],ue),S(v.eye,le[3],le[0],pe);let R=Number.MAX_VALUE,V=0;for(const e of G(H,J,T,t)){if(L(fe,H)<0&&L(fe,J)<0||L(me,H)<0&&L(me,J)<0||L(ue,H)<0&&L(ue,J)<0||L(pe,H)<0&&L(pe,J)<0)continue;const r=v.projectToRenderScreen(H,Y),t=v.projectToRenderScreen(J,Z);if(null==r||null==t)continue;if(r[2]<0&&t[2]>0){c(K,H,J);const e=v.frustum,t=-L(e[4],H)/l(K,w(e[4]));if(f(K,K,t),m(H,H,K),!v.projectToRenderScreen(H,r))continue}else if(r[2]>0&&t[2]<0){c(K,J,H);const e=v.frustum,r=-L(e[4],J)/l(K,w(e[4]));if(f(K,K,r),m(J,J,K),!v.projectToRenderScreen(J,t))continue}else if(r[2]<0&&t[2]<0)continue;r[2]=0,t[2]=0;const o=j(y(r,t,re),P);o<R&&(R=o,u($,H),u(ee,J),V=e)}if(R<C*C){let e=Number.MAX_VALUE;if(b(y($,ee,re),y(x,M,te),Q)){c(Q,Q,x);const r=p(Q);f(Q,Q,1/r),e=r/g(x,M)}h(e,e,Q,V)}}intersectScreenPolygon(r,t,o,i){const{options:s,camera:n,screenPolygonPrimitiveProcessor:a}=o;if(!s.selectionMode||!r.visible)return null;if(!U(t))return e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix"),null;const c=r.attributes.get("position").data,l=new A(4);for(const e of G(H,J,c,t))for(const[r,t]of a.processLineSegment(he,H,J))V(n,r,t,Y,Z)&&(n.renderToScreen(Y,ie),n.renderToScreen(Z,se),_(i,ie,se,ge)&&(v(y(r,t,te),n.eye,oe),l.updateIfCloserFromValues(g(n.eye,oe),e,oe,null)));return l}intersectRayDraped(e,t,o,i,s){if(!t.options.selectionMode)return;const n=o[0],a=o[1],c=I(e);let l=Number.MAX_VALUE,f=0;for(const m of z(ne,ae,e)){const e=n-ne[0],t=a-ne[1],o=ae[0]-ne[0],i=ae[1]-ne[1],s=r((o*e+i*t)/(o*o+i*i),0,1),c=o*s-e,u=i*s-t,p=c*c+u*u;p<l&&(l=p,f=m)}l<c*c&&i(s.distance,s.renderDistance,s.normal,f)}intersectScreenPolygonDraped(e,r,t,o){if(!t.options.selectionMode)return null;const i=I(e);for(const s of z(ne,ae,e,r))if(_(o,ne,ae,i))return new N(s);return null}createGLMaterial(e){return new F(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?E:O;return new D(e)}}class F extends P{beginSlot(e){return this.getTechnique(q,e)}}function*G(e,r,t,o){for(let i=0;i<t.length-5;i+=3)e[0]=t[i]+o[12],e[1]=t[i+1]+o[13],e[2]=t[i+2]+o[14],r[0]=t[i+3]+o[12],r[1]=t[i+4]+o[13],r[2]=t[i+5]+o[14],yield i/3}function I(e){const r=e.attributes.get("size");return(((r?r.data[0]:0)+1)/2+4)*e.screenToWorldRatio}function*z(e,r,t,o){const n=t.attributes.get("position").data,a=o?.[0]??0,c=o?.[1]??0;s(e,n[0]+a,n[1]+c);for(let l=3;l<n.length-2;l+=3){const t=l%n.length;s(r,n[t]+a,n[t+1]+c),yield l/3,i(e,r)}}class k extends R{constructor(){super(...arguments),this.color=d,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1}}const H=h(),J=h(),K=h(),Q=h(),Y=t(),Z=t(),$=h(),ee=h(),re=x(),te=x(),oe=h(),ie=o(),se=o(),ne=n(),ae=n(),ce=[t(),t(),t(),t()],le=[h(),h(),h(),h()],fe=M(),me=M(),ue=M(),pe=M(),ge=2,he=[h(),h()];export{X as NativeLineMaterial,k as Parameters};
@@ -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 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{fromPoints as w,distance2 as E,closestLineSegmentPoint as x,projectPoint as T,projectPointFraction as j,create as L}from"../../../../geometry/support/lineSegment.js";import{fromPoints as z,signedDistance as C,getNormal as A,create 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{writeColor 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.renderDistance,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),T=Le;o(T,i.point);const j=v*_.pixelRatio,L=Je*_.pixelRatio,M=j/2+L;c(Ie[0],T[0]-M,T[1]+M,0),c(Ie[1],T[0]+M,T[1]+M,0),c(Ie[2],T[0]+M,T[1]-M,0),c(Ie[3],T[0]-M,T[1]-M,0);for(let e=0;e<4;e++)if(!_.unprojectFromRenderScreen(Ie[e],Ne[e]))return;z(_.eye,Ne[0],Ne[1],We),z(_.eye,Ne[1],Ne[2],ke),z(_.eye,Ne[2],Ne[3],De),z(_.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(C(We,Se)<0&&C(We,Pe)<0||C(ke,Se)<0&&C(ke,Pe)<0||C(De,Se)<0&&C(De,Pe)<0||C(Ye,Se)<0&&C(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=-C(e[4],Se)/u(Te,A(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=-C(e[4],Pe)/u(Te,A(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=w(t,r,Fe),s=E(i,T);if(!(s>=R)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(i,Se,Pe,T,_,v,L);if(s>=e*e)continue}R=s,f(Re,Se),f(Ve,Pe),V=e}}if(R<M*M){let e=Number.MAX_VALUE;if(x(w(Re,Ve,Fe),w(b,S,Oe),je)){p(je,je,b);const t=d(je);m(je,je,1/t),e=t/g(b,S)}a(e,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=w(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)&&(T(w(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=j(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){null!=n&&this._writeTextureBuffer(e,r,n),null!=i&&this._writeVertexBuffer(e,r,i,s)}_writeTextureBuffer(e,t,r){const i=t.get("position"),s=i.data.length/3,n=this._isClosed(t),{buffer:o,offset:a}=r,l=o.getField("position",R),c=o.getField("u0",V),p=o.getField("sizeFeatureAttribute",V),u=o.getField("size",V),m=o.getField("colorFeatureAttribute",V),h=o.getField("color",F),d=o.getField("olidColor",F),_=o.getField("timeStamps",O),b=o.getField("opacityFeatureAttribute",V),S=t.get("sizeFeatureAttribute")?.data,P=t.get("size")?.data,y=t.get("colorFeatureAttribute")?.data,v=t.get("color")?.data,w=t.get("opacityFeatureAttribute")?.data,E=t.get("distanceToStart")?.data,x=t.get("timeStamps");Z(null!==l,"Expected valid position field in texture buffer"),Z(null!==c,"Expected valid u0 field in texture buffer");let T=0;for(let L=0;L<s;++L){this._getTransformedPosition(Ue,i.data,L,e),L>0&&(null!=E?T=E[L]??T:T+=g(Be,Ue));const t=a+L+1;if(l.setVec(t,Ue),c.set(t,T),f(Be,Ue),p&&p.set(t,1===S?.length?S[0]:S?.[L]??0),u&&u.set(t,1===P?.length?P[0]:P?.[L]??1),m&&m.set(t,1===y?.length?y[0]:y?.[L]??0),h)if(null!=v){const e=Math.min(4*L,v.length-4);h.setValues(t,v[e],v[e+1],v[e+2],v[e+3])}else h.setValues(t,1,1,1,1);b&&b.set(t,1===w?.length?w[0]:w?.[L]??0)}if(null!=_&&null!=x){Z(4===x.size);const e=x.data;for(let t=0;t<s;++t){const r=4*t,i=a+t+1;_.set(i,0,e[r]),_.set(i,1,e[r+1]),_.set(i,2,e[r+2]),_.set(i,3,e[r+3])}}if(n){const e=a,t=a+1,r=a+2,i=a+s,n=i+1,p=i+2;o.copyItem(i,e),o.copyItem(t,n),o.copyItem(r,p),l.getVec(i,Be),l.getVec(t,Ue);const u=T+g(Be,Ue);c.set(n,u)}else{const e=a,t=a+1,r=a+s,i=r+1;o.copyItem(t,e),o.copyItem(r,i)}const j=t.get("olidColor");D()&&null!=j&&null!=d&&te(j,4,d,a)}_writeVertexBuffer(e,t,r,i){const{buffer:s,offset:n}=r,{layout:o}=this,a=t.get("position"),l=a.indices,c=a.data.length/3,p=this._isClosed(t),u=c+(p?3:2);l&&l.length!==2*(c-1)&&console.warn("RibbonLineMaterial does not support indices");const m=s.getField("textureElementIndex",B);Z(null!=m,"Missing texture buffer index field"),Z(null!=i,"Using a texture layout, but the texture range for this instance was not provided");const h=i.from;Z(i.numElements===u,"Expected number of elements in TextureBuffer to equal number of points");const f=new Float32Array(s.buffer),d=v(s.buffer),g=new Uint32Array(s.buffer),_=o.stride/4;let b=n*_;const S=b,P=f.BYTES_PER_ELEMENT/d.BYTES_PER_ELEMENT,y=(e,t,r)=>{const i=r+1;g[b]=h+i,b++;let s=b*P;d[s++]=e,d[s++]=t,b=Math.ceil(s/P)};b+=_;let w=0,E=0;p?(w=0,E=c):(y(1,-4,0),y(1,4,0),w=1,E=c-1);for(let v=w;v<E;v++){y(0,-1,v),y(0,1,v);const e=this.numJoinSubdivisions;for(let t=0;t<e;++t){const r=(t+1)/(e+1);y(r,-1,v),y(r,1,v)}y(1,-2,v),y(1,2,v)}p?(y(0,-1,E),y(0,1,E)):(y(0,-5,E),y(0,5,E)),me(f,S+_,f,S,_);b=me(f,b-_,f,b,_),this._parameters.wireframe&&this._addWireframeVertices(s,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=L(),Oe=L(),Be=P(),Ue=P(),Ie=[r(),r(),r(),r()],Ne=[P(),P(),P(),P()],We=M(),ke=M(),De=M(),Ye=M(),Je=4,qe=[P(),P()];export{pe as Parameters,le 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 y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as P}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as v}from"../../../../geometry/support/float16.js";import{fromPoints as w,distance2 as E,closestLineSegmentPoint as x,projectPoint as T,projectPointFraction as j,create as L}from"../../../../geometry/support/lineSegment.js";import{fromPoints as z,signedDistance as C,getNormal as A,create 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{writeColor as te}from"./internal/bufferWriterUtils.js";import{n 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.geometryType=2,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(Pe,ve,this.parameters,e)){const e=l-Pe[0],r=c-Pe[1],i=ve[0]-Pe[0],s=ve[1]-Pe[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.renderDistance,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 y=t.attributes,P=y.get("position").data,v=this._getLineSize(y),T=Le;o(T,i.point);const j=v*_.pixelRatio,L=Je*_.pixelRatio,M=j/2+L;c(Ie[0],T[0]-M,T[1]+M,0),c(Ie[1],T[0]+M,T[1]+M,0),c(Ie[2],T[0]+M,T[1]-M,0),c(Ie[3],T[0]-M,T[1]-M,0);for(let e=0;e<4;e++)if(!_.unprojectFromRenderScreen(Ie[e],Ne[e]))return;z(_.eye,Ne[0],Ne[1],We),z(_.eye,Ne[1],Ne[2],ke),z(_.eye,Ne[2],Ne[3],De),z(_.eye,Ne[3],Ne[0],Ye);let R=Number.MAX_VALUE,V=0;for(const e of this._forEachTransformedLineSegment(Se,ye,P,r,he(this.parameters,y))){if(C(We,Se)<0&&C(We,ye)<0||C(ke,Se)<0&&C(ke,ye)<0||C(De,Se)<0&&C(De,ye)<0||C(Ye,Se)<0&&C(Ye,ye)<0)continue;const t=_.projectToRenderScreen(Se,ze),r=_.projectToRenderScreen(ye,Ce);if(null==t||null==r)continue;if(t[2]<0&&r[2]>0){p(Te,Se,ye);const e=_.frustum,r=-C(e[4],Se)/u(Te,A(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,ye,Se);const e=_.frustum,t=-C(e[4],ye)/u(Te,A(e[4]));if(m(Te,Te,t),h(ye,ye,Te),!_.projectToRenderScreen(ye,r))continue}else if(t[2]<0&&r[2]<0)continue;t[2]=0,r[2]=0;const i=w(t,r,Fe),s=E(i,T);if(!(s>=R)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(i,Se,ye,T,_,v,L);if(s>=e*e)continue}R=s,f(Re,Se),f(Ve,ye),V=e}}if(R<M*M){let e=Number.MAX_VALUE;if(x(w(Re,Ve,Fe),w(b,S,Oe),je)){p(je,je,b);const t=d(je);m(je,je,1/t),e=t/g(b,S)}a(e,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,ye,c,r,he(this.parameters,l)))for(const[t,r]of a.processLineSegment(qe,Se,ye)){if(!q(o,t,r,ze,Ce))continue;const i=w(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)&&(T(w(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(Pe,ve,this.parameters,e,r))if(X(s,Pe,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=j(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=P,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){null!=n&&this._writeTextureBuffer(e,r,n),null!=i&&this._writeVertexBuffer(e,r,i,s)}_writeTextureBuffer(e,t,r){const i=t.get("position"),s=i.data.length/3,n=this._isClosed(t),{buffer:o,offset:a}=r,l=o.getField("position",R),c=o.getField("u0",V),p=o.getField("sizeFeatureAttribute",V),u=o.getField("size",V),m=o.getField("colorFeatureAttribute",V),h=o.getField("color",F),d=o.getField("olidColor",F),_=o.getField("timeStamps",O),b=o.getField("opacityFeatureAttribute",V),S=t.get("sizeFeatureAttribute")?.data,y=t.get("size")?.data,P=t.get("colorFeatureAttribute")?.data,v=t.get("color")?.data,w=t.get("opacityFeatureAttribute")?.data,E=t.get("distanceToStart")?.data,x=t.get("timeStamps");Z(null!==l,"Expected valid position field in texture buffer"),Z(null!==c,"Expected valid u0 field in texture buffer");let T=0;for(let L=0;L<s;++L){this._getTransformedPosition(Ue,i.data,L,e),L>0&&(null!=E?T=E[L]??T:T+=g(Be,Ue));const t=a+L+1;if(l.setVec(t,Ue),c.set(t,T),f(Be,Ue),p&&p.set(t,1===S?.length?S[0]:S?.[L]??0),u&&u.set(t,1===y?.length?y[0]:y?.[L]??1),m&&m.set(t,1===P?.length?P[0]:P?.[L]??0),h)if(null!=v){const e=Math.min(4*L,v.length-4);h.setValues(t,v[e],v[e+1],v[e+2],v[e+3])}else h.setValues(t,1,1,1,1);b&&b.set(t,1===w?.length?w[0]:w?.[L]??0)}if(null!=_&&null!=x){Z(4===x.size);const e=x.data;for(let t=0;t<s;++t){const r=4*t,i=a+t+1;_.set(i,0,e[r]),_.set(i,1,e[r+1]),_.set(i,2,e[r+2]),_.set(i,3,e[r+3])}}if(n){const e=a,t=a+1,r=a+2,i=a+s,n=i+1,p=i+2;o.copyItem(i,e),o.copyItem(t,n),o.copyItem(r,p),l.getVec(i,Be),l.getVec(t,Ue);const u=T+g(Be,Ue);c.set(n,u)}else{const e=a,t=a+1,r=a+s,i=r+1;o.copyItem(t,e),o.copyItem(r,i)}const j=t.get("olidColor");D()&&null!=j&&null!=d&&te(j,4,d,a)}_writeVertexBuffer(e,t,r,i){const{buffer:s,offset:n}=r,{layout:o}=this,a=t.get("position"),l=a.indices,c=a.data.length/3,p=this._isClosed(t),u=c+(p?3:2);l&&l.length!==2*(c-1)&&console.warn("RibbonLineMaterial does not support indices");const m=s.getField("textureElementIndex",B);Z(null!=m,"Missing texture buffer index field"),Z(null!=i,"Using a texture layout, but the texture range for this instance was not provided");const h=i.from;Z(i.numElements===u,"Expected number of elements in TextureBuffer to equal number of points");const f=new Float32Array(s.buffer),d=v(s.buffer),g=new Uint32Array(s.buffer),_=o.stride/4;let b=n*_;const S=b,y=f.BYTES_PER_ELEMENT/d.BYTES_PER_ELEMENT,P=(e,t,r)=>{const i=r+1;g[b]=h+i,b++;let s=b*y;d[s++]=e,d[s++]=t,b=Math.ceil(s/y)};b+=_;let w=0,E=0;p?(w=0,E=c):(P(1,-4,0),P(1,4,0),w=1,E=c-1);for(let v=w;v<E;v++){P(0,-1,v),P(0,1,v);const e=this.numJoinSubdivisions;for(let t=0;t<e;++t){const r=(t+1)/(e+1);P(r,-1,v),P(r,1,v)}P(1,-2,v),P(1,2,v)}p?(P(0,-1,E),P(0,1,E)):(P(0,-5,E),P(0,5,E)),me(f,S+_,f,S,_);b=me(f,b-_,f,b,_),this._parameters.wireframe&&this._addWireframeVertices(s,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=y(),ye=y(),Pe=l(),ve=l(),we=y(),Ee=y(),xe=y(),Te=y(),je=y(),Le=y(),ze=r(),Ce=r(),Ae=i(),Me=i(),Re=y(),Ve=y(),Fe=L(),Oe=L(),Be=y(),Ue=y(),Ie=[r(),r(),r(),r()],Ne=[y(),y(),y(),y()],We=M(),ke=M(),De=M(),Ye=M(),Je=4,qe=[y(),y()];export{pe as Parameters,le as RibbonLineMaterial};