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

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 (86) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{d1af0bd611a3dc549858.js → 0037a878499d8a512772.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{172571397c66f992d08c.js → 0790bf0eb276cd9166f6.js} +1 -1
  4. package/assets/esri/core/workers/chunks/10b367563f894ceb9864.js +1 -0
  5. package/assets/esri/core/workers/chunks/{1b0557fcb058fc450230.js → 246cd372d4184233f48e.js} +1 -1
  6. package/assets/esri/core/workers/chunks/268ab65afc3fce775ad2.js +1 -0
  7. package/assets/esri/core/workers/chunks/{3af2b9d6d5466cb2b957.js → 3157f85bb319294878ca.js} +9 -9
  8. package/assets/esri/core/workers/chunks/{5dbd28fce73751d2d1aa.js → 3406a01dad6338e3c548.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{18edf2846d7546285e5e.js → 34fbeeeeef4bd01672c6.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{6ccd5fa5e35dc70fcd5d.js → 403f08e0c1a9203f7fba.js} +1 -1
  11. package/assets/esri/core/workers/chunks/478540265c86436da05e.js +1 -0
  12. package/assets/esri/core/workers/chunks/{547a2fe53139f705f95e.js → 4a340836ddbc856993f2.js} +1 -1
  13. package/assets/esri/core/workers/chunks/4d9bde9f66817a92ceca.js +1 -0
  14. package/assets/esri/core/workers/chunks/57b07448da06d0302a46.js +1 -0
  15. package/assets/esri/core/workers/chunks/5a9ff50fdcc99ae28cce.js +1 -0
  16. package/assets/esri/core/workers/chunks/{40f7bb0ebd918d76f078.js → 5eb6f37c74a217772eca.js} +1 -1
  17. package/assets/esri/core/workers/chunks/70452f6d63e9be8d03dd.js +1 -0
  18. package/assets/esri/core/workers/chunks/{99eccf9ce53582cfa5b5.js → 73aa1bfa6e1dc271c9d7.js} +1 -1
  19. package/assets/esri/core/workers/chunks/7889f4a17cf249f2acc5.js +1 -0
  20. package/assets/esri/core/workers/chunks/7a2dcd57849048c6e00d.js +1 -0
  21. package/assets/esri/core/workers/chunks/{801a664f21e0218bc705.js → 81accb1820e2735fa376.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{ab5aa4280ed0cb7fcbe9.js → 83991475aa54fd5aa008.js} +1 -1
  23. package/assets/esri/core/workers/chunks/8bdca809dd88eab9e5d8.js +29 -0
  24. package/assets/esri/core/workers/chunks/91d133c04ca764d74934.js +1 -0
  25. package/assets/esri/core/workers/chunks/97c758f736f28c5dab84.js +1 -0
  26. package/assets/esri/core/workers/chunks/a5f058567419ea70dff6.js +1 -0
  27. package/assets/esri/core/workers/chunks/{ee7c8a7f384ea6393487.js → a615a644086e98a90579.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{0b2ca406761c63529a6a.js → b0b37c67a14a4dfb6538.js} +1 -1
  29. package/assets/esri/core/workers/chunks/b5c7813495657f844171.js +1 -0
  30. package/assets/esri/core/workers/chunks/{78add8e6b54b51eaa299.js → b8e5d7aefddddbd0a10c.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{e2e2162adbfb9b46bede.js → c16e83e448a32d13048f.js} +1 -1
  32. package/assets/esri/core/workers/chunks/dc24e80d061f7b063608.js +1 -0
  33. package/config.js +1 -1
  34. package/kernel.js +1 -1
  35. package/package.json +1 -1
  36. package/support/revision.js +1 -1
  37. package/views/2d/input/MapViewInputManager.js +1 -1
  38. package/views/2d/input/handlers/DragZoomBox.js +2 -0
  39. package/views/2d/navigation/MapViewNavigation.js +1 -1
  40. package/views/3d/input/SceneInputManager.js +1 -1
  41. package/views/3d/input/handlers/DragZoomBox.js +2 -0
  42. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  43. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  44. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  45. package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
  46. package/views/3d/terrain/TerrainRenderer.js +1 -1
  47. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentGeometryBVH.js +1 -1
  48. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  49. package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
  50. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  51. package/views/3d/webgl-engine/lib/NavigationDepthCache.js +1 -1
  52. package/views/3d/webgl-engine/lib/NavigationDepthCacheStore.js +1 -1
  53. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  54. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  55. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  56. package/views/3d/webgl-engine/lib/PolygonIntersections2D.js +1 -1
  57. package/views/3d/webgl-engine/lib/PositionReader.js +2 -0
  58. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  59. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  60. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  61. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  62. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  63. package/views/3d/webgl-engine/lib/lodRendering/LodLevel.js +1 -1
  64. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  65. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  66. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  67. package/views/MapView.d.ts +1 -0
  68. package/views/SceneView.d.ts +4 -2
  69. package/views/input/handlers/DragZoomBox.js +2 -0
  70. package/views/types.d.ts +10 -4
  71. package/assets/esri/core/workers/chunks/031ccf2e1583beebdf24.js +0 -1
  72. package/assets/esri/core/workers/chunks/382d9491c2a56c1925fe.js +0 -1
  73. package/assets/esri/core/workers/chunks/4ee7232ea41fa41c5ed4.js +0 -29
  74. package/assets/esri/core/workers/chunks/50674ba5f24129d61d89.js +0 -1
  75. package/assets/esri/core/workers/chunks/5ce09c4d06e98b1e9251.js +0 -1
  76. package/assets/esri/core/workers/chunks/5f54d927dc77e92cf145.js +0 -1
  77. package/assets/esri/core/workers/chunks/63e3d338751240479335.js +0 -1
  78. package/assets/esri/core/workers/chunks/6e520ef645c5edcd499a.js +0 -1
  79. package/assets/esri/core/workers/chunks/7b61f56d0f766421eaef.js +0 -1
  80. package/assets/esri/core/workers/chunks/9b7cb96acea388d86fa4.js +0 -1
  81. package/assets/esri/core/workers/chunks/b49952541d189b4b9f7e.js +0 -1
  82. package/assets/esri/core/workers/chunks/bb552089b34d6811fb03.js +0 -1
  83. package/assets/esri/core/workers/chunks/d560ed96dde5ca3a5583.js +0 -1
  84. package/assets/esri/core/workers/chunks/eac8cae89da9ce2f4946.js +0 -1
  85. package/assets/esri/core/workers/chunks/f244632f7934a4b72c91.js +0 -1
  86. package/views/2d/navigation/ZoomBox.js +0 -2
@@ -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{estimateNumberArrayMemory as e}from"../../../../core/memoryEstimations.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as s,copy as r,nan as i,fromValues as o}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as a}from"../../../../geometry/support/frustum.js";import{newContinuousIndexArray as c}from"../../../../geometry/support/Indices.js";import{MeshIntersectionOptions as l,intersectRayTriangles as h}from"./RayIntersections.js";import{forEachTriangleRangeScreenPolygonHit as g}from"./screenPolygonTriangleIntersections.js";const m=40,d=.8,u=10,y=1e-6;class _{constructor(e,s,r){this.globalTriangleVertexIndices=e,this.numTriangles=s,this.positions=r,this._rayDirection=n(),this._callback=T,this._intersectionOptions=S,this._screenPolygonCallback=M,this._screenPolygonDisplacement=null,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this.bspNodeTree=new Array,this.triangleIndexMap=c(s);const i=I(e,s,r.data,r.stride),o=t(Math.log2(s/m),2,u),a=(t,e,n)=>{const s=P(this.triangleIndexMap,i,t,e),r=e-t;if(r<=m){const n=new p(s,void 0,0,t,e);return this.bspNodeTree.push(n),n}const{axis:c,midValue:l}=x(s),h=f(this.triangleIndexMap,i,t,e,c,l),g=(t,e)=>{if(n>o)return;const s=e-t;return s<m||s>=d*r?void 0:a(t,e,n+1)},u=new p(s,c,l,h.next,h.mid);return this.bspNodeTree.push(u),u.leftNode=g(t,h.next),u.rightNode=g(h.mid,e),u};a(0,s,0)}intersectRayTriangleRange(t,e){if(t>=e)return;const{data:n,stride:s}=this.positions;h(this._rayFrom,this._rayDirection,t,e,this.globalTriangleVertexIndices,n,s,this._intersectionOptions.normalRequired,this._callback,this.triangleIndexMap),_.numFacesTested+=e-t}forEachScreenPolygonHit(t,e,n,s,r){null!=t.camera&&0!==this.bspNodeTree.length&&(this._screenPolygonIntersector=t,this._screenPolygonTransformation=e,this._screenPolygonQuery=n,this._screenPolygonDisplacement=s,this._screenPolygonCallback=r,this._intersectScreenPolygonBSP(this.bspNodeTree[0],0,this.triangleIndexMap.length),this._screenPolygonCallback=M,this._screenPolygonDisplacement=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._screenPolygonIntersector=null)}intersectRay(t,e,n,s){_.numFacesTested=0;const r=t,i=e,o=i[0]-r[0],a=i[1]-r[1],c=i[2]-r[2];if(o*o+a*a+c*c<y)return;this._rayFrom=r;const l=this._rayDirection;l[0]=o,l[1]=a,l[2]=c;const h=this.triangleIndexMap.length;this._callback=s,this._intersectionOptions=n,this.intersectRayBSP(this.bspNodeTree[0],0,h),this._callback=T,this._intersectionOptions=S}intersectRayBSP(t,e,n){const s=this._rayFrom,r=this._rayDirection;this._traverseBSP(t,e,n,t=>b(t.aabb,s,r),t=>{const e=t.axis;return s[e]<t.d||r[e]<0},t=>{const e=t.axis;return s[e]>t.d||r[e]>0},(t,e)=>this.intersectRayTriangleRange(t,e))}_intersectScreenPolygonTriangleRange(t,e){if(t>=e)return;const n=this._screenPolygonIntersector,s=this._screenPolygonQuery;if(null!=n&&null!=s)for(const r of g(n,this._screenPolygonTransformation,s,t,e,this.globalTriangleVertexIndices,this.positions.data,this.positions.stride,this._screenPolygonDisplacement,this.triangleIndexMap))this._screenPolygonCallback(r.distance,r.primitiveIndex,r.point)}_intersectScreenPolygonBSP(t,e,n){const s=this._screenPolygonIntersector,r=this._screenPolygonQuery;null!=s?.camera&&null!=r&&this._traverseBSP(t,e,n,t=>this._nodeIntersectsScreenPolygonBroadPhase(t.aabb),()=>!0,()=>!0,(t,e)=>this._intersectScreenPolygonTriangleRange(t,e))}_traverseBSP(t,e,n,s,r,i,o){const a=[{node:t,rangeStart:e,rangeEnd:n}];for(;a.length>0;){const{node:t,rangeStart:e,rangeEnd:n}=a.pop();s(t)&&(r(t)&&this._traverseBSPRange(a,t.leftNode,e,t.midStartIndex,o),o(t.midStartIndex,t.rightStartIndex),i(t)&&this._traverseBSPRange(a,t.rightNode,t.rightStartIndex,n,o))}}_traverseBSPRange(t,e,n,s,r){n>=s||(void 0!==e?t.push({node:e,rangeStart:n,rangeEnd:s}):r(n,s))}_nodeIntersectsScreenPolygonBroadPhase(t){const e=this._screenPolygonQuery;if(null==e)return!1;const n=this._screenPolygonDisplacement,s=n?n.applyToAabb(r(B,t)):t;return a(e.broadPhaseFrustum,s,this._screenPolygonTransformation)}static{this.numFacesTested=0}get estimatedMemoryUsage(){return e(this.triangleIndexMap)}}class p{constructor(t,e,n,s,r){this.aabb=t,this.axis=e,this.d=n,this.midStartIndex=s,this.rightStartIndex=r}}function f(t,e,n,s,r,i){const o=r+3;let a=n,c=n,l=s;for(;c<l;){const n=t[c],s=6*n;e[s+o]<=i?(t[c]=t[a],t[a]=n,++a,++c):e[s+r]>=i?(--l,t[c]=t[l],t[l]=n):++c}return{next:a,mid:l}}function P(t,e,n,s){if(s<=n)return i;let r=6*t[n],a=e[r++],c=e[r++],l=e[r++],h=e[r++],g=e[r++],m=e[r];for(let i=n+1;i<s;++i)r=6*t[i],a=Math.min(a,e[r++]),c=Math.min(c,e[r++]),l=Math.min(l,e[r++]),h=Math.max(h,e[r++]),g=Math.max(g,e[r++]),m=Math.max(m,e[r]);return o(a,c,l,h,g,m)}function x(t){const e=t[3]-t[0],n=t[4]-t[1],s=t[5]-t[2],r=e>n?e>s?0:n>s?1:2:n>s?1:s>e?2:0;return{axis:r,midValue:(t[r]+t[r+3])/2}}function I(t,e,n,s){const r=new Float64Array(6*e);for(let i=0;i<e;++i){const e=3*i,o=t[e]*s,a=t[e+1]*s,c=t[e+2]*s;for(let t=0;t<3;++t){const e=n[o+t],s=n[a+t],l=n[c+t];r[6*i+t]=Math.min(e,s,l),r[6*i+3+t]=Math.max(e,s,l)}}return r}function b(t,e,n){const s=e,r=n;let i=0,o=1/0;for(let a=0;a<3;++a){{const e=t[a];if(s[a]<e){if(r[a]<=y)return!1;const t=(e-s[a])/r[a];i=Math.max(i,t)}else if(r[a]<=-y){const t=(e-s[a])/r[a];o=Math.min(o,t)}if(i>o)return!1}{const e=t[a+3];if(s[a]>e){if(r[a]>=-y)return!1;const t=(e-s[a])/r[a];i=Math.max(i,t)}else if(r[a]>=y){const t=(e-s[a])/r[a];o=Math.min(o,t)}if(i>o)return!1}}return!0}const S=new l,T=()=>{},M=()=>{},B=s();export{_ as TriangleIntersectionData};
2
+ import{clamp as t}from"../../../../core/mathUtils.js";import{estimateNumberArrayMemory as e}from"../../../../core/memoryEstimations.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as r,copy as s,nan as o,fromValues as i}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as a}from"../../../../geometry/support/frustum.js";import{newContinuousIndexArray as c}from"../../../../geometry/support/Indices.js";import{createPositionReader as l}from"./PositionReader.js";import{MeshIntersectionOptions as h,intersectRayTriangles as g}from"./RayIntersections.js";import{forEachTriangleRangeScreenPolygonHit as m}from"./screenPolygonTriangleIntersections.js";const d=40,u=.8,y=10,_=1e-6;class p{constructor(e,r,s){this.globalTriangleVertexIndices=e,this.numTriangles=r,this.positions=s,this._rayDirection=n(),this._callback=M,this._intersectionOptions=T,this._screenPolygonCallback=R,this._screenPolygonDisplacement=null,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this.bspNodeTree=new Array,this.triangleIndexMap=c(r),this._readPosition=l(s.data,e,s.stride);const o=b(e,r,s.data,s.stride),i=t(Math.log2(r/d),2,y),a=(t,e,n)=>{const r=x(this.triangleIndexMap,o,t,e),s=e-t;if(s<=d){const n=new f(r,void 0,0,t,e);return this.bspNodeTree.push(n),n}const{axis:c,midValue:l}=I(r),h=P(this.triangleIndexMap,o,t,e,c,l),g=(t,e)=>{if(n>i)return;const r=e-t;return r<d||r>=u*s?void 0:a(t,e,n+1)},m=new f(r,c,l,h.next,h.mid);return this.bspNodeTree.push(m),m.leftNode=g(t,h.next),m.rightNode=g(h.mid,e),m};a(0,r,0)}intersectRayTriangleRange(t,e){if(t>=e)return;const{data:n,stride:r}=this.positions;g(this._rayFrom,this._rayDirection,t,e,this.globalTriangleVertexIndices,n,r,this._intersectionOptions.normalRequired,this._callback,this.triangleIndexMap),p.numFacesTested+=e-t}forEachScreenPolygonHit(t,e,n,r,s){null!=t.camera&&0!==this.bspNodeTree.length&&(this._screenPolygonIntersector=t,this._screenPolygonTransformation=e,this._screenPolygonQuery=n,this._screenPolygonDisplacement=r,this._screenPolygonCallback=s,this._intersectScreenPolygonBSP(this.bspNodeTree[0],0,this.triangleIndexMap.length),this._screenPolygonCallback=R,this._screenPolygonDisplacement=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._screenPolygonIntersector=null)}intersectRay(t,e,n,r){p.numFacesTested=0;const s=t,o=e,i=o[0]-s[0],a=o[1]-s[1],c=o[2]-s[2];if(i*i+a*a+c*c<_)return;this._rayFrom=s;const l=this._rayDirection;l[0]=i,l[1]=a,l[2]=c;const h=this.triangleIndexMap.length;this._callback=r,this._intersectionOptions=n,this.intersectRayBSP(this.bspNodeTree[0],0,h),this._callback=M,this._intersectionOptions=T}intersectRayBSP(t,e,n){const r=this._rayFrom,s=this._rayDirection;this._traverseBSP(t,e,n,t=>S(t.aabb,r,s),t=>{const e=t.axis;return r[e]<t.d||s[e]<0},t=>{const e=t.axis;return r[e]>t.d||s[e]>0},(t,e)=>this.intersectRayTriangleRange(t,e))}_intersectScreenPolygonTriangleRange(t,e){if(t>=e)return;const n=this._screenPolygonIntersector,r=this._screenPolygonQuery;if(null!=n&&null!=r)for(const s of m(n,this._screenPolygonTransformation,r,t,e,this._readPosition,this._screenPolygonDisplacement,this.triangleIndexMap))this._screenPolygonCallback(s.distance,s.primitiveIndex,s.point)}_intersectScreenPolygonBSP(t,e,n){const r=this._screenPolygonIntersector,s=this._screenPolygonQuery;null!=r?.camera&&null!=s&&this._traverseBSP(t,e,n,t=>this._nodeIntersectsScreenPolygonBroadPhase(t.aabb),()=>!0,()=>!0,(t,e)=>this._intersectScreenPolygonTriangleRange(t,e))}_traverseBSP(t,e,n,r,s,o,i){const a=[{node:t,rangeStart:e,rangeEnd:n}];for(;a.length>0;){const{node:t,rangeStart:e,rangeEnd:n}=a.pop();r(t)&&(s(t)&&this._traverseBSPRange(a,t.leftNode,e,t.midStartIndex,i),i(t.midStartIndex,t.rightStartIndex),o(t)&&this._traverseBSPRange(a,t.rightNode,t.rightStartIndex,n,i))}}_traverseBSPRange(t,e,n,r,s){n>=r||(void 0!==e?t.push({node:e,rangeStart:n,rangeEnd:r}):s(n,r))}_nodeIntersectsScreenPolygonBroadPhase(t){const e=this._screenPolygonQuery;if(null==e)return!1;const n=this._screenPolygonDisplacement,r=n?n.applyToAabb(s(B,t)):t;return a(e.broadPhaseFrustum,r,this._screenPolygonTransformation)}static{this.numFacesTested=0}get estimatedMemoryUsage(){return e(this.triangleIndexMap)}}class f{constructor(t,e,n,r,s){this.aabb=t,this.axis=e,this.d=n,this.midStartIndex=r,this.rightStartIndex=s}}function P(t,e,n,r,s,o){const i=s+3;let a=n,c=n,l=r;for(;c<l;){const n=t[c],r=6*n;e[r+i]<=o?(t[c]=t[a],t[a]=n,++a,++c):e[r+s]>=o?(--l,t[c]=t[l],t[l]=n):++c}return{next:a,mid:l}}function x(t,e,n,r){if(r<=n)return o;let s=6*t[n],a=e[s++],c=e[s++],l=e[s++],h=e[s++],g=e[s++],m=e[s];for(let o=n+1;o<r;++o)s=6*t[o],a=Math.min(a,e[s++]),c=Math.min(c,e[s++]),l=Math.min(l,e[s++]),h=Math.max(h,e[s++]),g=Math.max(g,e[s++]),m=Math.max(m,e[s]);return i(a,c,l,h,g,m)}function I(t){const e=t[3]-t[0],n=t[4]-t[1],r=t[5]-t[2],s=e>n?e>r?0:n>r?1:2:n>r?1:r>e?2:0;return{axis:s,midValue:(t[s]+t[s+3])/2}}function b(t,e,n,r){const s=new Float64Array(6*e);for(let o=0;o<e;++o){const e=3*o,i=t[e]*r,a=t[e+1]*r,c=t[e+2]*r;for(let t=0;t<3;++t){const e=n[i+t],r=n[a+t],l=n[c+t];s[6*o+t]=Math.min(e,r,l),s[6*o+3+t]=Math.max(e,r,l)}}return s}function S(t,e,n){const r=e,s=n;let o=0,i=1/0;for(let a=0;a<3;++a){{const e=t[a];if(r[a]<e){if(s[a]<=_)return!1;const t=(e-r[a])/s[a];o=Math.max(o,t)}else if(s[a]<=-_){const t=(e-r[a])/s[a];i=Math.min(i,t)}if(o>i)return!1}{const e=t[a+3];if(r[a]>e){if(s[a]>=-_)return!1;const t=(e-r[a])/s[a];o=Math.max(o,t)}else if(s[a]>=_){const t=(e-r[a])/s[a];i=Math.min(i,t)}if(o>i)return!1}}return!0}const T=new h,M=()=>{},R=()=>{},B=r();export{p as TriangleIntersectionData};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/PooledArray.js";import{multiply as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4Z as n,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{lerp as a}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{intersectsSphere as o}from"../../../../geometry/support/frustum.js";import{Sphere as h}from"../../../../geometry/support/sphere.js";import{maxScale as f}from"../../support/mathUtils.js";import{DepthRange as c}from"./DepthRange.js";import{assert as u}from"./Util.js";const d=1e4,l=100,m=500,g=500,_=.1;function p(e,t,r,n){let i=0;if(!t.some(e=>!!e.material&&(i+=e.numGeometries,i>=d)))return W.compute(e,t,n);const a=new c;return r.forEach(t=>a.union(b(e,t))),a}function b(e,t){if(!t.visible)return;const r=new c,n=t.getSpatialQueryAccelerator();return n?w(r,e,n):j(r,e,t.objects),r}function w(e,t,r){const{eye:n,viewForward:i,frustum:a}=t,s=e=>e.visible,o=r.objectCount;if(o<m)E.set(t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(n,i,1,E,(r,n)=>{x(e,t,r),E.far=e.near,n.setRange(E)},a,s),E.set(Math.max(e.far,t.near),t.far),r.forEachInDepthRange(n,i,-1,E,(r,n)=>{x(e,t,r),E.near=e.far,n.setRange(E)},a,s);else{const n=Math.max(Math.min(o,g),Math.ceil(o*_)),h=r.findClosest(i,1,a,s,n),f=r.findClosest(i,-1,a,s,n);h&&f&&(v(e,t,h.boundingVolumeWorldSpace.bounds),v(e,t,f.boundingVolumeWorldSpace.bounds))}}function j(e,t,r){F.clear(),r.forEach(e=>{e.visible&&0!==e.geometries.length&&F.add(e,t)}),F.empty||(F.sort(),E.set(t.near,Math.min(e.near,t.far)),F.forEachInDepthRange(E,1,(r,n)=>{n<e.near&&x(e,t,r)}),E.set(Math.max(e.far,t.near),t.far),F.forEachInDepthRange(E,-1,(t,r,n)=>{e.far=Math.max(e.far,n)}))}function x(e,r,n){if(!n.visible)return;if(!o(r.frustum,n.boundingVolumeWorldSpace.bounds))return;const i=n.transformation,a=D;n.geometries.forEach(n=>{t(a,i,n.transformation);const s=f(a);R(e,r,n.boundingInfo,a,s)})}function R(e,t,r,n,a){if(null==r)return;i(A.center,r.boundingSphere.center,n);const{eye:s,viewForward:h}=t,f=h[0]*(A.center[0]-s[0])+h[1]*(A.center[1]-s[1])+h[2]*(A.center[2]-s[2]);if(A.radius=r.boundingSphere.radius*a,!(f-A.radius>e.near&&f+A.radius<e.far)&&o(t.frustum,A))if(r.boundingSphere.radius>l&&r.children)for(const i of r.children)R(e,t,i,n,a);else N.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,n,r.boundingBox)}function v(e,t,r){const n=t.eye,i=t.viewForward,a=(r.center[0]-n[0])*i[0]+(r.center[1]-n[1])*i[1]+(r.center[2]-n[2])*i[2];e.near=Math.min(e.near,a-r.radius),e.far=Math.max(e.far,a+r.radius)}class M{constructor(){this._items=new e({allocator:e=>e||{object:null,distance:0,near:0,far:0},deallocator:e=>(e.object=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e,t){const r=t.eye,n=t.viewForward,i=e.boundingVolumeWorldSpace.bounds,a=(i.center[0]-r[0])*n[0]+(i.center[1]-r[1])*n[1]+(i.center[2]-r[2])*n[2];if(!Number.isFinite(a))return;const s=this._items.pushNew();s.object=e,s.distance=a,s.near=a-i.radius,s.far=a+i.radius}sort(){this._items.sort((e,t)=>e.distance-t.distance)}forEachInDepthRange(e,t,r){if(1===t)for(let n=0;n<this._items.length;++n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}else for(let n=this._items.length-1;n>=0;--n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}}}class B{constructor(){this._geometries=new Array,this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._looseRange=new c(0,0)}compute(e,t,r){this._reset();const{viewMatrix:i}=e;t.forEach(e=>{e.forEachGeometry(e=>{if(!e.visible||0===r&&!e.castShadow)return;const t=e.boundingSphere,a=n(t.center,i),s=a-t.radius,o=a+t.radius;this._geometries.push(e),this._near.push(-o),this._far.push(-s)})});const a=new c;if(0===this._geometries.length)return a;for(let n=0;n<this._geometries.length;++n)this._near[n]>a.far&&(a.far=this._near[n]),this._near[n]>2&&this._far[n]<a.near&&(a.near=this._far[n]);const s=this._looseRange;s.near=Math.max(.5*a.near,2),s.far=2*a.far;let o=0,h=0;for(let n=0;n<this._geometries.length;++n)this._near[n]<a.near&&(this._near[n]>=s.near?a.near=this._near[n]:this._nearCandidates[o++]=n),this._far[n]>a.far&&(this._far[n]<=s.far?a.far=this._far[n]:this._farCandidates[h++]=n);if(0===this._nearCandidates.length&&0===this._farCandidates.length)return a;this._nearCandidates.sort((e,t)=>this._near[e]<this._near[t]?-1:this._near[e]>this._near[t]?1:0),this._farCandidates.sort((e,t)=>this._far[e]<this._far[t]?1:this._far[e]>this._far[t]?-1:0);for(let n=0;n<this._nearCandidates.length;++n){const t=this._nearCandidates[n];if(this._near[t]<a.near){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:i}=r;this._includeNearBoundingInfoRec(e,n,i,a)}}for(let n=0;n<this._farCandidates.length;++n){const t=this._farCandidates[n];if(this._far[t]>a.far){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:i}=r;this._includeFarBoundingInfoRec(e,n,i,a)}}return this._reset(),a}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0}_isOutsideSidePlanes(e,t){const{center:r,radius:n}=e;return t[0][0]*r[0]+t[0][1]*r[1]+t[0][2]*r[2]+t[0][3]>n||t[1][0]*r[0]+t[1][1]*r[1]+t[1][2]*r[2]+t[1][3]>n||t[2][0]*r[0]+t[2][1]*r[1]+t[2][2]*r[2]+t[2][3]>n||t[3][0]*r[0]+t[3][1]*r[1]+t[3][2]*r[2]+t[3][3]>n}_includeNearBoundingInfoRec(e,t,r,a){if(null==t)return;i(A.center,t.boundingSphere.center,r),A.radius=t.boundingSphere.radius*f(r);const{frustum:s}=e;if(this._isOutsideSidePlanes(A,s))return;const o=A.radius,{viewMatrix:h}=e,c=n(A.center,h),u=c+o;if(!(-(c-o)<2||-u>=a.near))if(-u>this._looseRange.near)a.near=-u;else{if(o>l){const n=t.children;if(void 0!==n){for(const t of n)this._includeNearBoundingInfoRec(e,t,r,a);return}}N.unionDepthRangeWithAABB(a,e.viewProjectionMatrix,r,t.boundingBox)}}_includeFarBoundingInfoRec(e,t,r,a){if(null==t)return;i(A.center,t.boundingSphere.center,r),A.radius=t.boundingSphere.radius*f(r);const{frustum:s}=e;if(this._isOutsideSidePlanes(A,s))return;const{viewMatrix:o,viewProjectionMatrix:h}=e,c=n(A.center,o)-A.radius;if(!(-c<=a.far))if(-c<this._looseRange.far)a.far=-c;else{if(A.radius>l){const n=t.children;if(void 0!==n){for(const t of n)this._includeFarBoundingInfoRec(e,t,r,a);return}}N.unionDepthRangeWithAABB(a,h,r,t.boundingBox)}}}class C{constructor(){this._modelViewProj=r(),this._clipPosition=[s(),s(),s(),s(),s(),s(),s(),s()]}unionDepthRangeWithAABB(e,r,n,i){const a=this._modelViewProj;t(a,r,n);let s=!1;for(let t=0;t<8;++t){const e=this._clipPosition[t],r=0===t||3===t||4===t||7===t?i[0]:i[3],n=0===t||1===t||4===t||5===t?i[1]:i[4],s=t<4?i[2]:i[5];e[0]=a[0]*r+a[4]*n+a[8]*s+a[12],e[1]=a[1]*r+a[5]*n+a[9]*s+a[13],e[2]=a[2]*r+a[6]*n+a[10]*s+a[14],e[3]=a[3]*r+a[7]*n+a[11]*s+a[15]}for(let t=0;t<12;++t){const r=S(this._clipPosition[y[t][0]],this._clipPosition[y[t][1]],this._clipPosition[y[t][2]]);let n=!0;for(let e=0;e<r.length;++e){if(r[e][3]>=2){n=!1;break}}if(!n){s=!0;for(let t=0;t<r.length;++t){const n=r[t][3];Number.isFinite(n)&&(e.near=Math.min(n,e.near),e.far=Math.max(n,e.far))}}}return s}}function S(e,t,r){let n=[e,t,r];for(let i=0;i<4;++i){const e=n;n=[];for(let t=0;t<e.length;++t){const r=e[t],a=e[(t+1)%e.length];I(a,i)?(I(r,i)||n.push(P(r,a,i)),n.push(a)):I(r,i)&&n.push(P(r,a,i))}}return n}function I(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void u(!1)}function P(e,t,r){let n=0;return 0===r?n=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?n=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?n=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(n=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),a(s(),e,t,n)}const y=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],A=new h,D=r(),E=new c,F=new M,W=new B,N=new C;export{p as depthRangeFromScene};
2
+ import e from"../../../../core/PooledArray.js";import{multiply as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4Z as n,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{lerp as s}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{intersectsSphere as o}from"../../../../geometry/support/frustum.js";import{Sphere as h}from"../../../../geometry/support/sphere.js";import{maxScale as f}from"../../support/mathUtils.js";import{DepthRange as c}from"./DepthRange.js";import{assert as u}from"./Util.js";const l=1e4,d=100,m=500,_=500,g=.1;function p(e,t,r,n){let i=0;if(!t.some(e=>!!e.material&&(i+=e.numGeometries,i>=l)))return W.compute(e,t,n);const s=new c;return r.forEach(t=>s.union(b(e,t))),s}function b(e,t){if(!t.visible)return;const r=new c,n=t.getSpatialQueryAccelerator();return n?w(r,e,n):j(r,e,t.objects),r}function w(e,t,r){const{eye:n,viewForward:i,frustum:s}=t,a=e=>e.visible,o=r.objectCount;if(o<m)S.set(t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(n,i,1,S,(r,n)=>{x(e,t,r),S.far=e.near,n.setRange(S)},s,a),S.set(Math.max(e.far,t.near),t.far),r.forEachInDepthRange(n,i,-1,S,(r,n)=>{x(e,t,r),S.near=e.far,n.setRange(S)},s,a);else{const n=Math.max(Math.min(o,_),Math.ceil(o*g)),h=r.findClosest(i,1,s,a,n),f=r.findClosest(i,-1,s,a,n);h&&f&&(v(e,t,h.boundingVolumeWorldSpace.bounds),v(e,t,f.boundingVolumeWorldSpace.bounds))}}function j(e,t,r){F.clear(),r.forEach(e=>{e.visible&&0!==e.geometries.length&&F.add(e,t)}),F.empty||(F.sort(),S.set(t.near,Math.min(e.near,t.far)),F.forEachInDepthRange(S,1,(r,n)=>{n<e.near&&x(e,t,r)}),S.set(Math.max(e.far,t.near),t.far),F.forEachInDepthRange(S,-1,(t,r,n)=>{e.far=Math.max(e.far,n)}))}function x(e,r,n){if(!n.visible)return;if(!o(r.frustum,n.boundingVolumeWorldSpace.bounds))return;const i=n.transformation,s=E;n.geometries.forEach(n=>{t(s,i,n.transformation);const a=f(s);R(e,r,n.boundingInfo,s,a)})}function R(e,t,r,n,s){if(null==r)return;i(D.center,r.sphere.center,n);const{eye:a,viewForward:h}=t,f=h[0]*(D.center[0]-a[0])+h[1]*(D.center[1]-a[1])+h[2]*(D.center[2]-a[2]);if(D.radius=r.sphere.radius*s,!(f-D.radius>e.near&&f+D.radius<e.far)&&o(t.frustum,D))if(r.sphere.radius>d&&r.children)for(const i of r.children)R(e,t,i,n,s);else N.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,n,r.box)}function v(e,t,r){const n=t.eye,i=t.viewForward,s=(r.center[0]-n[0])*i[0]+(r.center[1]-n[1])*i[1]+(r.center[2]-n[2])*i[2];e.near=Math.min(e.near,s-r.radius),e.far=Math.max(e.far,s+r.radius)}class M{constructor(){this._items=new e({allocator:e=>e||{object:null,distance:0,near:0,far:0},deallocator:e=>(e.object=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e,t){const r=t.eye,n=t.viewForward,i=e.boundingVolumeWorldSpace.bounds,s=(i.center[0]-r[0])*n[0]+(i.center[1]-r[1])*n[1]+(i.center[2]-r[2])*n[2];if(!Number.isFinite(s))return;const a=this._items.pushNew();a.object=e,a.distance=s,a.near=s-i.radius,a.far=s+i.radius}sort(){this._items.sort((e,t)=>e.distance-t.distance)}forEachInDepthRange(e,t,r){if(1===t)for(let n=0;n<this._items.length;++n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}else for(let n=this._items.length-1;n>=0;--n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}}}class C{constructor(){this._geometries=new Array,this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._looseRange=new c(0,0)}compute(e,t,r){this._reset();const{viewMatrix:i}=e;t.forEach(e=>{e.forEachGeometry(e=>{if(!e.visible||0===r&&!e.castShadow)return;const t=e.boundingSphere,s=n(t.center,i),a=s-t.radius,o=s+t.radius;this._geometries.push(e),this._near.push(-o),this._far.push(-a)})});const s=new c;if(0===this._geometries.length)return s;for(let n=0;n<this._geometries.length;++n)this._near[n]>s.far&&(s.far=this._near[n]),this._near[n]>2&&this._far[n]<s.near&&(s.near=this._far[n]);const a=this._looseRange;a.near=Math.max(.5*s.near,2),a.far=2*s.far;let o=0,h=0;for(let n=0;n<this._geometries.length;++n)this._near[n]<s.near&&(this._near[n]>=a.near?s.near=this._near[n]:this._nearCandidates[o++]=n),this._far[n]>s.far&&(this._far[n]<=a.far?s.far=this._far[n]:this._farCandidates[h++]=n);if(0===this._nearCandidates.length&&0===this._farCandidates.length)return s;this._nearCandidates.sort((e,t)=>this._near[e]<this._near[t]?-1:this._near[e]>this._near[t]?1:0),this._farCandidates.sort((e,t)=>this._far[e]<this._far[t]?1:this._far[e]>this._far[t]?-1:0);for(let n=0;n<this._nearCandidates.length;++n){const t=this._nearCandidates[n];if(this._near[t]<s.near){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:i}=r;this._includeNearBoundingInfoRec(e,n,i,s)}}for(let n=0;n<this._farCandidates.length;++n){const t=this._farCandidates[n];if(this._far[t]>s.far){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:i}=r;this._includeFarBoundingInfoRec(e,n,i,s)}}return this._reset(),s}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0}_isOutsideSidePlanes(e,t){const{center:r,radius:n}=e;return t[0][0]*r[0]+t[0][1]*r[1]+t[0][2]*r[2]+t[0][3]>n||t[1][0]*r[0]+t[1][1]*r[1]+t[1][2]*r[2]+t[1][3]>n||t[2][0]*r[0]+t[2][1]*r[1]+t[2][2]*r[2]+t[2][3]>n||t[3][0]*r[0]+t[3][1]*r[1]+t[3][2]*r[2]+t[3][3]>n}_includeNearBoundingInfoRec(e,t,r,s){if(null==t)return;i(D.center,t.sphere.center,r),D.radius=t.sphere.radius*f(r);const{frustum:a}=e;if(this._isOutsideSidePlanes(D,a))return;const o=D.radius,{viewMatrix:h}=e,c=n(D.center,h),u=c+o;if(!(-(c-o)<2||-u>=s.near))if(-u>this._looseRange.near)s.near=-u;else{if(o>d){const n=t.children;if(void 0!==n){for(const t of n)this._includeNearBoundingInfoRec(e,t,r,s);return}}N.unionDepthRangeWithAABB(s,e.viewProjectionMatrix,r,t.box)}}_includeFarBoundingInfoRec(e,t,r,s){if(null==t)return;i(D.center,t.sphere.center,r),D.radius=t.sphere.radius*f(r);const{frustum:a}=e;if(this._isOutsideSidePlanes(D,a))return;const{viewMatrix:o,viewProjectionMatrix:h}=e,c=n(D.center,o)-D.radius;if(!(-c<=s.far))if(-c<this._looseRange.far)s.far=-c;else{if(D.radius>d){const n=t.children;if(void 0!==n){for(const t of n)this._includeFarBoundingInfoRec(e,t,r,s);return}}N.unionDepthRangeWithAABB(s,h,r,t.box)}}}class B{constructor(){this._modelViewProj=r(),this._clipPosition=[a(),a(),a(),a(),a(),a(),a(),a()]}unionDepthRangeWithAABB(e,r,n,i){const s=this._modelViewProj;t(s,r,n);let a=!1;for(let t=0;t<8;++t){const e=this._clipPosition[t],r=0===t||3===t||4===t||7===t?i[0]:i[3],n=0===t||1===t||4===t||5===t?i[1]:i[4],a=t<4?i[2]:i[5];e[0]=s[0]*r+s[4]*n+s[8]*a+s[12],e[1]=s[1]*r+s[5]*n+s[9]*a+s[13],e[2]=s[2]*r+s[6]*n+s[10]*a+s[14],e[3]=s[3]*r+s[7]*n+s[11]*a+s[15]}for(let t=0;t<12;++t){const r=I(this._clipPosition[A[t][0]],this._clipPosition[A[t][1]],this._clipPosition[A[t][2]]);let n=!0;for(let e=0;e<r.length;++e){if(r[e][3]>=2){n=!1;break}}if(!n){a=!0;for(let t=0;t<r.length;++t){const n=r[t][3];Number.isFinite(n)&&(e.near=Math.min(n,e.near),e.far=Math.max(n,e.far))}}}return a}}function I(e,t,r){let n=[e,t,r];for(let i=0;i<4;++i){const e=n;n=[];for(let t=0;t<e.length;++t){const r=e[t],s=e[(t+1)%e.length];P(s,i)?(P(r,i)||n.push(y(r,s,i)),n.push(s)):P(r,i)&&n.push(y(r,s,i))}}return n}function P(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void u(!1)}function y(e,t,r){let n=0;return 0===r?n=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?n=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?n=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(n=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),s(a(),e,t,n)}const A=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],D=new h,E=r(),S=new c,F=new M,W=new C,N=new B;export{p as depthRangeFromScene};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as t,scale as r,add as e,dist as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{area3dFromValues as i}from"../../../../geometry/support/triangle.js";function s(r,e,n=e?.indices){if(!e||!n)return!1;const{size:o,data:i}=e,s=(r,e,s,c)=>{const f=3*c,l=n[f]*o,u=n[f+1]*o,a=n[f+2]*o;t(r,i[l],i[l+1],i[l+2]),t(e,i[u],i[u+1],i[u+2]),t(s,i[a],i[a+1],i[a+2])};return c(r,n.length/3,s)}function c(n,o,s){t(n,0,0,0),t(g,0,0,0);let c=0,f=0;for(let t=0;t<o;++t){s(u,a,m,t);const o=i(u,a,m);o?(e(u,u,a),e(u,u,m),r(u,u,1/3*o),e(n,n,u),c+=o):(e(g,g,u),e(g,g,a),e(g,g,m),f+=3)}return(0!==f||0!==c)&&(0!==c?(r(n,n,1/c),!0):0!==f&&(r(n,g,1/f),!0))}function f(e,n,o=n?.indices){if(!n||!o)return!1;const{size:i,data:s}=n;t(e,0,0,0);let c=-1,f=0;for(let t=0;t<o.length;t++){const r=o[t]*i;c!==r&&(e[0]+=s[r],e[1]+=s[r+1],e[2]+=s[r+2],f++),c=r}return f>1&&r(e,e,1/f),f>0}function l(o,i,s,c=i?.indices){if(!i||!c)return!1;t(o,0,0,0),t(g,0,0,0);let f=0,l=0;const{size:m,data:d}=i,p=c.length-1,h=p+(s?2:0);for(let t=0;t<h;t+=2){const i=t<p?t+1:0,s=c[t<p?t:p]*m,h=c[i]*m;u[0]=d[s],u[1]=d[s+1],u[2]=d[s+2],a[0]=d[h],a[1]=d[h+1],a[2]=d[h+2],r(u,e(u,u,a),.5);const j=n(u,a);j>0?(e(o,o,r(u,u,j)),f+=j):0===f&&(e(g,g,u),l++)}return 0!==f?(r(o,o,1/f),!0):0!==l&&(r(o,g,1/l),!0)}const u=o(),a=o(),m=o(),g=o();export{l as computeAttachmentOriginLines,f as computeAttachmentOriginPoints,s as computeAttachmentOriginTriangles,c as computeAttachmentOriginTrianglesReader};
2
+ import{set as t,add as r,scale as o,dist as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{area3dFromValues as c}from"../../../../geometry/support/triangle.js";function i(e,n,i){if(i<=0)return!1;t(e,0,0,0),t(a,0,0,0);let f=0,s=0;for(let t=0;t<i;++t){const i=3*t;n(l,i),n(m,i+1),n(u,i+2);const p=c(l,m,u);p?(r(l,l,m),r(l,l,u),o(l,l,1/3*p),r(e,e,l),f+=p):(r(a,a,l),r(a,a,m),r(a,a,u),s+=3)}return(0!==s||0!==f)&&(0!==f?(o(e,e,1/f),!0):0!==s&&(o(e,a,1/s),!0))}function f(r,e,n){if(n<=0)return!1;t(r,0,0,0);let c=NaN,i=NaN,f=NaN,s=0;for(let t=0;t<n;t++){const o=e(l,t);o[0]===c&&o[1]===i&&o[2]===f||(r[0]+=o[0],r[1]+=o[1],r[2]+=o[2],s++),c=o[0],i=o[1],f=o[2]}return s>1&&o(r,r,1/s),s>0}function s(n,c,i,f){if(i<=0)return!1;t(n,0,0,0),t(a,0,0,0);let s=0,u=0;const p=i-1,N=p+(f?2:0);for(let t=0;t<N;t+=2){const i=t<p?t+1:0;c(l,t<p?t:p),c(m,i),o(l,r(l,l,m),.5);const f=e(l,m);f>0?(r(n,n,o(l,l,f)),s+=f):0===s&&(r(a,a,l),u++)}return 0!==s?(o(n,n,1/s),!0):0!==u&&(o(n,a,1/u),!0)}const l=n(),m=n(),u=n(),a=n();export{s as computeAttachmentOriginLines,f as computeAttachmentOriginPoints,i as computeAttachmentOriginTriangles};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isSome as e}from"../../../../../core/arrayUtils.js";import{isAborted as o,throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{create as t}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as s,expandWithAABB as r,center as i,diameter as c}from"../../../../../geometry/support/aaBoundingBox.js";import{getEmissions as u}from"../../effects/emissive/emissions.js";import{LodComponentData as m}from"./LodComponentData.js";class a{static async create(t,s,r){const i=await Promise.allSettled(s.components.map(e=>t.controller.schedule(()=>new m(t,e.geometry),r))),c=i.map(e=>"fulfilled"===e.status?e.value:null).filter(e);if(o(r)||c.length!==i.length){c.forEach(e=>e.destroy()),n(r);for(const e of i)if("rejected"===e.status)throw e.reason}return new a(s.minScreenSpaceRadius,c)}constructor(e,o){this.minScreenSpaceRadius=e,this.components=o}destroy(){this.components.forEach(e=>e.destroy())}intersect(e,o,n,t,s,r,i){this.components.forEach(c=>c.intersect(e,o,n,t,s,r,this.boundingSphere,i))}*intersectScreenPolygon(e,o,n,t,s){for(const r of this.components)r.intersectScreenPolygon(e,o,n,t,this.boundingSphere,s),yield}get boundingBox(){if(null==this._boundingBox){const e=s();this.components.forEach(o=>{const{boundingInfo:n}=o;null!=n&&r(e,n.boundingBox)}),this._boundingBox=e}return this._boundingBox}get boundingSphere(){if(null==this._boundingSphere){const e=this.boundingBox,o=t();i(e,o),this._boundingSphere={center:o,radius:.5*c(e)}}return this._boundingSphere}get triangleCount(){return this.components.reduce((e,o)=>e+o.numTriangles,0)}get emissions(){return u(this.components)}}export{a as LodLevel};
2
+ import{isSome as e}from"../../../../../core/arrayUtils.js";import{isAborted as o,throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as s,expandWithAABB as r,center as i,diameter as c}from"../../../../../geometry/support/aaBoundingBox.js";import{getEmissions as u}from"../../effects/emissive/emissions.js";import{LodComponentData as m}from"./LodComponentData.js";class a{static async create(n,s,r){const i=await Promise.allSettled(s.components.map(e=>n.controller.schedule(()=>new m(n,e.geometry),r))),c=i.map(e=>"fulfilled"===e.status?e.value:null).filter(e);if(o(r)||c.length!==i.length){c.forEach(e=>e.destroy()),t(r);for(const e of i)if("rejected"===e.status)throw e.reason}return new a(s.minScreenSpaceRadius,c)}constructor(e,o){this.minScreenSpaceRadius=e,this.components=o}destroy(){this.components.forEach(e=>e.destroy())}intersect(e,o,t,n,s,r,i){this.components.forEach(c=>c.intersect(e,o,t,n,s,r,this.boundingSphere,i))}*intersectScreenPolygon(e,o,t,n,s){for(const r of this.components)r.intersectScreenPolygon(e,o,t,n,this.boundingSphere,s),yield}get boundingBox(){if(null==this._boundingBox){const e=s();this.components.forEach(o=>{const{boundingInfo:t}=o;null!=t&&r(e,t.box)}),this._boundingBox=e}return this._boundingBox}get boundingSphere(){if(null==this._boundingSphere){const e=this.boundingBox,o=n();i(e,o),this._boundingSphere={center:o,radius:.5*c(e)}}return this._boundingSphere}get triangleCount(){return this.components.reduce((e,o)=>e+o.numTriangles,0)}get emissions(){return u(this.components)}}export{a as LodLevel};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import t from"../../../../core/PooledArray.js";import{createScreenPointArray as e}from"../../../../core/screenUtils.js";import{copy as o,distance as r,squaredDistance as n,set as i,transformMat4 as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as a,create as u}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as c}from"../../../../geometry/support/frustum.js";import{clipPolygon as m}from"../../../../geometry/support/plane.js";import{normalFromValues as f,closestPointFromValues as p}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as d}from"./intersectionConstants.js";import{screenPolygonIntersectsTriangle as h}from"./screenPolygonOverlapUtils.js";class I{constructor(t){this.primitiveIndex=t}}class g{constructor(t){this.type=t,this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=l(),this.normal=l()}reset(){this.distance=Number.POSITIVE_INFINITY,this.hasNormal=!1}update(t,e,r,n){this.distance=t,this.primitiveIndex=e,o(this.point,r),this.hasNormal=null!=n,null!=n&&o(this.normal,n)}updateIfCloserFromValues(t,e,o,r){t<this.distance&&this.update(t,e,o,r)}updateIfCloser(t){const{distance:e,primitiveIndex:o,point:r,normal:n}=t;this.updateIfCloserFromValues(e,o,r,t.hasNormal?n:null)}get valid(){return Number.isFinite(this.distance)}}function y(t,e,o,r,n){if(!t.visible||0!==t.type)return null;const i=new g(4);let s;if(t.boundingInfo)s=j(t.boundingInfo,e,o,r,n);else{const i=t.positionAttribute,l=t.primitivePositionIndices;s=v(e,o,r,0,l.length/3,l,i.data,i.stride,n,null,0)}for(const l of s)i.updateIfCloser(l);return i.valid?i:null}function b(t,e,o,r,n){const i=new g(4);for(const s of N(t,e,o,r,n))i.updateIfCloser(s);return i.valid?i:null}function*v(t,e,o,r,n,i,s,l,a,u=null,c=0){const m=(t,o,r,n)=>{const m=(u?.[n]??n)+c,f=null==u?m:n,p=3*m;return x(t,i,s,l,p+0,a,f,e),x(o,i,s,l,p+1,a,f,e),x(r,i,s,l,p+2,a,f,e),m};return yield*N(t,o,r,n,m)}function*N(t,e,o,n,i){if(null==t.camera)return;const{camera:s,screenPolygonPrimitiveProcessor:l}=t;for(let a=o;a<n;++a){const t=i(V[0],V[1],V[2],a),o=O;let n;E.reset();const u=w;for(const i of l.processTriangle(V))if(u.length=0,m(s.frustum[4],i,()=>u.pushNew(),!1),!(u.length<3)){for(let t=0;t<u.length;t++)s.projectToScreen(u.at(t),A[t]);P(e,A,u.length)&&(T(s.eye,u,B),null==n&&(n=f(O,V[0],V[1],V[2])),E.updateIfCloserFromValues(r(s.eye,B),t,B,n?o:null))}E.valid&&(yield E)}}function*j(t,e,o,r,n){let i;if(null!=n?(a(F,t.boundingBox),n.applyToAabb(F),i=c(r.broadPhaseFrustum,F,o)):i=c(r.broadPhaseFrustum,t.boundingBox,o),!i)return;const{primitiveIndices:s,position:l}=t,u=s?s.length:l.indices.length/3;if(u>d){const i=t.children;if(void 0!==i){for(const t of i)yield*j(t,e,o,r,n);return}}yield*v(e,o,r,0,u,l.indices,l.data,l.stride,n,s,0)}function x(t,e,o,r,n,l,a,u){const c=r*e[n],m=o[c+0],f=o[c+1],p=o[c+2];null!=l?l.applyToVertex(t,m,f,p,a):i(t,m,f,p),u&&s(t,t,u)}function P(t,e,o){for(let r=1;r<o-1;r++)if(h(t,e[0],e[r],e[r+1]))return!0;return!1}function T(t,e,r){let i=Number.POSITIVE_INFINITY;const s=e.at(0);for(let l=1;l<e.length-1;l++){p(S,t,s,e.at(l),e.at(l+1));const a=n(t,S);a<i&&(i=a,o(r,S))}}const F=u(),C=12,V=[l(),l(),l()],w=new t({allocator:t=>t??l()}),A=Array.from({length:C},()=>e()),B=l(),O=l(),S=l(),E=new g(4);export{I as DrapedHit,g as Hit,v as forEachTriangleRangeScreenPolygonHit,N as forEachTriangleReaderRangeScreenPolygonHit,y as intersectTriangleGeometryScreenPolygon,b as intersectTriangleReaderRangeScreenPolygon};
2
+ import t from"../../../../core/PooledArray.js";import{createScreenPointArray as e}from"../../../../core/screenUtils.js";import{copy as r,distance as o,squaredDistance as n,set as i,transformMat4 as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{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,o,n){this.distance=t,this.primitiveIndex=e,r(this.point,o),this.hasNormal=null!=n,null!=n&&r(this.normal,n)}updateIfCloserFromValues(t,e,r,o){t<this.distance&&this.update(t,e,r,o)}updateIfCloser(t){const{distance:e,primitiveIndex:r,point:o,normal:n}=t;this.updateIfCloserFromValues(e,r,o,t.hasNormal?n:null)}get valid(){return Number.isFinite(this.distance)}}function y(t,e,r,o,n){if(!t.visible||0!==t.type)return null;const i=new g(4);let s;s=t.boundingInfo?P(t.readPrimitivePosition,t.boundingInfo,e,r,o,n):b(e,r,o,0,t.faceCount,t.readPrimitivePosition,n,null,0);for(const l of s)i.updateIfCloser(l);return i.valid?i:null}function v(t,e,r,o,n){const i=new g(4);for(const s of N(t,e,r,o,n))i.updateIfCloser(s);return i.valid?i:null}function*b(t,e,r,o,n,i,s,l=null,a=0){const u=(t,r,o,n)=>{const u=(l?.[n]??n)+a,c=null==l?u:n,m=3*u;return j(t,i,m+0,s,c,e),j(r,i,m+1,s,c,e),j(o,i,m+2,s,c,e),u};return yield*N(t,r,o,n,u)}function*N(t,e,r,n,i){if(null==t.camera)return;const{camera:s,screenPolygonPrimitiveProcessor:l}=t;for(let a=r;a<n;++a){const t=i(V[0],V[1],V[2],a),r=A;let n;Y.reset();const u=w;for(const i of l.processTriangle(V))if(u.length=0,m(s.frustum[4],i,()=>u.pushNew(),!1),!(u.length<3)){for(let t=0;t<u.length;t++)s.projectToScreen(u.at(t),O[t]);x(e,O,u.length)&&(T(s.eye,u,S),null==n&&(n=f(A,V[0],V[1],V[2])),Y.updateIfCloserFromValues(o(s.eye,S),t,S,n?r:null))}Y.valid&&(yield Y)}}function*P(t,e,r,o,n,i){let s;if(null!=i?(a(F,e.box),i.applyToAabb(F),s=c(n.broadPhaseFrustum,F,o)):s=c(n.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*P(t,e,r,o,n,i);return}}yield*b(r,o,n,0,u,t,i,l,0)}function j(t,e,r,o,n,l){const[a,u,c]=e(t,r);null!=o?o.applyToVertex(t,a,u,c,n):i(t,a,u,c),l&&s(t,t,l)}function x(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 T(t,e,o){let i=Number.POSITIVE_INFINITY;const s=e.at(0);for(let l=1;l<e.length-1;l++){p(E,t,s,e.at(l),e.at(l+1));const a=n(t,E);a<i&&(i=a,r(o,E))}}const F=u(),C=12,V=[l(),l(),l()],w=new t({allocator:t=>t??l()}),O=Array.from({length:C},()=>e()),S=l(),A=l(),E=l(),Y=new g(4);export{I as DrapedHit,g as Hit,b as forEachTriangleRangeScreenPolygonHit,N as forEachTriangleReaderRangeScreenPolygonHit,y as intersectTriangleGeometryScreenPolygon,v as intersectTriangleReaderRangeScreenPolygon};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{BufferViewUint32 as t,BufferViewVec3f as e,BufferViewVec2Snorm16 as i,BufferViewSnorm16 as r,BufferViewFloat16 as s,BufferViewFloat as o,BufferViewVec2f as a,BufferViewVec4Unorm8 as n,BufferViewUnorm8 as h}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as c}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as u,is3DGeometry as f,isColor as p}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as l}from"../effects/geometry/olidUtils.js";import g from"../lib/GLMaterial.js";import{isPathGeometry as m}from"../lib/PathGeometry.js";import{offsetPathVertexInfoFrameIndex as d}from"../lib/PathVertexInfo.js";import{MeshIntersectionOptions as y,intersectAabbInvDir as b}from"../lib/RayIntersections.js";import{assert as _}from"../lib/Util.js";import{applyPolygonOffsetToHit as S}from"./intersectWithPolygonOffset.js";import{getLayout as w,getTextureLayout as F}from"./PathLayouts.js";import{PathPassParameters as P,PathTechnique as V}from"./PathTechnique.js";import{PathTechniqueConfiguration as x}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as C}from"./TriangleMaterial.js";import{writeAttributes as R,writePosition as j,writeBufferVec2 as z,writeBufferInt16 as B,writeBufferFloat16 as O,writeBufferFloat as v,writeColor as A,writeBufferUint8 as T,writeOlidColor as M}from"./internal/bufferWriterUtils.js";import{hasShadowHighlights as I}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as U}from"../../../../webscene/support/AlphaCutoff.js";class L extends C{constructor(t,e){super(t,D),this.supportsEdges=!0,this.produces=new Map([[2,t=>(this.parameters.castShadows&&u(t)||f(t))&&!this.transparent],[4,t=>(this.parameters.castShadows&&u(t)||f(t))&&this.transparent]]),this._configuration=new x(e.spherical)}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(t){super.updateConfiguration(t),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?0:this.parameters.cullFace,this._configuration.offsetBackfaces=this.transparent,p(t.output)?(this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.hasShadowHighlights=I(this._configuration,t),this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.snowCover=t.snowCover>0,this._configuration.upVectorAlignment=this.parameters.upVectorAlignment,this._configuration.pathCapType=this.parameters.pathCapType,this._configuration.pathProfileType=this.parameters.profile.type,this._configuration.hasPathSize=this.parameters.hasPathSize,this._configuration.hasPathColor=this.parameters.hasPathColor,this._configuration.hasPathOpacity=this.parameters.hasPathOpacity}isVisibleForOutput(t){return 5!==t&&7!==t&&6!==t||this.parameters.castShadows}get visible(){return this.parameters.opacity>=U}intersectRay(t,e,i,r,s,o){this._intersectRay(t,i,r,s,o)}intersectRayDraped(){}intersectScreenPolygonDraped(){return null}intersectScreenPolygon(t,e,i,r){return m(t)?S(t.intersectScreenPolygon(i,e,r),this._configuration,i.camera.eye):null}_intersectRay(t,e,i,r,s){if(!m(t))return;const o=new y(e.tolerance,!1,e.options.normalRequired),a=t.boundingInfo;if(null==a)return void t.intersectRay(i,r,o,s);const n=a.boundingBox,h=[r[0]-i[0],r[1]-i[1],r[2]-i[2]],c=Math.sqrt(h[0]*h[0]+h[1]*h[1]+h[2]*h[2]),u=[c/h[0],c/h[1],c/h[2]];b(n,i,u,e.tolerance)&&t.intersectRay(i,r,o,s)}createBufferWriter(){return new G(w(),F(this.parameters))}createGLMaterial(t){return new q(t)}get transparent(){const{parameters:t}=this;return t.drivenOpacity||t.opacity<1}}class q extends g{beginSlot(t){return this.getTechnique(V,t)}}class D extends P{constructor(){super(...arguments),this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1,this.upVectorAlignment=0,this.pathCapType=1,this.cullFace=2}}class G{constructor(t,e){this.layout=t,this.textureBufferLayout=e,this.maxTextureBufferItemIndex=c}elementCount(t){return t.get("pathVertexInfo")?.indices.length??0}elementCountTextureBuffer(t){return t.get("position")?.indices.length??0}write(t,e,i,r,s,o,a){null!=s&&this._writeVertexBuffer(t,e,i,s,o),null!=a&&this._writeTextureBuffer(t,i,r,a)}_writeVertexBuffer(e,i,r,s,o){R(r,null,this.layout,e,i,s);const a=o?.from??0,n=s.buffer.getField("pathVertexInfo",t),h=r.get("pathVertexInfo");if(n&&h){_(1===h.size);const{data:t,stride:e,indices:i}=h;for(let r=0;r<i.length;++r){const o=t[e*i[r]];n.set(s.offset+r,d(o,a))}}}_writeTextureBuffer(t,c,u,f){const p=f.offset,g=f.buffer.getField("position",e),m=c.get("position");g&&m&&(_(3===m.size),j(m,t,g,p));const d=f.buffer.getField("profileRight",i),y=c.get("profileRight");d&&y&&(_(2===y.size),z(y,d,p));const b=f.buffer.getField("profileUp",i),S=c.get("profileUp");b&&S&&(_(2===S.size),z(S,b,p));const w=f.buffer.getField("profileRotation",r),F=c.get("profileRotation");w&&F&&(_(1===F.size),B(F,w,p));const P=f.buffer.getField("pathRotationUp",i),V=c.get("pathRotationUp");P&&V&&(_(2===V.size),z(V,P,p));const x=f.buffer.getField("pathMaxStretchDistance",s),C=c.get("pathMaxStretchDistance");x&&C&&(_(1===C.size),O(C,x,p));const R=f.buffer.getField("sizeFeatureAttribute",o),I=c.get("sizeFeatureAttribute");R&&I&&v(I,R,p);const U=f.buffer.getField("size",a),L=c.get("size");U&&L&&(_(2===L.size),z(L,U,p));const q=f.buffer.getField("colorFeatureAttribute",o),D=c.get("colorFeatureAttribute");q&&D&&v(D,q,p);const G=f.buffer.getField("color",n),W=c.get("color");G&&W&&A(W,4,G,p);const H=f.buffer.getField("opacityFeatureAttribute",o),k=c.get("opacityFeatureAttribute");H&&k&&v(k,H,p);const E=f.buffer.getField("opacity",h),J=c.get("opacity");if(E&&J&&(_(1===J.size),T(J,E,p)),l()){const t=f.buffer.getField("olidColor",n),e=m?.indices.length??0;u&&t&&e&&M(u,t,e,p)}}}export{D as Parameters,G as PathBufferWriter,L as PathMaterial};
2
+ import{BufferViewUint32 as t,BufferViewVec3f as e,BufferViewVec2Snorm16 as i,BufferViewSnorm16 as r,BufferViewFloat16 as s,BufferViewFloat as o,BufferViewVec2f as a,BufferViewVec4Unorm8 as n,BufferViewUnorm8 as h}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as c}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as u,is3DGeometry as f,isColor as p}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as l}from"../effects/geometry/olidUtils.js";import g from"../lib/GLMaterial.js";import{isPathGeometry as m}from"../lib/PathGeometry.js";import{offsetPathVertexInfoFrameIndex as d}from"../lib/PathVertexInfo.js";import{MeshIntersectionOptions as y,intersectAabbInvDir as b}from"../lib/RayIntersections.js";import{assert as _}from"../lib/Util.js";import{applyPolygonOffsetToHit as S}from"./intersectWithPolygonOffset.js";import{getLayout as w,getTextureLayout as F}from"./PathLayouts.js";import{PathPassParameters as P,PathTechnique as V}from"./PathTechnique.js";import{PathTechniqueConfiguration as x}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as C}from"./TriangleMaterial.js";import{writeAttributes as R,writePosition as j,writeBufferVec2 as z,writeBufferInt16 as O,writeBufferFloat16 as B,writeBufferFloat as v,writeColor as A,writeBufferUint8 as T,writeOlidColor as M}from"./internal/bufferWriterUtils.js";import{hasShadowHighlights as I}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as U}from"../../../../webscene/support/AlphaCutoff.js";class L extends C{constructor(t,e){super(t,D),this.supportsEdges=!0,this.produces=new Map([[2,t=>(this.parameters.castShadows&&u(t)||f(t))&&!this.transparent],[4,t=>(this.parameters.castShadows&&u(t)||f(t))&&this.transparent]]),this._configuration=new x(e.spherical)}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(t){super.updateConfiguration(t),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?0:this.parameters.cullFace,this._configuration.offsetBackfaces=this.transparent,p(t.output)?(this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.hasShadowHighlights=I(this._configuration,t),this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.snowCover=t.snowCover>0,this._configuration.upVectorAlignment=this.parameters.upVectorAlignment,this._configuration.pathCapType=this.parameters.pathCapType,this._configuration.pathProfileType=this.parameters.profile.type,this._configuration.hasPathSize=this.parameters.hasPathSize,this._configuration.hasPathColor=this.parameters.hasPathColor,this._configuration.hasPathOpacity=this.parameters.hasPathOpacity}isVisibleForOutput(t){return 5!==t&&7!==t&&6!==t||this.parameters.castShadows}get visible(){return this.parameters.opacity>=U}intersectRay(t,e,i,r,s,o){this._intersectRay(t,i,r,s,o)}intersectRayDraped(){}intersectScreenPolygonDraped(){return null}intersectScreenPolygon(t,e,i,r){return m(t)?S(t.intersectScreenPolygon(i,e,r),this._configuration,i.camera.eye):null}_intersectRay(t,e,i,r,s){if(!m(t))return;const o=new y(e.tolerance,!1,e.options.normalRequired),a=t.boundingInfo;if(null==a)return void t.intersectRay(i,r,o,s);const n=a.box,h=[r[0]-i[0],r[1]-i[1],r[2]-i[2]],c=Math.sqrt(h[0]*h[0]+h[1]*h[1]+h[2]*h[2]),u=[c/h[0],c/h[1],c/h[2]];b(n,i,u,e.tolerance)&&t.intersectRay(i,r,o,s)}createBufferWriter(){return new G(w(),F(this.parameters))}createGLMaterial(t){return new q(t)}get transparent(){const{parameters:t}=this;return t.drivenOpacity||t.opacity<1}}class q extends g{beginSlot(t){return this.getTechnique(V,t)}}class D extends P{constructor(){super(...arguments),this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1,this.upVectorAlignment=0,this.pathCapType=1,this.cullFace=2}}class G{constructor(t,e){this.layout=t,this.textureBufferLayout=e,this.maxTextureBufferItemIndex=c}elementCount(t){return t.get("pathVertexInfo")?.indices.length??0}elementCountTextureBuffer(t){return t.get("position")?.indices.length??0}write(t,e,i,r,s,o,a){null!=s&&this._writeVertexBuffer(t,e,i,s,o),null!=a&&this._writeTextureBuffer(t,i,r,a)}_writeVertexBuffer(e,i,r,s,o){R(r,null,this.layout,e,i,s);const a=o?.from??0,n=s.buffer.getField("pathVertexInfo",t),h=r.get("pathVertexInfo");if(n&&h){_(1===h.size);const{data:t,stride:e,indices:i}=h;for(let r=0;r<i.length;++r){const o=t[e*i[r]];n.set(s.offset+r,d(o,a))}}}_writeTextureBuffer(t,c,u,f){const p=f.offset,g=f.buffer.getField("position",e),m=c.get("position");g&&m&&(_(3===m.size),j(m,t,g,p));const d=f.buffer.getField("profileRight",i),y=c.get("profileRight");d&&y&&(_(2===y.size),z(y,d,p));const b=f.buffer.getField("profileUp",i),S=c.get("profileUp");b&&S&&(_(2===S.size),z(S,b,p));const w=f.buffer.getField("profileRotation",r),F=c.get("profileRotation");w&&F&&(_(1===F.size),O(F,w,p));const P=f.buffer.getField("pathRotationUp",i),V=c.get("pathRotationUp");P&&V&&(_(2===V.size),z(V,P,p));const x=f.buffer.getField("pathMaxStretchDistance",s),C=c.get("pathMaxStretchDistance");x&&C&&(_(1===C.size),B(C,x,p));const R=f.buffer.getField("sizeFeatureAttribute",o),I=c.get("sizeFeatureAttribute");R&&I&&v(I,R,p);const U=f.buffer.getField("size",a),L=c.get("size");U&&L&&(_(2===L.size),z(L,U,p));const q=f.buffer.getField("colorFeatureAttribute",o),D=c.get("colorFeatureAttribute");q&&D&&v(D,q,p);const G=f.buffer.getField("color",n),W=c.get("color");G&&W&&A(W,4,G,p);const H=f.buffer.getField("opacityFeatureAttribute",o),k=c.get("opacityFeatureAttribute");H&&k&&v(k,H,p);const E=f.buffer.getField("opacity",h),J=c.get("opacity");if(E&&J&&(_(1===J.size),T(J,E,p)),l()){const t=f.buffer.getField("olidColor",n),e=m?.indices.length??0;u&&t&&e&&M(u,t,e,p)}}}export{D as Parameters,G as PathBufferWriter,L as PathMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{toConst as r}from"../../../../core/compilerUtils.js";import{unpackFloatRGBA as i}from"../../../../core/floatRGBA.js";import has from"../../../../core/has.js";import s from"../../../../core/Logger.js";import{removeMaybe as n,destroyMaybe as o}from"../../../../core/maybe.js";import{when as a,initial as h,watch as l,syncAndInitial as d}from"../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../core/scheduling.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as m}from"../../../../core/time.js";import{property as u,subclass as f}from"../../../../core/accessorSupport/decorators.js";import{isMoon as g,isMars as w}from"../../../../geometry/ellipsoidUtils.js";import{debugFlags as _}from"../../support/debugFlags.js";import{ComponentObjectCollection as v}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueConstructionContext as x}from"../core/shaderTechnique/ShaderTechniqueConstructionContext.js";import{ShaderTechniqueRepository as y}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{ChapmanAtmosphere as j}from"../effects/atmosphere/ChapmanAtmosphere.js";import{LocalAtmosphere as b}from"../effects/atmosphere/LocalAtmosphere.js";import{MarsAtmosphere as R}from"../effects/atmosphere/MarsAtmosphere.js";import{CloudsComposition as A}from"../effects/clouds/CloudsComposition.js";import{Fog as C}from"../effects/fog/Fog.js";import{ObjectAndLayerID as S}from"../effects/geometry/ObjectAndLayerID.js";import{olidEnabled as T}from"../effects/geometry/olidUtils.js";import{RenderOccluded as U}from"../effects/geometry/RenderOccluded.js";import{GlobalIllumination as M}from"../effects/globalIllumination/GlobalIllumination.js";import{Glow as O}from"../effects/glow/Glow.js";import{Haze as q}from"../effects/haze/Haze.js";import{Highlight as D}from"../effects/highlight/Highlight.js";import{ShadowHighlight as L}from"../effects/highlight/ShadowHighlight.js";import{ShadowHighlightBuffer as F}from"../effects/highlight/ShadowHighlightBuffer.js";import{Magnifier as k}from"../effects/magnifier/Magnifier.js";import{SMAA as W}from"../effects/smaa/SMAA.js";import{SSAO as B}from"../effects/ssao/SSAO.js";import{Stars as E}from"../effects/stars/Stars.js";import{EmissionComposite as I}from"../lib/EmissionComposite.js";import{GLMaterialRepository as H}from"../lib/GLMaterialRepository.js";import{ObjectAndLayerIdRenderHelper as G}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as P}from"../lib/Renderer.js";import{RenderingContext as N}from"../lib/RenderingContext.js";import{RenderingContextOptions as z}from"../lib/RenderingContextOptions.js";import{TextureRepository as V}from"../lib/TextureRepository.js";import{createMarkerTextureRepository as X}from"../materials/markerTextureRepository.js";import{createStippleTextureRepository as Q}from"../materials/stippleTextureRepository.js";import{WaterTextureRepository as J}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as K}from"./contextCache.js";import{removeLoadedShaderModules as Y}from"./renderUtils.js";import{ScreenshotManager as Z,ScreenshotContext as $}from"./ScreenshotManager.js";import{contextCache as ee}from"./testUtils.js";import{noBudget as te}from"../../../support/Scheduler.js";import{checkWebGLError as re}from"../../../webgl/checkWebGLError.js";const ie=has("disable-feature:async-navigation-3d-depth-readback");let se=class extends t{constructor(e,t){super(e),this.olidRenderHelper=T()?new G:null,this.waterTextures=new J,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this.glow=null,this._fog=c(null),this.globalIllumination=null,this.test=null,this._initializeContext(t);const{memoryController:r}=t.view.resourceController;this.stippleTextures=Q(this._rctx,r),this.markerTextures=X(this._rctx,r),this.techniques=new y(new x(this._rctx,this.stippleTextures,this.waterTextures,this.markerTextures)),this.textures=new V(t),this.addHandles(this.textures.events.on("changed",e=>this.requestRender(e)));const i=new H(this.textures,this.techniques,()=>this.requestRender(),()=>this.requestRender());this.renderer=new P(t,i,this.techniques,this._rctx,e=>this.requestRender(e)),this.addHandles([a(()=>t.view.ready,()=>this._createRenderNodes(),h),l(()=>this.waterTextures.updating,()=>this.requestRender(),h),l(()=>t.view.qualityProfile,e=>this.renderer?.updateRenderFeatures(e),d)]);const s={renderScene:(e,t,r,i)=>(this.renderer.setTime(t),this.renderer.render(e,r,i)),requestRenderScene:e=>this.requestRender(e),prepareOverlay:()=>t.options.screenshot.prepareOverlay(),renderOverlay:(e,r,i)=>t.options.screenshot.renderOverlay(e,r,i)};this._screenshotManager=new Z(this._rctx,s,e=>t.view.overlayManager.updateOverlays(te,e.camera,0)),this._registerFrameTask(t)}destroy(){const e=this.stage?.container;e?.contains(this._canvas)&&e.removeChild(this._canvas),this._frameTask=n(this._frameTask),this.techniques.destroy(),this._componentObjectCollection=o(this._componentObjectCollection),this._screenshotManager.destroy(),this.renderer.destroy(),this.textures.destroy(),this.waterTextures.destroy(),this.markerTextures.destroy(),this.stippleTextures.destroy(),this._canvas=null,this._rctx=o(this._rctx),this.test?.destroy()}_createRenderNodes(){const{view:e,viewingMode:t}=this.stage;new E({view:e}),g(e.spatialReference)||(this.glow=new O({view:e}),2===t?new b({view:e}):w(e.spatialReference)?new R({view:e}):(new j({view:e}),new A({view:e}),new q({view:e}),this._fog.value=new C({view:e}))),has("enable-feature:global-illumination")?this.globalIllumination=new M({view:e}):new B({view:e}),new W({view:e,isEnabled:()=>this.renderer.hasSMAA}),new k({view:e}),new D({view:e}),new F({view:e}),new L({view:e,viewingMode:t}),new I({view:e}),new U({view:e}),T()&&new S({view:e})}requestRender(e=1){switch(e){case 2:this.view.state.fading=!0;case 1:this._needsUpdate=!0,this.globalIllumination?.resetAccumulatedFrames();case 0:this._needsRender=!0}}get updating(){const e=this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this.textures.updating||this.waterTextures.updating;return e&&_.UPDATING&&console.log(" RenderView:",this._needsUpdate,this._needsWaterReflectionUpdate,this.renderer.updating,this.textures.updating,this.waterTextures.updating),e}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(r(e))}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,t,r,i,s,n=s){let o=ie?this._readMainDepthSynchronously(t,r,i,s,n):this.renderer.navigationDepthCache.getMinimalDepthForArea(t,r,i,s,n)??Number.MAX_VALUE;if(e){const s=e.pickDepth(t*i.pixelRatio,r*i.pixelRatio,i);null!=s&&o>s&&s!==i.nearFar[0]&&s!==i.nearFar[1]&&(o=s)}return o===Number.MAX_VALUE?void 0:o}_readMainDepthSynchronously(e,t,r,i,s){const n=r.constrainWindowSize(e,t,i*r.pixelRatio,s*r.pixelRatio),o=this._ensureLinearDepthArrayBuffer(n);this.renderer.readMainDepth(n,o);let a=Number.MAX_VALUE;for(let h=0;h<n[2]*n[3];h++){const e=this._linearDepthFromTexture(4*h,o,r.nearFar);a>e&&e!==r.nearFar[0]&&e!==r.nearFar[1]&&(a=e)}return a}_linearDepthFromTexture(e,t,r){return i(t,e)*(r[1]-r[0])+r[0]}_ensureLinearDepthArrayBuffer(e){const t=4*e[2]*e[3];return(null==this._tmpDepthBuffer||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}async reloadShaders(){Y(),await this.techniques.reloadAll(),this.renderer.overlay?.reloadShaders(),this.requestRender()}_registerFrameTask(e){const t=e.view.state;let r=!1,i=0,s=!1;const n={preRender:({time:s})=>{r=this.updating,i=this._needsUpdate?1:0,this._needsRender&&this.renderer.updateSceneDepthRange(t.camera),e.commitSyncLayers(),s=this.test?.time??s;const n=m(s-this._lastAnimationUpdate);this.view.state.animationsEnabled&&(n>this.renderer.animationTimestep||r||this._needsRender)&&(this.renderer.updateAnimation(t,s)&&this.requestRender(0),this._lastAnimationUpdate=s)},render:({time:e})=>{if(e=this.test?.time??e,this.renderer.setTime(e),(this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const e=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,this.renderer.render(t,0),s=!0,e&&this.renderer.hasReflections&&(this.requestRender(0),this._needsWaterReflectionUpdate=!0)}},update:({time:e})=>{this.view.state.animationsEnabled&&this.textures.update();const r=new $(t,this.renderer.fboCache);e=this.test?.time??e,this._screenshotManager.update(r,e)},finish:()=>{s&&(this.renderer.finish(2===t.mode?i:1),s=!1)}};this._frameTask=p(n)}_initializeContext(e){const{options:t}=e,r=t.canvas??document.createElement("canvas");r.setAttribute("style","width: 100%; height:100%; display:block;"),this._canvas=r;const i={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:t.stencil??!0,powerPreference:"high-performance",preserveDrawingBuffer:t.preserveDrawingBuffer??!1},n=r.getContext("webgl2",i);if(null==n)return void s.getLogger(this).error("A WebGL2 context could not be created.");re(n,!0),this._rctx=ne(n,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&s.getLogger(this).error("WebGL context has alpha channel even though no alpha channel was requested");const{container:o}=e;!this._rctx.contextAttributes.alpha&&has("safari")>=11&&(o.style.backgroundColor="black"),o.contains(r)||o.appendChild(r)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("textureFloatLinear")}get _viewingMode(){return this.stage.viewingMode}get stage(){return this.view.stage}getObjectAndLayerIdColor(e){return this.olidRenderHelper?.getObjectAndLayerIdColor(e)}get componentObjectCollection(){return this._componentObjectCollection??=new v(this.renderer.renderPassManager,this._viewingMode,this.view.spatialReference.isWebMercator),this._componentObjectCollection}updateQualitySettings(e){null!=this.test?.time&&null!=e.fadeDuration&&(this.test.savedFadeDuration=e.fadeDuration,e.fadeDuration=m(0)),this._rctx.updateOptions({maxPreferredTexturePixels:this.view.qualitySettings.maxTexturePixels})}get fog(){return r(this._fog.value)}};function ne(e,t){const r=new z(t);if(ee.enabled){let t=oe.get(e);return 1===t?.refCount?(t.configure(r),t.ref(),t):(t=new N(e,r),oe.set(e,t),t.ref(),t)}return new N(e,r)}e([u({type:Boolean,readOnly:!0})],se.prototype,"updating",null),e([u({constructOnly:!0})],se.prototype,"view",void 0),e([u({readOnly:!0})],se.prototype,"componentObjectCollection",null),e([u()],se.prototype,"_componentObjectCollection",void 0),e([u()],se.prototype,"_needsUpdate",void 0),e([u()],se.prototype,"_needsWaterReflectionUpdate",void 0),se=e([f("esri.views.3d.webgl-engine.parts.RenderView")],se);const oe=K();export{se as RenderView};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{toConst as r}from"../../../../core/compilerUtils.js";import{unpackFloatRGBA as i}from"../../../../core/floatRGBA.js";import has from"../../../../core/has.js";import s from"../../../../core/Logger.js";import{removeMaybe as n,destroyMaybe as o}from"../../../../core/maybe.js";import{when as a,initial as h,watch as l,syncAndInitial as d}from"../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../core/scheduling.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as m}from"../../../../core/time.js";import{property as u,subclass as f}from"../../../../core/accessorSupport/decorators.js";import{isMoon as g,isMars as w}from"../../../../geometry/ellipsoidUtils.js";import{debugFlags as _}from"../../support/debugFlags.js";import{ComponentObjectCollection as v}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueConstructionContext as x}from"../core/shaderTechnique/ShaderTechniqueConstructionContext.js";import{ShaderTechniqueRepository as y}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{ChapmanAtmosphere as j}from"../effects/atmosphere/ChapmanAtmosphere.js";import{LocalAtmosphere as b}from"../effects/atmosphere/LocalAtmosphere.js";import{MarsAtmosphere as R}from"../effects/atmosphere/MarsAtmosphere.js";import{CloudsComposition as A}from"../effects/clouds/CloudsComposition.js";import{Fog as C}from"../effects/fog/Fog.js";import{ObjectAndLayerID as S}from"../effects/geometry/ObjectAndLayerID.js";import{olidEnabled as T}from"../effects/geometry/olidUtils.js";import{RenderOccluded as U}from"../effects/geometry/RenderOccluded.js";import{GlobalIllumination as D}from"../effects/globalIllumination/GlobalIllumination.js";import{Glow as M}from"../effects/glow/Glow.js";import{Haze as O}from"../effects/haze/Haze.js";import{Highlight as q}from"../effects/highlight/Highlight.js";import{ShadowHighlight as F}from"../effects/highlight/ShadowHighlight.js";import{ShadowHighlightBuffer as L}from"../effects/highlight/ShadowHighlightBuffer.js";import{Magnifier as k}from"../effects/magnifier/Magnifier.js";import{SMAA as W}from"../effects/smaa/SMAA.js";import{SSAO as B}from"../effects/ssao/SSAO.js";import{Stars as E}from"../effects/stars/Stars.js";import{EmissionComposite as I}from"../lib/EmissionComposite.js";import{GLMaterialRepository as H}from"../lib/GLMaterialRepository.js";import{ObjectAndLayerIdRenderHelper as G}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as P}from"../lib/Renderer.js";import{RenderingContext as N}from"../lib/RenderingContext.js";import{RenderingContextOptions as z}from"../lib/RenderingContextOptions.js";import{TextureRepository as V}from"../lib/TextureRepository.js";import{createMarkerTextureRepository as X}from"../materials/markerTextureRepository.js";import{createStippleTextureRepository as Q}from"../materials/stippleTextureRepository.js";import{WaterTextureRepository as J}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as K}from"./contextCache.js";import{removeLoadedShaderModules as Y}from"./renderUtils.js";import{ScreenshotManager as Z,ScreenshotContext as $}from"./ScreenshotManager.js";import{contextCache as ee}from"./testUtils.js";import{noBudget as te}from"../../../support/Scheduler.js";import{checkWebGLError as re}from"../../../webgl/checkWebGLError.js";const ie=has("disable-feature:async-navigation-3d-depth-readback");let se=class extends t{constructor(e,t){super(e),this.olidRenderHelper=T()?new G:null,this.waterTextures=new J,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this.glow=null,this._fog=c(null),this.globalIllumination=null,this.test=null,this._initializeContext(t);const{memoryController:r}=t.view.resourceController;this.stippleTextures=Q(this._rctx,r),this.markerTextures=X(this._rctx,r),this.techniques=new y(new x(this._rctx,this.stippleTextures,this.waterTextures,this.markerTextures)),this.textures=new V(t),this.addHandles(this.textures.events.on("changed",e=>this.requestRender(e)));const i=new H(this.textures,this.techniques,()=>this.requestRender(),()=>this.requestRender());this.renderer=new P(t,i,this.techniques,this._rctx,e=>this.requestRender(e)),this.addHandles([a(()=>t.view.ready,()=>this._createRenderNodes(),h),l(()=>this.waterTextures.updating,()=>this.requestRender(),h),l(()=>t.view.qualityProfile,e=>this.renderer?.updateRenderFeatures(e),d)]);const s={renderScene:(e,t,r,i)=>(this.renderer.setTime(t),this.renderer.render(e,r,i)),requestRenderScene:e=>this.requestRender(e),prepareOverlay:()=>t.options.screenshot.prepareOverlay(),renderOverlay:(e,r,i)=>t.options.screenshot.renderOverlay(e,r,i)};this._screenshotManager=new Z(this._rctx,s,e=>t.view.overlayManager.updateOverlays(te,e.camera,0)),this._registerFrameTask(t)}destroy(){const e=this.stage?.container;e?.contains(this._canvas)&&e.removeChild(this._canvas),this._frameTask=n(this._frameTask),this.techniques.destroy(),this._componentObjectCollection=o(this._componentObjectCollection),this._screenshotManager.destroy(),this.renderer.destroy(),this.textures.destroy(),this.waterTextures.destroy(),this.markerTextures.destroy(),this.stippleTextures.destroy(),this._canvas=null,this._rctx=o(this._rctx),this.test?.destroy()}_createRenderNodes(){const{view:e,viewingMode:t}=this.stage;new E({view:e}),g(e.spatialReference)||(this.glow=new M({view:e}),2===t?new b({view:e}):w(e.spatialReference)?new R({view:e}):(new j({view:e}),new A({view:e}),new O({view:e}),this._fog.value=new C({view:e}))),has("enable-feature:global-illumination")?this.globalIllumination=new D({view:e}):new B({view:e}),new W({view:e,isEnabled:()=>this.renderer.hasSMAA}),new k({view:e}),new q({view:e}),new L({view:e}),new F({view:e,viewingMode:t}),new I({view:e}),new U({view:e}),T()&&new S({view:e})}requestRender(e=1){switch(e){case 2:this.view.state.fading=!0;case 1:this._needsUpdate=!0,this.globalIllumination?.resetAccumulatedFrames();case 0:this._needsRender=!0}}get updating(){const e=this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this.textures.updating||this.waterTextures.updating;return e&&_.UPDATING&&console.log(" RenderView:",this._needsUpdate,this._needsWaterReflectionUpdate,this.renderer.updating,this.textures.updating,this.waterTextures.updating),e}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(r(e))}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,t,r,i,s,n=s){let o=ie?this._readMainDepthSynchronously(t,r,i,s,n):this.renderer.navigationDepthCache.getMinimalDepthForArea(t,r,i,s,n)??Number.MAX_VALUE;if(e){const s=e.pickDepth(t*i.pixelRatio,r*i.pixelRatio,i);null!=s&&o>s&&s!==i.nearFar[0]&&s!==i.nearFar[1]&&(o=s)}return o===Number.MAX_VALUE?void 0:o}whenRepresentativeDepthForArea(e,t,r,i,s,n=1){return this.renderer.navigationDepthCache.whenRepresentativeDepthForArea(e,t,r,i,s,n)}_readMainDepthSynchronously(e,t,r,i,s){const n=r.constrainWindowSize(e,t,i*r.pixelRatio,s*r.pixelRatio),o=this._ensureLinearDepthArrayBuffer(n);this.renderer.readMainDepth(n,o);let a=Number.MAX_VALUE;for(let h=0;h<n[2]*n[3];h++){const e=this._linearDepthFromTexture(4*h,o,r.nearFar);a>e&&e!==r.nearFar[0]&&e!==r.nearFar[1]&&(a=e)}return a}_linearDepthFromTexture(e,t,r){return i(t,e)*(r[1]-r[0])+r[0]}_ensureLinearDepthArrayBuffer(e){const t=4*e[2]*e[3];return(null==this._tmpDepthBuffer||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}async reloadShaders(){Y(),await this.techniques.reloadAll(),this.renderer.overlay?.reloadShaders(),this.requestRender()}_registerFrameTask(e){const t=e.view.state;let r=!1,i=0,s=!1;const n={preRender:({time:s})=>{r=this.updating,i=this._needsUpdate?1:0,this._needsRender&&this.renderer.updateSceneDepthRange(t.camera),e.commitSyncLayers(),s=this.test?.time??s;const n=m(s-this._lastAnimationUpdate);this.view.state.animationsEnabled&&(n>this.renderer.animationTimestep||r||this._needsRender)&&(this.renderer.updateAnimation(t,s)&&this.requestRender(0),this._lastAnimationUpdate=s)},render:({time:e})=>{if(e=this.test?.time??e,this.renderer.setTime(e),(this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const e=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,this.renderer.render(t,0),s=!0,e&&this.renderer.hasReflections&&(this.requestRender(0),this._needsWaterReflectionUpdate=!0)}},update:({time:e})=>{this.view.state.animationsEnabled&&this.textures.update();const r=new $(t,this.renderer.fboCache);e=this.test?.time??e,this._screenshotManager.update(r,e)},finish:()=>{s&&(this.renderer.finish(2===t.mode?i:1),s=!1)}};this._frameTask=p(n)}_initializeContext(e){const{options:t}=e,r=t.canvas??document.createElement("canvas");r.setAttribute("style","width: 100%; height:100%; display:block;"),this._canvas=r;const i={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:t.stencil??!0,powerPreference:"high-performance",preserveDrawingBuffer:t.preserveDrawingBuffer??!1},n=r.getContext("webgl2",i);if(null==n)return void s.getLogger(this).error("A WebGL2 context could not be created.");re(n,!0),this._rctx=ne(n,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&s.getLogger(this).error("WebGL context has alpha channel even though no alpha channel was requested");const{container:o}=e;!this._rctx.contextAttributes.alpha&&has("safari")>=11&&(o.style.backgroundColor="black"),o.contains(r)||o.appendChild(r)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("textureFloatLinear")}get _viewingMode(){return this.stage.viewingMode}get stage(){return this.view.stage}getObjectAndLayerIdColor(e){return this.olidRenderHelper?.getObjectAndLayerIdColor(e)}get componentObjectCollection(){return this._componentObjectCollection??=new v(this.renderer.renderPassManager,this._viewingMode,this.view.spatialReference.isWebMercator),this._componentObjectCollection}updateQualitySettings(e){null!=this.test?.time&&null!=e.fadeDuration&&(this.test.savedFadeDuration=e.fadeDuration,e.fadeDuration=m(0)),this._rctx.updateOptions({maxPreferredTexturePixels:this.view.qualitySettings.maxTexturePixels})}get fog(){return r(this._fog.value)}};function ne(e,t){const r=new z(t);if(ee.enabled){let t=oe.get(e);return 1===t?.refCount?(t.configure(r),t.ref(),t):(t=new N(e,r),oe.set(e,t),t.ref(),t)}return new N(e,r)}e([u({type:Boolean,readOnly:!0})],se.prototype,"updating",null),e([u({constructOnly:!0})],se.prototype,"view",void 0),e([u({readOnly:!0})],se.prototype,"componentObjectCollection",null),e([u()],se.prototype,"_componentObjectCollection",void 0),e([u()],se.prototype,"_needsUpdate",void 0),e([u()],se.prototype,"_needsWaterReflectionUpdate",void 0),se=e([f("esri.views.3d.webgl-engine.parts.RenderView")],se);const oe=K();export{se as RenderView};
@@ -220,6 +220,7 @@ export interface MapViewProperties extends View2DProperties {}
220
220
  * | Scroll backward | Zoom out at the cursor |
221
221
  * | Right-click+Drag | 2D-rotate |
222
222
  * | Shift+Left-click+Drag | Zoom to the extent of the drawn graphic |
223
+ * | Shift+Ctrl+Left-click+Drag | Zoom out from the extent of the drawn graphic |
223
224
  * | Arrow Keys | Nudge the view to left, right, up or down |
224
225
  * | N | Adjust the view to point north |
225
226
  * | A | Rotate the view counterclockwise |
@@ -469,8 +469,10 @@ export interface SceneViewProperties extends ViewProperties, DOMContainerPropert
469
469
  * Drag | Pan
470
470
  * Double-click | Zoom in at the cursor
471
471
  * Scroll Wheel or Middle-click+Drag | Zoom in or out at the cursor
472
- * Shift + Scroll Wheel or Shift + Middle-click+Drag | Change the camera field of view (focal length)
472
+ * Shift+Scroll-wheel or Shift+Middle-click+Drag | Change the camera field of view (focal length)
473
473
  * Right-click+Drag | 3D-rotate around the center of the view
474
+ * Shift+Left-click+Drag | Zoom in to the content inside the drawn rectangle |
475
+ * Shift+Ctrl+Left-click+Drag | Zoom out from the content inside the drawn rectangle |
474
476
  * Arrow Keys | Nudge the view left, right, up, or down
475
477
  * B + Left-click+Drag | 3D-rotate around the camera's position
476
478
  * B + Right-click+Drag | Forced horizontal pan
@@ -1391,7 +1393,7 @@ export default class SceneView extends SceneViewSuperclass {
1391
1393
  * * At version 4.24, [SceneViewHitTestResult](https://developers.arcgis.com/javascript/latest/references/core/views/types/#SceneViewHitTestResult) returns an array of objects containing [graphic](https://developers.arcgis.com/javascript/latest/references/core/views/types/#SceneViewGraphicHit),
1392
1394
  * [media element](https://developers.arcgis.com/javascript/latest/references/core/views/types/#SceneViewMediaHit), and [route](https://developers.arcgis.com/javascript/latest/references/core/views/types/#SceneViewRouteHit).
1393
1395
  * * Starting with version 4.11, if a label intersects the specified screen coordinates then the result of the hitTest will
1394
- * contain the graphic associated with that label.
1396
+ * contain the graphic associated with that label. Labels can be excluded since 5.2 with the [HitTestOptions3D](https://developers.arcgis.com/javascript/latest/references/core/views/types/#HitTestOptions3D-excludeLabels) option.
1395
1397
  *
1396
1398
  * @param hitTarget - The screen point, screen rectangle, screen polygon or native mouse event identifying where to
1397
1399
  * perform the hit test.
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{abortMaybe as t}from"../../../core/maybe.js";import{InputHandler as e}from"../InputHandler.js";import{eventMatchesPointerAction as i}from"./support.js";const s="esri-zoom-box",r={container:`${s}__container`,overlay:`${s}__overlay`,background:`${s}__overlay-background`,box:`${s}__outline`},a="Shift",h="Control",n=4;let o=class extends e{constructor(t){super(!0),this._view=t,this._redraw=()=>{if(this._rafId=null,null==this._overlay||null==this._boxShape||null==this._backgroundShape)return;const{x:t,y:e,width:i,height:s}=this._box;this._boxShape.setAttributeNS(null,"x",`${t}`),this._boxShape.setAttributeNS(null,"y",`${e}`),this._boxShape.setAttributeNS(null,"width",`${i}`),this._boxShape.setAttributeNS(null,"height",`${s}`),this._boxShape.setAttributeNS(null,"class",r.box),this._backgroundShape.setAttributeNS(null,"d",this._toSVGPath(t,e,i,s))},this._container=null,this._overlay=null,this._backgroundShape=null,this._boxShape=null,this._rafId=null,this._active=!1,this._startX=0,this._startY=0,this._box={x:0,y:0,width:0,height:0},this._abortController=new AbortController,this.registerIncoming("drag",[a,h],t=>this._handleDrag(t,-1)),this.registerIncoming("drag",[a],t=>this._handleDrag(t,1)),this.registerIncoming("key-down",null,t=>this._handleKeyDown(t))}onUninstall(){this._destroyOverlay(),this._abortController=t(this._abortController)}onStart(){}onEnd(){}_handleDrag(t,e){const s=t.data;if(!(s.pointers.size>1)&&i(s,"primary")){switch(s.action){case"start":this._startX=s.center.x,this._startY=s.center.y,this._createContainer(),this._createOverlay(),this._active=!0,this.onStart(),this._update(s.center.x,s.center.y);break;case"update":if(!this._active)break;this._update(s.center.x,s.center.y);break;case"end":this._active&&(this.onEnd(),this._box.width>=n&&this._box.height>=n&&this._abortController&&this.goToBox(this._box,e,this._abortController.signal).catch(()=>{})),this._destroyOverlay();break;case"added":case"removed":this._destroyOverlay()}t.stopPropagation()}}_handleKeyDown(t){this._active&&"Escape"===t.data.key&&(this.onEnd(),this._destroyOverlay(),t.stopPropagation())}_update(t,e){const i=Math.min(this._startX,t),s=Math.min(this._startY,e),r=Math.abs(t-this._startX),a=Math.abs(e-this._startY);this._box.x=i,this._box.y=s,this._box.width=r,this._box.height=a,this._rafId??=requestAnimationFrame(this._redraw)}_createContainer(){this._destroyOverlay();const t=this._view.overlay?.surface;if(null==t)return;const e=document.createElement("div");e.className=r.container,t.appendChild(e),this._container=e}_createOverlay(){if(null==this._container)return;const{width:t,height:e}=this._view,i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttributeNS(null,"d",`M 0 0 L ${t} 0 L ${t} ${e} L 0 ${e} Z`),i.setAttributeNS(null,"class",r.background);const s=document.createElementNS("http://www.w3.org/2000/svg","rect"),a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttributeNS(null,"class",r.overlay),a.appendChild(i),a.appendChild(s),this._container.appendChild(a),this._backgroundShape=i,this._boxShape=s,this._overlay=a}_destroyOverlay(){null!=this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._container?.remove(),this._active=!1,this._container=null,this._backgroundShape=null,this._boxShape=null,this._overlay=null}_toSVGPath(t,e,i,s){const{width:r,height:a}=this._view,h=t+i,n=e+s;return`M 0 0 L ${r} 0 L ${r} ${a} L 0 ${a} ZM ${t} ${e} L ${t} ${n} L ${h} ${n} L ${h} ${e} Z`}};export{o as DragZoomBox};
package/views/types.d.ts CHANGED
@@ -817,19 +817,25 @@ export type HitTestOptions3DItem = HitTestItem3D | Iterable<HitTestItem3D | Iter
817
817
  */
818
818
  export interface HitTestOptions3D {
819
819
  /**
820
- * A list of layers and graphics to include for intersection testing. All layers and graphics
821
- * will be included if include is not specified.
820
+ * A list of layers and graphics to include for intersection testing. All layers and graphics will be included if
821
+ * include is not specified.
822
822
  *
823
823
  * @since 5.0
824
824
  */
825
825
  include?: HitTestOptions3DItem | null;
826
826
  /**
827
- * A list of layers and graphics to exclude for intersection testing. No layers or graphics
828
- * will be excluded if exclude is not specified.
827
+ * A list of layers and graphics to exclude for intersection testing. No layers or graphics will be excluded if
828
+ * exclude is not specified.
829
829
  *
830
830
  * @since 5.0
831
831
  */
832
832
  exclude?: HitTestOptions3DItem | null;
833
+ /**
834
+ * Exclude labels from intersection testing.
835
+ *
836
+ * @since 5.2
837
+ */
838
+ excludeLabels?: boolean;
833
839
  }
834
840
 
835
841
  /**