@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{clone as e}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as t}from"../../../../core/units.js";import{normalFromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as i,invertOrIdentity as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as a,sub as l,cross as c,add as m,normalize as p,transformMat4 as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ONES as u,create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as g,ZEROS as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as f}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as b,fromBuffer as x,intersectsClippingArea as _}from"../../../../geometry/support/aaBoundingBox.js";import{getZeroIndexArray as C}from"../../../../geometry/support/Indices.js";import{t as v}from"../../../../chunks/vec3.js";import{SnappingCandidateVertex as w,SnappingCandidateEdge as j}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as S}from"../../../../renderers/support/renderingInfoUtils.js";import{isDrivenOpacityFallbackAlwaysOpaque as P}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{needsElevationUpdates3D as I,SampleElevationInfo as E}from"./elevationAlignmentUtils.js";import{extrudePolygon as U}from"./extrudeUtils.js";import{Object3DEdgeState as A,Graphics3DObject3DGraphicLayer as z}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as O}from"./Graphics3DSymbolLayer.js";import{computeCentroid as D}from"./graphicUtils.js";import{addOlidAttribute as M}from"./olidUtils.js";import{geometryAsPolygon as G}from"./polygonUtils.js";import{createMaterial as L}from"../support/edgeUtils.js";import{encodeNaNUInt8 as V}from"../support/symbolColorUtils.js";import{debugFlags as R}from"../../support/debugFlags.js";import{SamplePosition as B}from"../../support/ElevationProvider.js";import{loadTessellationUtils as F,preloadedPolygonToRenderInfoElevationAligned as T}from"../../support/renderInfoUtils/polygon.js";import{Attribute as N}from"../../webgl-engine/lib/Attribute.js";import{Geometry as H}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as q}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as W,compressNormal as k}from"../../webgl-engine/lib/Normals.js";import{Object3D as Z}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as J}from"../../webgl-engine/materials/DefaultMaterial.js";const K=["polygon","extent"];class Q extends O{constructor(e,t,r,s){super(e,t,r,s,P(t)),this.ensureDrapedStatus(!1)}async doLoad(){const e=this.symbolLayer,t=e?.material,r=this.symbolLayer.material?.color?.a,s=this._hasDrivenColorOrOpacity,i=this.needsDrivenTransparentPass||s&&null!=r&&r<1,o=t?.emissive,n=("color"===o?.source?o?.strength:void 0)??0,a=!s&&(null==r||0===r),l=s?g:this._materialColor?.toUnitRGBA()??y,c={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,useIndexing:!0,ambient:u,diffuse:u,externalColor:l,opacity:a?0:1,layerOpacity:this._getLayerOpacity(),drivenOpacity:i,hasSymbolColors:s,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:e.castShadows,emissiveStrengthFromSymbol:n,emissiveSource:1,offsetTransparentBackfaces:!0,normalType:1},m=new J(c,this._context),p=new J({...c,cullFace:2},this._context);this._materials[0]=m,this._materials[1]=p,this._updateTransparentDepedentMaterialParameters(),await F()}destroy(){super.destroy(),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,K,this.symbolLayer.type))return null;const r=this._getDrivenUInt8ColorWithNaNSupport(e.renderingInfo,this._materialColor,!1);V(r,r);const s=this.createElevationContextForGraphic(t);return this._createAs3DShape(t,e.renderingInfo,r,s,t.uid)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._materials[0]?.setParameters({layerOpacity:r}),this._materials[1]?.setParameters({layerOpacity:r}),this._updateTransparentDepedentMaterialParameters(),e?.forEach(e=>t(e)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,I)}slicePlaneEnabledChanged(e,t){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),e?.forEach(e=>{const r=t(e);null!=r&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){const e={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[0]?.setParameters(e),this._materials[1]?.setParameters(e),!0}_getExtrusionSize(e){let t;return t=e.size&&this._drivenProperties.size?S(e.size.output,2)??0:this._getSymbolSize(),t/=this._context.renderCoordsHelper.unitInMeters,t}_containsRenderableGeometry(e){return"polygonIndexCount"in e&&"outlineIndexCount"in e?e.polygonIndexCount>0||e.outlineIndexCount>0:super._containsRenderableGeometry(e)}applyRendererDiff(e,t){return this._drivenPropertiesChanged(t)?0:1}async queryForSnapping(r,s,i,o){const n=this._getExtrusionSize(i)*this._context.renderCoordsHelper.unitInMeters/t(s),{objectId:a,target:l}=r,c=e(l);switch(c.z=(c.z??0)+n,r.type){case"edge":{const{start:t,end:s}=r,i=e(t),o=e(s);return i.z=(i.z??0)+n,o.z=(o.z??0)+n,[new j(a,c,1/0,i,o)]}case"vertex":return[new w(a,c,1/0),new j(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(e,t,o,a,l){const c=G(e.geometry);if(null==c)return null;if(0===c.rings.length||!c.rings.some(e=>e.length>0))return this._logGeometryValidationWarnings(c.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=T(c,this._context.elevationProvider,this._context.renderCoordsHelper,a,{outlineOutput:"tessellated-indices",owner:this._context.layer});if(null==m)return;this._logGeometryCreationWarnings(m,c.rings,"rings","ExtrudeSymbol3DLayer");const p=D(c);if(null==p)return null;const h=new Array,u=new Array,g=b(),y=n(),C=d(),w=1===this._context.renderCoordsHelper.viewingMode;w||this._context.renderCoordsHelper.worldUpAtPosition(null,C),f(c.spatialReference,[p.x,p.y,0],y,this._context.renderCoordsHelper.spatialReference);const j=n();i(j,y);const S=s();r(S,j);const P=new Map,E=this._materials[0];if(this._context.clippingExtent&&(x(m.mapPositions,g),!_(g,this._context.clippingExtent)))return;if(0===m.polygonIndexCount&&0===m.outlineIndexCount)return;const O=this._getExtrusionSize(t),M=U(m,{height:O,worldUp:C,spherical:w,requireElevation:!0,requireNormals:!0,requireSizes:!0});if(null==M)return;v(M.vertices,M.vertices,j);const V=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerViewUid:this._context.layerViewUid}),R=new ce(M.vertices,M.elevation,W(M.normals),M.sizes),B=X(E,M.indices,M.indices.length-M.bottomIndices.length,R,o,V),F=m.vertexCount,N=M.polygonVertexCount,H=2*m.outlineSegmentCount,q=m.polygonIndexCount/3,k=new me(F,N,H,q);if(te(B,k,y),P.set(B,k),h.push(B),M.bottomIndices.length>0&&h.push(X(this._materials[1],M.bottomIndices,0,R,o,V)),u.push(R.heights),0===h.length)return null;const J=new Z({geometries:h,layerViewUid:this._context.layerViewUid,graphicUid:l,isElevationSource:!0});J.transformation=y;const K=L(this.symbolLayer,{opacity:this._getLayerOpacity()}),Q=K?new A(this._materials[0],K,this._context.slicePlaneEnabled):null,Y=new z(this,J,null,(e,t,r,s,i)=>ee(e,t,r,s,i,u,P),a,Q);return Y.alignedSampledElevation=m.sampledElevation,Y.needsElevationUpdates=I(a.mode),Y}get _materialColor(){return this.symbolLayer.material?.color}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent?0:2})}}function X(e,t,r,s,i,o){const{attributeIndices:n,drawIndices:a}=Y(t),l=[["position",new N(s.positions,n,3,!0)],["normalCompressed",new N(s.normals,n,2,!0)]];let c=null;return e.parameters.hasSymbolColors&&(c=C(n.length),l.push(["symbolColor",new N(i,c,4,!0)])),null!=o&&(c??=C(n.length),M(l,o,c)),new H(e,l,s.elevation,0,r,null,a)}function Y(e){const t=new Array,r=new Map,s=new Array;for(let i=0;i<e.length;++i){const o=e[i];let n=r.get(o);null==n&&(n=t.length,t.push(o),r.set(o,n)),s.push(n)}return{attributeIndices:t,drawIndices:s}}const $=d();function ee(e,t,r,s,i,l,c){const m=e.stageObject,p=m.geometries,u=p.length,d="absolute-height"!==t.mode;let g=0;const y=m.transformation,f=o(n(),y);for(let o=0,n=0;o<u;++o){const e=p[o],t=c.get(e);if(!t||!q(e))continue;const u=e.getMutableAttribute("position").data,b=l[n++],x=new B(e.mapPositions),_=u.length/3;let C=!1,v=0;{let e=0;for(let t=0;t<_;t++){$[0]=u[e],$[1]=u[e+1],$[2]=u[e+2],s(x,ie),d&&(v+=ie.sampledElevation),R.ENABLE_OPTIMIZATIONS?(a(re,u[e],u[e+1],u[e+2]),h(re,re,y),i.setAltitude(re,ie.z+b[e/3]),h(re,re,f)):(a(re,x.array[x.offset],x.array[x.offset+1],ie.z+b[e/3]),null!=r&&i.toRenderCoords(re,r,re),h(re,re,f)),u[e]=re[0],u[e+1]=re[1],u[e+2]=re[2];const t=oe/i.unitInMeters;(Math.abs($[0]-u[e])>=t||Math.abs($[1]-u[e+1])>=t||Math.abs($[2]-u[e+2])>=t)&&(C=!0),x.offset+=3,e+=3}}if(C){te(e,t,y),m.geometryVertexAttributeUpdated(p[o],"normalCompressed"),e.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(p[o],"position");const r=p[o+1],s=!c.has(r);r&&s&&(r.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(r,"position"))}g+=v/_}return g/u}function te(e,t,r){const s=e.getMutableAttribute("normalCompressed").data,i=e.readPrimitivePosition,{topVertexStart:o,topVertexCount:n,topFaceStart:u,topFaceCount:d}=t,g=u+d,y=o+n,f=ne,b=ae,x=le,_=se,C=re;a(C,0,0,0);const v=(e,t)=>{h(t,i(t,e),r)};for(let a=u;a<g;++a){const e=3*a;v(e,f[0]),v(e+1,f[1]),v(e+2,f[2]),l(b,f[1],f[0]),l(x,f[2],f[0]),c(_,b,x),m(C,C,_)}p(C,C);for(let a=o;a<y;++a){const e=C[0],t=C[1],r=C[2];k(s,a,e,t,r)}}const re=d(),se=d(),ie=new E,oe=.01,ne=[d(),d(),d()],ae=d(),le=d();class ce{constructor(e,t,r,s){this.positions=e,this.elevation=t,this.normals=r,this.heights=s}}class me{constructor(e,t,r,s){this.topVertexStart=e,this.topVertexCount=t,this.topFaceStart=r,this.topFaceCount=s}}export{Q as Graphics3DExtrudeSymbolLayer};
2
+ import{clone as e}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as t}from"../../../../core/units.js";import{normalFromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as i,invertOrIdentity as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as a,sub as l,cross as c,add as m,normalize as p,transformMat4 as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ONES as u,create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as g,ZEROS as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as f}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as b,fromBuffer as x,intersectsClippingArea as _}from"../../../../geometry/support/aaBoundingBox.js";import{getZeroIndexArray as C}from"../../../../geometry/support/Indices.js";import{t as v}from"../../../../chunks/vec3.js";import{SnappingCandidateVertex as w,SnappingCandidateEdge as j}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as S}from"../../../../renderers/support/renderingInfoUtils.js";import{isDrivenOpacityFallbackAlwaysOpaque as P}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{needsElevationUpdates3D as I,SampleElevationInfo as E}from"./elevationAlignmentUtils.js";import{extrudePolygon as U}from"./extrudeUtils.js";import{Object3DEdgeState as A,Graphics3DObject3DGraphicLayer as z}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as O}from"./Graphics3DSymbolLayer.js";import{computeCentroid as D}from"./graphicUtils.js";import{addOlidAttribute as M}from"./olidUtils.js";import{geometryAsPolygon as G}from"./polygonUtils.js";import{createMaterial as L}from"../support/edgeUtils.js";import{encodeNaNUInt8 as V}from"../support/symbolColorUtils.js";import{debugFlags as R}from"../../support/debugFlags.js";import{SamplePosition as B}from"../../support/ElevationProvider.js";import{loadTessellationUtils as F,preloadedPolygonToRenderInfoElevationAligned as T}from"../../support/renderInfoUtils/polygon.js";import{Attribute as N}from"../../webgl-engine/lib/Attribute.js";import{Geometry as H}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as q}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as W,compressNormal as k}from"../../webgl-engine/lib/Normals.js";import{Object3D as Z}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as J}from"../../webgl-engine/materials/DefaultMaterial.js";const K=["polygon","extent"];class Q extends O{constructor(e,t,r,s){super(e,t,r,s,P(t)),this.ensureDrapedStatus(!1)}async doLoad(){const e=this.symbolLayer,t=e?.material,r=this.symbolLayer.material?.color?.a,s=this._hasDrivenColorOrOpacity,i=this.needsDrivenTransparentPass||s&&null!=r&&r<1,o=t?.emissive,n=("color"===o?.source?o?.strength:void 0)??0,a=!s&&(null==r||0===r),l=s?g:this._materialColor?.toUnitRGBA()??y,c={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,useIndexing:!0,ambient:u,diffuse:u,externalColor:l,opacity:a?0:1,layerOpacity:this._getLayerOpacity(),drivenOpacity:i,hasSymbolColors:s,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:e.castShadows,emissiveStrengthFromSymbol:n,emissiveSource:1,offsetTransparentBackfaces:!0,normalType:1},m=new J(c,this._context),p=new J({...c,cullFace:2},this._context);this._materials[0]=m,this._materials[1]=p,this._updateTransparentDepedentMaterialParameters(),await F()}destroy(){super.destroy(),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,K,this.symbolLayer.type))return null;const r=this._getDrivenUInt8ColorWithNaNSupport(e.renderingInfo,this._materialColor,!1);V(r,r);const s=this.createElevationContextForGraphic(t);return this._createAs3DShape(t,e.renderingInfo,r,s,t.uid)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._materials[0]?.setParameters({layerOpacity:r}),this._materials[1]?.setParameters({layerOpacity:r}),this._updateTransparentDepedentMaterialParameters(),e?.forEach(e=>t(e)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,I)}slicePlaneEnabledChanged(e,t){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),e?.forEach(e=>{const r=t(e);null!=r&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){const e={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[0]?.setParameters(e),this._materials[1]?.setParameters(e),!0}_getExtrusionSize(e){let t;return t=e.size&&this._drivenProperties.size?S(e.size.output,2)??0:this._getSymbolSize(),t/=this._context.renderCoordsHelper.unitInMeters,t}_containsRenderableGeometry(e){return"polygonIndexCount"in e&&"outlineIndexCount"in e?e.polygonIndexCount>0||e.outlineIndexCount>0:super._containsRenderableGeometry(e)}applyRendererDiff(e,t){return this._drivenPropertiesChanged(t)?0:1}async queryForSnapping(r,s,i,o){const n=this._getExtrusionSize(i)*this._context.renderCoordsHelper.unitInMeters/t(s),{objectId:a,target:l}=r,c=e(l);switch(c.z=(c.z??0)+n,r.type){case"edge":{const{start:t,end:s}=r,i=e(t),o=e(s);return i.z=(i.z??0)+n,o.z=(o.z??0)+n,[new j(a,c,1/0,i,o)]}case"vertex":return[new w(a,c,1/0),new j(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(e,t,o,a,l){const c=G(e.geometry);if(null==c)return null;if(0===c.rings.length||!c.rings.some(e=>e.length>0))return this._logGeometryValidationWarnings(c.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=T(c,this._context.elevationProvider,this._context.renderCoordsHelper,a,{outlineOutput:"tessellated-indices",owner:this._context.layer});if(null==m)return;this._logGeometryCreationWarnings(m,c.rings,"rings","ExtrudeSymbol3DLayer");const p=D(c);if(null==p)return null;const h=new Array,u=new Array,g=b(),y=n(),C=d(),w=1===this._context.renderCoordsHelper.viewingMode;w||this._context.renderCoordsHelper.worldUpAtPosition(null,C),f(c.spatialReference,[p.x,p.y,0],y,this._context.renderCoordsHelper.spatialReference);const j=n();i(j,y);const S=s();r(S,j);const P=new Map,E=this._materials[0];if(this._context.clippingExtent&&(x(m.mapPositions,g),!_(g,this._context.clippingExtent)))return;if(0===m.polygonIndexCount&&0===m.outlineIndexCount)return;const O=this._getExtrusionSize(t),M=U(m,{height:O,worldUp:C,spherical:w,requireElevation:!0,requireNormals:!0,requireSizes:!0});if(null==M)return;v(M.vertices,M.vertices,j);const V=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerViewUid:this._context.layerViewUid}),R=new ce(M.vertices,M.elevation,W(M.normals),M.sizes),B=X(E,M.indices,M.indices.length-M.bottomIndices.length,R,o,V),F=m.vertexCount,N=M.polygonVertexCount,H=2*m.outlineSegmentCount,q=m.polygonIndexCount/3,k=new me(F,N,H,q);if(te(B,k,y),P.set(B,k),h.push(B),M.bottomIndices.length>0&&h.push(X(this._materials[1],M.bottomIndices,0,R,o,V)),u.push(R.heights),0===h.length)return null;const J=new Z({geometries:h,layerViewUid:this._context.layerViewUid,graphicUid:l,isElevationSource:!0});J.transformation=y;const K=L(this.symbolLayer,{opacity:this._getLayerOpacity()}),Q=K?new A(this._materials[0],K,this._context.slicePlaneEnabled):null,Y=new z(this,J,null,(e,t,r,s,i)=>ee(e,t,r,s,i,u,P),a,Q);return Y.alignedSampledElevation=m.sampledElevation,Y.needsElevationUpdates=I(a.mode),Y}get _materialColor(){return this.symbolLayer.material?.color}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent?0:2})}}function X(e,t,r,s,i,o){const{attributeIndices:n,drawIndices:a}=Y(t),l=[["position",new N(s.positions,n,3,!0)],["normalCompressed",new N(s.normals,n,2,!0)]];let c=null;return e.parameters.hasSymbolColors&&(c=C(n.length),l.push(["symbolColor",new N(i,c,4,!0)])),null!=o&&(c??=C(n.length),M(l,o,c)),new H(e,l,s.elevation,r,null,a)}function Y(e){const t=new Array,r=new Map,s=new Array;for(let i=0;i<e.length;++i){const o=e[i];let n=r.get(o);null==n&&(n=t.length,t.push(o),r.set(o,n)),s.push(n)}return{attributeIndices:t,drawIndices:s}}const $=d();function ee(e,t,r,s,i,l,c){const m=e.stageObject,p=m.geometries,u=p.length,d="absolute-height"!==t.mode;let g=0;const y=m.transformation,f=o(n(),y);for(let o=0,n=0;o<u;++o){const e=p[o],t=c.get(e);if(!t||!q(e))continue;const u=e.getMutableAttribute("position").data,b=l[n++],x=new B(e.mapPositions),_=u.length/3;let C=!1,v=0;{let e=0;for(let t=0;t<_;t++){$[0]=u[e],$[1]=u[e+1],$[2]=u[e+2],s(x,ie),d&&(v+=ie.sampledElevation),R.ENABLE_OPTIMIZATIONS?(a(re,u[e],u[e+1],u[e+2]),h(re,re,y),i.setAltitude(re,ie.z+b[e/3]),h(re,re,f)):(a(re,x.array[x.offset],x.array[x.offset+1],ie.z+b[e/3]),null!=r&&i.toRenderCoords(re,r,re),h(re,re,f)),u[e]=re[0],u[e+1]=re[1],u[e+2]=re[2];const t=oe/i.unitInMeters;(Math.abs($[0]-u[e])>=t||Math.abs($[1]-u[e+1])>=t||Math.abs($[2]-u[e+2])>=t)&&(C=!0),x.offset+=3,e+=3}}if(C){te(e,t,y),m.geometryVertexAttributeUpdated(p[o],"normalCompressed"),e.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(p[o],"position");const r=p[o+1],s=!c.has(r);r&&s&&(r.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(r,"position"))}g+=v/_}return g/u}function te(e,t,r){const s=e.getMutableAttribute("normalCompressed").data,i=e.readPrimitivePosition,{topVertexStart:o,topVertexCount:n,topFaceStart:u,topFaceCount:d}=t,g=u+d,y=o+n,f=ne,b=ae,x=le,_=se,C=re;a(C,0,0,0);const v=(e,t)=>{h(t,i(t,e),r)};for(let a=u;a<g;++a){const e=3*a;v(e,f[0]),v(e+1,f[1]),v(e+2,f[2]),l(b,f[1],f[0]),l(x,f[2],f[0]),c(_,b,x),m(C,C,_)}p(C,C);for(let a=o;a<y;++a){const e=C[0],t=C[1],r=C[2];k(s,a,e,t,r)}}const re=d(),se=d(),ie=new E,oe=.01,ne=[d(),d(),d()],ae=d(),le=d();class ce{constructor(e,t,r,s){this.positions=e,this.elevation=t,this.normals=r,this.heights=s}}class me{constructor(e,t,r,s){this.topVertexStart=e,this.topVertexCount=t,this.topFaceStart=r,this.topFaceCount=s}}export{Q as Graphics3DExtrudeSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{pt2px as e}from"../../../../core/screenUtils.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderingInfo as n}from"../../../../renderers/support/RenderingInfo.js";import{textSymbolLayerSupportsVerticalOffset as i}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as s}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as a,needsElevationUpdates2D as o}from"./elevationAlignmentUtils.js";import{Graphics3DGraphicCreationContext as l}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DObject3DGraphicLayer as c}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as h}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as p}from"./Graphics3DSymbolLayer.js";import{computeCentroid as m}from"./graphicUtils.js";import{addOlidAttribute as d}from"./olidUtils.js";import{createStageObject as f,extendPointGraphicElevationContext as u}from"./pointUtils.js";import{SymbolComplexity as g}from"./SymbolComplexity.js";import{isObjectSymbol3DLayer as v,isTextSymbol3DLayer as y}from"../support/layerUtils.js";import{Attribute as x}from"../../webgl-engine/lib/Attribute.js";import{Geometry as _}from"../../webgl-engine/lib/Geometry.js";import{LineCalloutMaterial as b,Parameters as C,uniqueMaterialIdentifier as O}from"../../webgl-engine/materials/LineCalloutMaterial.js";import{getLineCalloutMaterialBaseInstance as P}from"../../webgl-engine/materials/LineCalloutMaterialBaseInstance.js";class j extends p{static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:1,onTheGroundChanged:2}}constructor(e,t){super(e,null,t,S),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){this._materials[0]=new b(this._materialParameters,this._context.spherical)}_perInstanceMaterialParameters(e){const t=this._materialParameters;return t.horizontalScreenOffset=e.horizontalScreenOffset??0,t.centerOffsetUnits=e.centerOffsetUnits||"world",t}get _materialParameters(){const t=new C,n=this.symbol,i=n.callout;if(i.color){const e=i.color.toUnitRGBA();e[3]*=this._getLayerOpacity(),t.color=e}else t.color=r;if(t.size=e(i.size||0),n.verticalOffset){const{screenLength:r,minWorldLength:i,maxWorldLength:s}=n.verticalOffset;t.verticalOffset={screenLength:e(r),minWorldLength:i||0,maxWorldLength:null!=s?s:1/0}}t.borderColor=null!=i.border?.color?i.border.color.toUnitRGBA():null;const s=n.symbolLayers.at(0),a=v(s),o="label-3d"===n.type;return a&&(t.shaderPolygonOffset=0),t.hudDepthAlignStart=o,t.hasSlicePlane=this._context.slicePlaneEnabled,t.screenSizePerspective=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null,t}_defaultElevationInfoNoZ(){return E}createGraphics3DGraphic(e,t){const r=e.renderingInfo,n=e.graphic,s=this.createElevationContextForGraphic(n,r.elevationOffset||0),a=r.symbol,o="on-the-ground"===this._elevationContext.mode&&("cim"===a.type||!a.symbolLayers.some(e=>v(e)||y(e)));if("label-3d"!==a.type&&o)return null;if("point-3d"===a.type&&a.symbolLayers.every(e=>"text"===e.type&&!i(e)))return null;const l=m(n.geometry);return null==l?null:this._createAs3DShape(l,s,r,n.uid,t)}layerOpacityChanged(){this._materials[0]?.setParameters(this._materialParameters)}layerScreenSizePerspectiveChanged(){const e=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null;this._materials[0]?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,r){const n=this._elevationContext.mode,i=a(j.elevationModeChangeTypes,r,n);return 1!==i||e?.forEach(e=>{const r=t(e);null!=r&&this.graphics3DGraphicLayerElevationInfoChanged(e.graphic,r)}),i}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}createElevationContextForGraphic(e,t=0){const r=super.createElevationContextForGraphic(e);return r.addOffsetRenderUnits(t),r}updateElevationContextForGraphic(e,t,r=0){super.updateElevationContextForGraphic(e,t),e.addOffsetRenderUnits(r)}graphics3DGraphicLayerElevationInfoChanged(e,t){const{elevationContext:r,metadata:n}=t;this.updateElevationContextForGraphic(r,e,n?.elevationOffset??0),t.needsElevationUpdates=o(r.mode)}computeComplexity(){return new g({verticesPerFeature:6})}_getOrCreateMaterial(e,t){const r=this._perInstanceMaterialParameters(e),n=O(r);if(n===this._materials[0]?.uniqueMaterialIdentifier)return this._materials[0];if(t){let e=t.get(n);return null==e&&(e=new b(r,this._context.spherical),t.set(n,e)),e}return new b(r,this._context.spherical)}_createAs3DShape(e,t,r,n,i){const a=this._context.layerViewUid,l=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:a}),p=this._getOrCreateMaterial(r,i),m=new _(p,w(r,l),null,1,void 0,P()),d=f(this._context,e,m,t,n);if(null==d)return null;const g=new c(this,d.object,null,s,t);return g.hiddenIfDeconflicted=!0,g.metadata=new h(r.elevationOffset),g.alignedSampledElevation=d.sampledElevation,g.needsElevationUpdates=o(t.mode),u(g,e,this._context.elevationProvider),g}}function w(e,t){const{translation:r,centerOffset:n,groundDistance:i}=e,s=new x(r?[r[0],r[1],r[2]]:[0,0,0],G,3,!0),a=new x(n?[n[0],n[1],n[2]]:[0,0,0],G,3,!0),o=new x(null!=i?[i]:[1],G,1,!0),l=[["position",s],["normal",new x([0,0,1],G,3,!0)],["centerOffset",a],["groundDistance",o]];return null!=t&&d(l,t,G),l}const G=[0],E={mode:"relative-to-ground",offset:0},S={ignoreDrivers:!0,renderPriority:0,renderPriorityStep:1};class U extends n{constructor(e,r,n=t(),i=t(),s=0,a=0,o="world",l=0){super(e,r),this.translation=n,this.centerOffset=i,this.groundDistance=s,this.horizontalScreenOffset=a,this.centerOffsetUnits=o,this.elevationOffset=l}}class L extends l{}export{j as Graphics3DLineCalloutSymbolLayer,L as LineCalloutCreationContext,U as LineCalloutSymbolLayerRenderingInfo};
2
+ import{pt2px as e}from"../../../../core/screenUtils.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderingInfo as n}from"../../../../renderers/support/RenderingInfo.js";import{textSymbolLayerSupportsVerticalOffset as i}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as s}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as a,needsElevationUpdates2D as o}from"./elevationAlignmentUtils.js";import{Graphics3DGraphicCreationContext as l}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DObject3DGraphicLayer as c}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as h}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as p}from"./Graphics3DSymbolLayer.js";import{computeCentroid as m}from"./graphicUtils.js";import{addOlidAttribute as d}from"./olidUtils.js";import{createStageObject as f,extendPointGraphicElevationContext as u}from"./pointUtils.js";import{SymbolComplexity as g}from"./SymbolComplexity.js";import{isObjectSymbol3DLayer as v,isTextSymbol3DLayer as y}from"../support/layerUtils.js";import{Attribute as x}from"../../webgl-engine/lib/Attribute.js";import{Geometry as _}from"../../webgl-engine/lib/Geometry.js";import{LineCalloutMaterial as b,Parameters as C,uniqueMaterialIdentifier as O}from"../../webgl-engine/materials/LineCalloutMaterial.js";import{getLineCalloutMaterialBaseInstance as P}from"../../webgl-engine/materials/LineCalloutMaterialBaseInstance.js";class j extends p{static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:1,onTheGroundChanged:2}}constructor(e,t){super(e,null,t,S),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){this._materials[0]=new b(this._materialParameters,this._context.spherical)}_perInstanceMaterialParameters(e){const t=this._materialParameters;return t.horizontalScreenOffset=e.horizontalScreenOffset??0,t.centerOffsetUnits=e.centerOffsetUnits||"world",t}get _materialParameters(){const t=new C,n=this.symbol,i=n.callout;if(i.color){const e=i.color.toUnitRGBA();e[3]*=this._getLayerOpacity(),t.color=e}else t.color=r;if(t.size=e(i.size||0),n.verticalOffset){const{screenLength:r,minWorldLength:i,maxWorldLength:s}=n.verticalOffset;t.verticalOffset={screenLength:e(r),minWorldLength:i||0,maxWorldLength:null!=s?s:1/0}}t.borderColor=null!=i.border?.color?i.border.color.toUnitRGBA():null;const s=n.symbolLayers.at(0),a=v(s),o="label-3d"===n.type;return a&&(t.shaderPolygonOffset=0),t.hudDepthAlignStart=o,t.hasSlicePlane=this._context.slicePlaneEnabled,t.screenSizePerspective=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null,t}_defaultElevationInfoNoZ(){return E}createGraphics3DGraphic(e,t){const r=e.renderingInfo,n=e.graphic,s=this.createElevationContextForGraphic(n,r.elevationOffset||0),a=r.symbol,o="on-the-ground"===this._elevationContext.mode&&("cim"===a.type||!a.symbolLayers.some(e=>v(e)||y(e)));if("label-3d"!==a.type&&o)return null;if("point-3d"===a.type&&a.symbolLayers.every(e=>"text"===e.type&&!i(e)))return null;const l=m(n.geometry);return null==l?null:this._createAs3DShape(l,s,r,n.uid,t)}layerOpacityChanged(){this._materials[0]?.setParameters(this._materialParameters)}layerScreenSizePerspectiveChanged(){const e=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null;this._materials[0]?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,r){const n=this._elevationContext.mode,i=a(j.elevationModeChangeTypes,r,n);return 1!==i||e?.forEach(e=>{const r=t(e);null!=r&&this.graphics3DGraphicLayerElevationInfoChanged(e.graphic,r)}),i}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}createElevationContextForGraphic(e,t=0){const r=super.createElevationContextForGraphic(e);return r.addOffsetRenderUnits(t),r}updateElevationContextForGraphic(e,t,r=0){super.updateElevationContextForGraphic(e,t),e.addOffsetRenderUnits(r)}graphics3DGraphicLayerElevationInfoChanged(e,t){const{elevationContext:r,metadata:n}=t;this.updateElevationContextForGraphic(r,e,n?.elevationOffset??0),t.needsElevationUpdates=o(r.mode)}computeComplexity(){return new g({verticesPerFeature:6})}_getOrCreateMaterial(e,t){const r=this._perInstanceMaterialParameters(e),n=O(r);if(n===this._materials[0]?.uniqueMaterialIdentifier)return this._materials[0];if(t){let e=t.get(n);return null==e&&(e=new b(r,this._context.spherical),t.set(n,e)),e}return new b(r,this._context.spherical)}_createAs3DShape(e,t,r,n,i){const a=this._context.layerViewUid,l=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:a}),p=this._getOrCreateMaterial(r,i),m=new _(p,w(r,l),null,void 0,P()),d=f(this._context,e,m,t,n);if(null==d)return null;const g=new c(this,d.object,null,s,t);return g.hiddenIfDeconflicted=!0,g.metadata=new h(r.elevationOffset),g.alignedSampledElevation=d.sampledElevation,g.needsElevationUpdates=o(t.mode),u(g,e,this._context.elevationProvider),g}}function w(e,t){const{translation:r,centerOffset:n,groundDistance:i}=e,s=new x(r?[r[0],r[1],r[2]]:[0,0,0],G,3,!0),a=new x(n?[n[0],n[1],n[2]]:[0,0,0],G,3,!0),o=new x(null!=i?[i]:[1],G,1,!0),l=[["position",s],["normal",new x([0,0,1],G,3,!0)],["centerOffset",a],["groundDistance",o]];return null!=t&&d(l,t,G),l}const G=[0],E={mode:"relative-to-ground",offset:0},S={ignoreDrivers:!0,renderPriority:0,renderPriorityStep:1};class U extends n{constructor(e,r,n=t(),i=t(),s=0,a=0,o="world",l=0){super(e,r),this.translation=n,this.centerOffset=i,this.groundDistance=s,this.horizontalScreenOffset=a,this.centerOffsetUnits=o,this.elevationOffset=l}}class L extends l{}export{j as Graphics3DLineCalloutSymbolLayer,L as LineCalloutCreationContext,U as LineCalloutSymbolLayerRenderingInfo};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../Color.js";import{linearize as t}from"../../../../colorUtils.js";import{deg2rad as r}from"../../../../core/mathUtils.js";import{releaseMaybe as o}from"../../../../core/maybe.js";import{isPromiseLike as n}from"../../../../core/promiseUtils.js";import{normalFromMat4 as s,fromMat4 as a}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as l,multiply as c,invert as u,getTranslation as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f,IDENTITY as p,clone as h}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as g,add as x,scale as _,transformMat4 as y,transformMat3 as v,normalize as T,scaleAndAdd as b,subtract as w,cross as C,dot as j}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as M,ZEROS as R,ONES as A,create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as I}from"../../../../geometry/projectionUtils.js";import{computeTranslationToOriginAndRotation as U}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as B}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as E}from"../../../../geometry/projection/projectVectorToVector.js";import{fromBuffer as F,intersectsClippingArea as O,create as V}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as $}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as G,getContinuousIndexArray as D}from"../../../../geometry/support/Indices.js";import L from"../../../../geometry/support/MeshComponent.js";import N from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import H from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as k,isAbsoluteVertexSpace as z}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as q,isPlateCarree as W}from"../../../../geometry/support/spatialReferenceUtils.js";import{t as Y}from"../../../../chunks/vec3.js";import{transformNormal as K,transformVectorENUPlateCarree as J,transformVectorWMPlateCarree as Q,projectNormalToPCPF as X,transformTangent as Z,projectTangentToPCPF as ee}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as te}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{isDrivenOpacityFallbackAlwaysOpaque as re}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{getEmissiveMode as oe}from"../../../../symbols/support/materialUtils.js";import{isEncodedMeshTexture as ne}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as se}from"../../glTF/internal/TextureTransformUtils.js";import{defaultSymbolLayerMemoryComplexity as ae}from"./defaultSymbolComplexity.js";import{perObjectElevationAligner as ie}from"./ElevationAligners.js";import{needsElevationUpdates3D as le,evaluateElevationInfoAtPoint as ce}from"./elevationAlignmentUtils.js";import{preparePatchEmissiveStrength as ue}from"./emissiveUtils.js";import{Graphics3DMeshObject3DGraphicLayer as me}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as fe}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as pe,nanFallbackColor as he}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as de,MeshFastUpdateProcessor as ge}from"./MeshFastUpdateProcessor.js";import{addOlidAttribute as xe}from"./olidUtils.js";import{SymbolComplexity as _e}from"./SymbolComplexity.js";import{hasEdges as ye,createMaterial as ve}from"../support/edgeUtils.js";import{debugFlags as Te}from"../../support/debugFlags.js";import{Attribute as be}from"../../webgl-engine/lib/Attribute.js";import{Geometry as we}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as Ce}from"../../webgl-engine/lib/ManagedTexture.js";import{Object3D as je}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as Me}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as Re}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as Ae,advancedMRRFactors as Pe,schematicMRRFactors as Se}from"../../webgl-engine/materials/pbrUtils.js";const Ie=["mesh"];class Ue extends pe{constructor(e,t,r,o){super(e,t,r,o,re(t)),this._materialInfoCache=new de,this._fastUpdateProcessor=new ge,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){Te.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new Re({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new Re({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new Re({color:[0,1,1,1]})),this.updateComplexity()}destroy(){super.destroy(),this._textures.forEach(e=>e.unload()),this._context.stage.removeTextures(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy()}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Ie,"fill on mesh-3d"))return null;const r=this.createElevationContextForGraphic(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters(e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTextureAlphaMode(t,e)}),e?.forEach(e=>t(e)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,le)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters(({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),e?.forEach(e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters(({material:t})=>t.setParameters({usePBR:e})),!0}updateTransform(e,t,r,o){if(!e.fastTransformUpdatesAllowed)return!1;const n=e.fastTransformUpdatesEnabled;switch(o){case 0:if(n)return!0;break;case 1:if(!n)return!0;break;default:if(!n)return!!this.updateTransform(e,t,r,0)&&(e.autoDisableFastTransformUpdates(()=>this.updateTransform(e,t,r,1)),!0)}const s=this._context.renderCoordsHelper.spatialReference,a=ot,{origin:i,transform:l}=r;if(!U(t,g(Xe,i.x,i.y,i.z??0),a,s))return!1;switch(o){case 0:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case 1:this._fastUpdateProcessor.disable(e,this._materialInfoCache)}e.updateFastLocalOrigin(a,l,this._context.localOriginFactory,!1);const{elevationContext:c}=e;c.centerInElevationSR=this._getCenterInElevationSR(a);const{elevationProvider:u,renderCoordsHelper:m}=this._context,f=(e,t)=>ce(e,u,c,m,t);return e.alignedSampledElevation=ie(e,c,u.spatialReference,f,m,a),e.updateTransform(a,l,this._context.isAsync),e.updateAutoDisableFastTransformUpdates(()=>this.updateTransform(e,t,r,1)),!0}computeComplexity(){if(!this._textures||0===this._textures.size)return super.computeComplexity();let e=0;for(const o of this._textures.values())e+=o.usedMemory;const t={...ae(this.symbol,this.symbolLayer),resourceBytes:e},r=ye(this.symbolLayer)?2:0;return new _e({drawCallsPerFeature:r,memory:t})}_requiresSymbolVertexColors(){return this._hasDrivenColorOrOpacity}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,n=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:n,unlit:!1,uid:`vc:${o},vt:${n},vct${t},svc:${r}`}}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:n,colorTexture:s,colorTextureTransform:a,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,f=We(n),p=We(s),h=Ye(a),d=We(i),g=Ye(l);if(o.color=n,o.colorTexture=s,o.normalTexture=i,o.uid=`${o.uid},cmuid:${f},ctmuid:${p},cttuid:${h},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof N){const{metallic:e,roughness:r,metallicRoughnessTexture:n,metallicRoughnessTextureTransform:s,emissiveColor:i,emissiveStrength:c,emissiveTexture:u,emissiveTextureTransform:m,occlusionTexture:f,occlusionTextureTransform:p,unlit:h}=t.material,d=We(n),g=Ye(s),x=We(i),_=We(u),y=Ye(m),v=We(f),T=Ye(p);o.uid=[o.uid,`mrm:${e}`,`mrr:${r}`,`mrt:${d}`,`mrtt:${g}`,`emuid:${x}`,`ems:${c}`,`etmuid:${_}`,`ett:${y}`,`otmuid:${v}`,`ott:${T}`,`unlit:${h}`].join(","),o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=n,o.emissiveColor=h?void 0:i,o.emissiveStrength=c,o.emissiveTexture=h?void 0:u,o.occlusionTexture=f,o.unlit=h,o.colorTextureTransform=Le(a),o.normalTextureTransform=Le(l),o.emissiveTextureTransform=Le(m),o.occlusionTextureTransform=Le(p),o.metallicRoughnessTextureTransform=Le(s)}return o}_getInternalTexture(e,t=!1,r=1){const s=qe(e);if(!s)return null;const a=`${e.contentHash}/${r}`;let i=this._textures.get(a);if(i){const e=this._context.stage.renderView.textures;let t=null;const r=e.acquire(i.id);return null==r||n(r)||(i.events.on("unloaded",()=>t=o(t)),t=r),i}let l=null;const c=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,u={wrap:Ne(e.wrap),noUnpackFlip:!0,maxAnisotropy:c,mipmap:c>1};return ne(s)?(l=s.data,u.preMultiplyAlpha=!1,u.encoding=s.encoding):(l=s,u.preMultiplyAlpha=1!==r,u.compressionOptions=t?{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}:void 0),i=new Ce(l,u),this._textures.set(a,i),i.events.on("loaded",()=>this.updateComplexity()),i.load(this._context.stage.renderView.renderingContext),this._context.stage.addTexture(i),i.events.on("unloaded",()=>{this._textures.delete(a)}),i}_setInternalMaterialTextureParameters(e,r){if(null!=e.colorTexture){const t=1!==r.textureAlphaMode,o=this._getInternalTexture(e.colorTexture,t,r.textureAlphaMode);o?(r.textureId=o.id,r.textureAlphaPremultiplied=!!o.parameters.preMultiplyAlpha):r.textureId=void 0}if(e.normalTexture&&(r.normalTextureId=this._getInternalTexture(e.normalTexture)?.id),e.emissiveColor){const o=e.emissiveColor?.toUnitRGB();r.emissiveBaseColor=M(t(o[0]),t(o[1]),t(o[2]))}e.emissiveStrength&&(r.emissiveStrengthKHR=e.emissiveStrength),e.emissiveTexture&&(r.emissiveTextureId=this._getInternalTexture(e.emissiveTexture)?.id),e.occlusionTexture&&(r.occlusionTextureId=this._getInternalTexture(e.occlusionTexture,!0)?.id),e.metallicRoughnessTexture&&(r.metallicRoughnessTextureId=this._getInternalTexture(e.metallicRoughnessTexture,!0)?.id)}_setInternalMaterialParameters(e,t,r){null!=e.color&&ze(e.color,t,r),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=se(e.colorTextureTransform),t.normalTextureTransformMatrix=se(e.normalTextureTransform);const o=null!=e.normalTextureTransform?.scale?e.normalTextureTransform?.scale:d;t.scale=[o[0],o[1]],t.occlusionTextureTransformMatrix=se(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=se(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=se(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(e,t=this._materialColor){const r=this._drivenProperties.color,o=this._drivenProperties.opacity;if(r)e.externalColor=S;else{const r=t??null;if(r){const t=r.toUnitRGBA();o&&(t[3]=1),e.externalColor=t}else e.externalColor=he}e.colorMixMode=this.symbolLayer.material?.colorMixMode??"multiply",e.castShadows=!!this.symbolLayer.castShadows,e.emissiveStrengthFromSymbol=this.symbolLayer?.material?.emissive?.strength??1,e.emissiveSource=oe(this.symbolLayer?.material?.emissive?.source??"emissive")}_getOrCreateMaterial(e,t){const r=t.material?.color,o=t.material?.colorTexture,n=t.material?.alphaMode,s="blend"===n,a=!("opaque"===n)&&(ke(e)||null!=r&&r.a<1||o?.transparent||s),i=this._materialProperties(e,t,a),l=this._materialInfoCache.byUid(i.uid);if(l)return this._setInternalMaterialTextureParameters(i,l.material.parameters),l.material;const c={uid:i.uid,material:null,isComponentTransparent:a,alphaMode:t.material?t.material.alphaMode:"opaque"},u=Ae({normalTexture:i.normalTexture,metallicRoughnessTexture:i.metallicRoughnessTexture,metallicFactor:i.metallic,roughnessFactor:i.roughness,emissiveTexture:i.unlit?void 0:i.emissiveTexture,emissiveFactor:i.unlit?R:i.emissiveColor?.toUnitRGB(),occlusionTexture:i.occlusionTexture}),m={usePBR:this._usePBR(),isSchematic:u,hasVertexColors:i.hasVertexColors,hasSymbolColors:i.hasSymbolVertexColors,hasVertexTangents:i.hasVertexTangents,ambient:R,diffuse:A,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:0,unlit:i.unlit,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,drivenOpacity:this.needsDrivenTransparentPass||c.isComponentTransparent};m.mrrFactors=u?Se:[i.metallic,i.roughness,Pe[2]],t.material&&(m.doubleSided=t.material.doubleSided,m.cullFace=t.material.doubleSided?0:2,m.textureAlphaCutoff=t.material.alphaCutoff),this._setExternalMaterialParameters(m),this._setMaterialTextureAlphaMode(m,c),this._setInternalMaterialParameters(i,m,c);const f=new Me(m,this._context);return c.material=f,this._materialInfoCache.set(i.uid,c),f}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchColor(e,t),this._preparePatchEmissive(e,t)}_preparePatchColor(e,t){if(!t.material||"partial"!==t.material.type)return;const r=t.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const o=r.color.newValue;delete r.color,e.symbolLayerStatePatches.push(()=>{this._updateMaterialParameters(e=>{const t=e.material.parameters;this._setExternalMaterialParameters(t,o),this._setMaterialTextureAlphaMode(t,e),e.material.setParameters({externalColor:t.externalColor})})})}_preparePatchEmissive(e,t){return ue(e,t,e=>{this._updateMaterialParameters(t=>{t.material.setParameters({emissiveStrengthFromSymbol:e??1})})},this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result)}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTextureAlphaMode(e,t){if("auto"===t.alphaMode){const r=this.needsDrivenTransparentPass||t.isComponentTransparent||(e.layerOpacity??1)<1||(e.opacity??1)<1||(e.externalColor?.[3]??1)<1;e.textureAlphaMode=r?3:1}else e.textureAlphaMode="opaque"===t.alphaMode?1:"mask"===t.alphaMode?2:0}_createFaceDebugNormals(e,t){const r=t.length,o=e.spatialReference.isGeographic?20015077/180:1,n=.1*Math.max(e.extent.width*o,e.extent.height*o,e.extent.zmax-e.extent.zmin),a=[],l=[],c=t[0].transformation,u=s(i(),c);for(let s=0;s<r;s++){const e=t[s].attributes.get("position");if(!e)continue;const r=e.data,o=e.indices;for(let t=0;t<o.length;t+=3)De(r,o,t,tt),Ge(r,o,t,Xe,Ze,et),x(Xe,Xe,Ze),x(Xe,Xe,et),_(Xe,Xe,1/3),y(Xe,Xe,c),a.push(...Xe),v(tt,tt,u),T(tt,tt),b(Xe,Xe,tt,n),a.push(...Xe),l.push(l.length),l.push(l.length)}return a.length?new we(this._debugFaceNormalMaterial,[["position",new be(a,l,3,!0)]],null,2):null}_createPerVertexDebugVectors(e,t,r,o,n){const l=t.length,c=e.spatialReference.isGeographic?20015077/180:1,u=.1*n*Math.max(e.extent.width*c,e.extent.height*c,e.extent.zmax-e.extent.zmin),m=[],f=[],p=t[0].transformation,h=s(i(),p);"tangent"===r&&a(h,p);for(let s=0;s<l;s++){const e=t[s],o=e.attributes.get("position"),n=e.attributes.get(r);if(!o||!n)continue;const a=o.data,i=o.indices,l=n.data,c=n.indices;for(let t=0;t<i.length;t++){const e=3*i[t],r=c[t]*n.stride;g(Xe,a[e+0],a[e+1],a[e+2]),y(Xe,Xe,p),m.push(...Xe),g(Ze,l[r+0],l[r+1],l[r+2]),v(Ze,Ze,h),T(Ze,Ze),b(Xe,Xe,Ze,u),m.push(...Xe),f.push(f.length),f.push(f.length)}}return m.length?new we(o,[["position",new be(m,f,3,!0)]],null,2):null}_createAs3DShape(e,t,r,o){const n=e.geometry;if("mesh"!==n.type)return null;const s=this._createGeometryInfo(n,t,o);if(null==s)return null;const{geometries:a,objectTransformation:i}=s;if(Te.DRAW_MESH_GEOMETRY_NORMALS){const e=this._createPerVertexDebugVectors(n,a,"normal",this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(n,a,"tangent",this._debugTangentNormalMaterial,.5),r=this._createFaceDebugNormals(n,a);e&&a.push(e),t&&a.push(t),r&&a.push(r)}const l=this._context.layerViewUid,c=new je({geometries:a,layerViewUid:l,graphicUid:o,isElevationSource:!0});c.transformation=i;const u=ve(this.symbolLayer,{opacity:this._getLayerOpacity()}),m=u?new fe(a[0].material,u,this._context.slicePlaneEnabled):null,f=new me(this,c,null,ie,r,m);this._fastUpdateProcessor.onAddGraphic(),f.needsElevationUpdates=le(r.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(n),r.centerInElevationSR=this._getCenterInElevationSR(c.transformation);const{elevationProvider:p,renderCoordsHelper:h}=this._context,d=(e,t)=>ce(e,p,r,h,t);return f.alignedSampledElevation=ie(f,r,p.spatialReference,d,h),f}_fastTransformUpdatesAllowed(e){const{vertexSpace:t,spatialReference:r}=e;if(!k(t))return!1;const{type:o}=t,{view:n}=this._context.graphicsCoreOwner,{viewingMode:s}=n.state,a=n.spatialReference;return 1===s&&"local"===o||2===s&&q(a,r)&&"georeferenced"===o&&!r.isGeographic}_getElevationSR(){return this._context.elevationProvider.spatialReference??null}_getCenterInElevationSR(e){const t=P(),r=g(at,e[12],e[13],e[14]);return E(r,this._context.renderCoordsHelper.spatialReference,t,this._getElevationSR()),t}_passthroughReprojectionInfo(e){return 0===e.reprojection&&!!e.objectTransformation}_createPositionBuffer(e,t){const r=e.vertexAttributes.position;let o,n=r;if(0===t.reprojection)return{position:n,georeferencedPositionBuffer:o};const s=1===t.reprojection?t.transformBeforeProject:null;s&&(n=Y(new Float64Array(n.length),n,s));const{normal:a,tangent:i}=e.vertexAttributes;this._passthroughReprojectionInfo(t)||!a&&!i||(o=n);const l=n===r||n===o?new Float64Array(n.length):n;return B(n,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:o}}_createNormalBuffer(e,t,r,o){const n=e.vertexAttributes.normal;if(null==n)return null;let s=n;const a=1===o.reprojection?o.transformBeforeProject:null;a&&(s=K(s,new Float32Array(s.length),a));const i=this._context.graphicsCoreOwner.view.viewingMode;if(0===o.reprojection)return s;if("local"===i){if(!W(this._context.renderCoordsHelper.spatialReference))return s;if(null==r)return null;if(e.spatialReference.isGeographic){const e=s===n?new Float32Array(s.length):s;return J(s,0,r,e)}if(e.spatialReference.isWebMercator){const e=s===n?new Float32Array(s.length):s;return Q(s,0,r,e)}return s}if(null==r)return null;const l=s===n?new Float32Array(s.length):s,c=this._context.renderCoordsHelper.spatialReference;return X(s,r,e.spatialReference,t,c,l)}_createTangentBuffer(e,t,r,o){const n=e.vertexAttributes.tangent;if(null==n)return null;let s=n;const a=1===o.reprojection?o.transformBeforeProject:null;a&&(s=Z(s,new Float32Array(s.length),a));const i=this._context.graphicsCoreOwner.view.viewingMode;if(0===o.reprojection)return s;if("local"===i){if(!W(this._context.renderCoordsHelper.spatialReference))return s;if(null==r)return null;if(e.spatialReference.isGeographic){const e=s===n?new Float32Array(s.length):s;return J(s,1,r,e)}if(e.spatialReference.isWebMercator){const e=s===n?new Float32Array(s.length):s;return Q(s,1,r,e)}return s}if(null==r)return null;const l=s===n?new Float32Array(s.length):s,c=this._context.renderCoordsHelper.spatialReference;return ee(s,r,e.spatialReference,t,c,l)}_createSymbolColorBuffer(e){return this._requiresSymbolVertexColors()?new Uint8Array(this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!0)):null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,n=e.vertexAttributes.uv,s=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(s&&s.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(n&&n.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const a=this._computeReprojectionInfo(e),{position:i,georeferencedPositionBuffer:l}=this._createPositionBuffer(e,a),c=Ke(e),u=this._createSymbolColorBuffer(t),m=this._createNormalBuffer(e,i,l,a),p=this._createTangentBuffer(e,i,l,a),h=n,{transformation:d,position:g,normal:x,tangent:_}=this._passthroughReprojectionInfo(a)?{transformation:a.objectTransformation,position:i,normal:m,tangent:p}:this._transformOriginLocal(e,i,m,p);return{positionBuffer:g,normalBuffer:x,tangentBuffer:_,uvBuffer:h,colorBuffer:c,symbolColorBuffer:u,objectTransformation:d,geometryTransformation:0===a.reprojection&&a.geometryTransformation?a.geometryTransformation:f()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?q(this._context.renderCoordsHelper.spatialReference,e.spatialReference)?0:1:0;if(z(t))return{reprojection:r};const o=t.origin,n=f(),s=e.transform?.localMatrix??p;if(0===r){U(e.spatialReference,o,n,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:n,geometryTransformation:h(s)}}const a=l(f(),o);return c(a,a,s),{reprojection:r,transformBeforeProject:a}}_transformOriginLocal(e,t,r,o){const n=this._context.renderCoordsHelper.spatialReference,s=e.origin;Qe[0]=s.x,Qe[1]=s.y,Qe[2]=s.z??0;const a=f();U(e.spatialReference,Qe,a,n),u(rt,a);const{position:i,normal:l,tangent:c}=e.vertexAttributes,m=t===i?new Float64Array(t.length):t;Y(m,t,rt);const p=r?r===l?new Float32Array(r.length):r:null,h=o?o===c?new Float32Array(o.length):o:null;return r&&p&&K(r,p,rt),o&&h&&Z(o,h,rt),{transformation:a,position:m,normal:p,tangent:h}}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o&&o.length>0){let e=-1;for(let t=0;t<o.length;t++){const r=o[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=te(e,r??e.spatialReference);return!!o&&(F(o,nt),!O(nt,this._context.clippingExtent))}_createGeometryInfo(e,t,r){if(!I(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(!this._validateVertexSpace(e))return null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:n,uvBuffer:s,colorBuffer:a,symbolColorBuffer:i,normalBuffer:l,tangentBuffer:c,objectTransformation:u,geometryTransformation:f}=o,p=e.components??st,h=new Array;let d=!1;const g=m(Xe,u),x=this._context.localOriginFactory.getOrigin(g);for(const m of p){if(!this._validateFaces(e,m))return null;const t=Ee(e,m);if(0===t.length)continue;const o=Fe(n,l,m,t);o.didFlipNormals&&(d=!0);const u=[["position",new be(n,t,3,!0)],["normal",new be(o.normals,o.indices,3,!0)]];a&&u.push(["color",new be(a,t,4,!0)]);let p=null;i&&(p=G(t.length),u.push(["symbolColor",new be(i,p,4,!0)])),s&&u.push(["uv0",new be(s,t,2,!0)]),c&&u.push(["tangent",new be(c,t,4,!0)]);const g=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerViewUid:this._context.layerViewUid});g&&(p??=G(t.length),xe(u,g,p));const _=this._getOrCreateMaterial(e,m),y=new we(_,u,null,0);y.transformation=f,y.localOrigin=x,h.push(y)}return d&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),0===h.length?null:{geometries:h,objectTransformation:u}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial((e,t)=>{t.setParameters(e.parameters)})}_validateVertexSpace(e){const{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:r}=e;return 2!==t||"local"!==r.type||(this.logger.warn("Displaying a mesh with a local vertex space in a view in local viewing mode is not supported."),!1)}test(){return{...super.test(),materials:this._materialInfoCache.materials}}get _materialColor(){return this.symbolLayer.material?.color}}class Be{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}function Ee(e,t){return t.faces??D(e.vertexAttributes.position.length/3)}function Fe(e,t,r,o){switch(r.shading||"flat"){default:case"source":return Ve(e,t,r,o);case"flat":return Oe(e,o);case"smooth":return $e(e,o)}}function Oe(e,t){const r=$(t.length),o=new Array(3*t.length);for(let n=0;n<t.length;n+=3){const s=De(e,t,n,tt);for(let e=0;e<3;e++)r[n+e]=s[e],o[n+e]=n/3}return new Be(r,o,!1)}function Ve(e,t,r,o){if(null==t)return Oe(e,o);let n=!1;if(!r.trustSourceNormals)for(let s=0;s<o.length;s+=3){De(e,o,s,tt);for(let e=0;e<3;e++){const r=3*o[s+e];Xe[0]=t[r],Xe[1]=t[r+1],Xe[2]=t[r+2],j(tt,Xe)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],n=!0)}}return new Be(t,o,n)}function $e(e,t){const r={};for(let s=0;s<t.length;s+=3){const o=De(e,t,s,tt);for(let e=0;e<3;e++){const n=t[s+e];let a=r[n];a||(a={normal:P(),count:0},r[n]=a),x(a.normal,a.normal,o),a.count++}}const o=$(3*t.length),n=new Array(3*t.length);for(let s=0;s<t.length;s++){const e=r[t[s]];1!==e.count&&(T(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*s+t]=e.normal[t];n[s]=s}return new Be(o,n,!1)}function Ge(e,t,r,o,n,s){const a=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[a],o[1]=e[a+1],o[2]=e[a+2],n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],s[0]=e[l],s[1]=e[l+1],s[2]=e[l+2]}function De(e,t,r,o){return Ge(e,t,r,Xe,Ze,et),w(Ze,Ze,Xe),w(et,et,Xe),C(Xe,Ze,et),T(o,Xe),o}function Le(e){if(!e)return null;const{scale:t,offset:o,rotation:n}=e;return{scale:t,offset:o,rotation:r(n)}}function Ne(e="repeat"){if("string"==typeof e){const t=He(e);return{s:t,t}}return{s:He(e.horizontal),t:He(e.vertical)}}function He(e){switch(e){case"clamp":return 33071;case"mirror":return 33648;default:return 10497}}function ke(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}function ze(e,t,r){t.diffuse=e.toUnitRGB(),t.opacity="opaque"===r.alphaMode?1:e.a}function qe(e){return e.data??e.url}function We(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}function Ye(e){const{offset:t,scale:r,rotation:o}=e??Je;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}function Ke(e){return e.vertexAttributes.color}const Je=new H,Qe=P(),Xe=P(),Ze=P(),et=P(),tt=P(),rt=f(),ot=f(),nt=V(),st=[new L],at=P();export{Ue as Graphics3DMeshFillSymbolLayer};
2
+ import e from"../../../../Color.js";import{linearize as t}from"../../../../colorUtils.js";import{deg2rad as r}from"../../../../core/mathUtils.js";import{releaseMaybe as o}from"../../../../core/maybe.js";import{isPromiseLike as n}from"../../../../core/promiseUtils.js";import{normalFromMat4 as s,fromMat4 as a}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as l,multiply as c,invert as u,getTranslation as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f,IDENTITY as p,clone as h}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as g,add as x,scale as _,transformMat4 as y,transformMat3 as v,normalize as T,scaleAndAdd as b,subtract as w,cross as C,dot as j}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as M,ZEROS as R,ONES as A,create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as I}from"../../../../geometry/projectionUtils.js";import{computeTranslationToOriginAndRotation as U}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as B}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as E}from"../../../../geometry/projection/projectVectorToVector.js";import{fromBuffer as F,intersectsClippingArea as O,create as V}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as $}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as G,getContinuousIndexArray as D}from"../../../../geometry/support/Indices.js";import L from"../../../../geometry/support/MeshComponent.js";import N from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import H from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as k,isAbsoluteVertexSpace as z}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as q,isPlateCarree as W}from"../../../../geometry/support/spatialReferenceUtils.js";import{t as Y}from"../../../../chunks/vec3.js";import{transformNormal as K,transformVectorENUPlateCarree as J,transformVectorWMPlateCarree as Q,projectNormalToPCPF as X,transformTangent as Z,projectTangentToPCPF as ee}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as te}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{isDrivenOpacityFallbackAlwaysOpaque as re}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{getEmissiveMode as oe}from"../../../../symbols/support/materialUtils.js";import{isEncodedMeshTexture as ne}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as se}from"../../glTF/internal/TextureTransformUtils.js";import{defaultSymbolLayerMemoryComplexity as ae}from"./defaultSymbolComplexity.js";import{perObjectElevationAligner as ie}from"./ElevationAligners.js";import{needsElevationUpdates3D as le,evaluateElevationInfoAtPoint as ce}from"./elevationAlignmentUtils.js";import{preparePatchEmissiveStrength as ue}from"./emissiveUtils.js";import{Graphics3DMeshObject3DGraphicLayer as me}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as fe}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as pe,nanFallbackColor as he}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as de,MeshFastUpdateProcessor as ge}from"./MeshFastUpdateProcessor.js";import{addOlidAttribute as xe}from"./olidUtils.js";import{SymbolComplexity as _e}from"./SymbolComplexity.js";import{hasEdges as ye,createMaterial as ve}from"../support/edgeUtils.js";import{debugFlags as Te}from"../../support/debugFlags.js";import{Attribute as be}from"../../webgl-engine/lib/Attribute.js";import{Geometry as we}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as Ce}from"../../webgl-engine/lib/ManagedTexture.js";import{Object3D as je}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as Me}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as Re}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as Ae,advancedMRRFactors as Pe,schematicMRRFactors as Se}from"../../webgl-engine/materials/pbrUtils.js";const Ie=["mesh"];class Ue extends pe{constructor(e,t,r,o){super(e,t,r,o,re(t)),this._materialInfoCache=new de,this._fastUpdateProcessor=new ge,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){Te.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new Re({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new Re({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new Re({color:[0,1,1,1]})),this.updateComplexity()}destroy(){super.destroy(),this._textures.forEach(e=>e.unload()),this._context.stage.removeTextures(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy()}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Ie,"fill on mesh-3d"))return null;const r=this.createElevationContextForGraphic(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters(e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTextureAlphaMode(t,e)}),e?.forEach(e=>t(e)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,le)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters(({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),e?.forEach(e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters(({material:t})=>t.setParameters({usePBR:e})),!0}updateTransform(e,t,r,o){if(!e.fastTransformUpdatesAllowed)return!1;const n=e.fastTransformUpdatesEnabled;switch(o){case 0:if(n)return!0;break;case 1:if(!n)return!0;break;default:if(!n)return!!this.updateTransform(e,t,r,0)&&(e.autoDisableFastTransformUpdates(()=>this.updateTransform(e,t,r,1)),!0)}const s=this._context.renderCoordsHelper.spatialReference,a=ot,{origin:i,transform:l}=r;if(!U(t,g(Xe,i.x,i.y,i.z??0),a,s))return!1;switch(o){case 0:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case 1:this._fastUpdateProcessor.disable(e,this._materialInfoCache)}e.updateFastLocalOrigin(a,l,this._context.localOriginFactory,!1);const{elevationContext:c}=e;c.centerInElevationSR=this._getCenterInElevationSR(a);const{elevationProvider:u,renderCoordsHelper:m}=this._context,f=(e,t)=>ce(e,u,c,m,t);return e.alignedSampledElevation=ie(e,c,u.spatialReference,f,m,a),e.updateTransform(a,l,this._context.isAsync),e.updateAutoDisableFastTransformUpdates(()=>this.updateTransform(e,t,r,1)),!0}computeComplexity(){if(!this._textures||0===this._textures.size)return super.computeComplexity();let e=0;for(const o of this._textures.values())e+=o.usedMemory;const t={...ae(this.symbol,this.symbolLayer),resourceBytes:e},r=ye(this.symbolLayer)?2:0;return new _e({drawCallsPerFeature:r,memory:t})}_requiresSymbolVertexColors(){return this._hasDrivenColorOrOpacity}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,n=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:n,unlit:!1,uid:`vc:${o},vt:${n},vct${t},svc:${r}`}}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:n,colorTexture:s,colorTextureTransform:a,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,f=We(n),p=We(s),h=Ye(a),d=We(i),g=Ye(l);if(o.color=n,o.colorTexture=s,o.normalTexture=i,o.uid=`${o.uid},cmuid:${f},ctmuid:${p},cttuid:${h},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof N){const{metallic:e,roughness:r,metallicRoughnessTexture:n,metallicRoughnessTextureTransform:s,emissiveColor:i,emissiveStrength:c,emissiveTexture:u,emissiveTextureTransform:m,occlusionTexture:f,occlusionTextureTransform:p,unlit:h}=t.material,d=We(n),g=Ye(s),x=We(i),_=We(u),y=Ye(m),v=We(f),T=Ye(p);o.uid=[o.uid,`mrm:${e}`,`mrr:${r}`,`mrt:${d}`,`mrtt:${g}`,`emuid:${x}`,`ems:${c}`,`etmuid:${_}`,`ett:${y}`,`otmuid:${v}`,`ott:${T}`,`unlit:${h}`].join(","),o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=n,o.emissiveColor=h?void 0:i,o.emissiveStrength=c,o.emissiveTexture=h?void 0:u,o.occlusionTexture=f,o.unlit=h,o.colorTextureTransform=Le(a),o.normalTextureTransform=Le(l),o.emissiveTextureTransform=Le(m),o.occlusionTextureTransform=Le(p),o.metallicRoughnessTextureTransform=Le(s)}return o}_getInternalTexture(e,t=!1,r=1){const s=qe(e);if(!s)return null;const a=`${e.contentHash}/${r}`;let i=this._textures.get(a);if(i){const e=this._context.stage.renderView.textures;let t=null;const r=e.acquire(i.id);return null==r||n(r)||(i.events.on("unloaded",()=>t=o(t)),t=r),i}let l=null;const c=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,u={wrap:Ne(e.wrap),noUnpackFlip:!0,maxAnisotropy:c,mipmap:c>1};return ne(s)?(l=s.data,u.preMultiplyAlpha=!1,u.encoding=s.encoding):(l=s,u.preMultiplyAlpha=1!==r,u.compressionOptions=t?{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}:void 0),i=new Ce(l,u),this._textures.set(a,i),i.events.on("loaded",()=>this.updateComplexity()),i.load(this._context.stage.renderView.renderingContext),this._context.stage.addTexture(i),i.events.on("unloaded",()=>{this._textures.delete(a)}),i}_setInternalMaterialTextureParameters(e,r){if(null!=e.colorTexture){const t=1!==r.textureAlphaMode,o=this._getInternalTexture(e.colorTexture,t,r.textureAlphaMode);o?(r.textureId=o.id,r.textureAlphaPremultiplied=!!o.parameters.preMultiplyAlpha):r.textureId=void 0}if(e.normalTexture&&(r.normalTextureId=this._getInternalTexture(e.normalTexture)?.id),e.emissiveColor){const o=e.emissiveColor?.toUnitRGB();r.emissiveBaseColor=M(t(o[0]),t(o[1]),t(o[2]))}e.emissiveStrength&&(r.emissiveStrengthKHR=e.emissiveStrength),e.emissiveTexture&&(r.emissiveTextureId=this._getInternalTexture(e.emissiveTexture)?.id),e.occlusionTexture&&(r.occlusionTextureId=this._getInternalTexture(e.occlusionTexture,!0)?.id),e.metallicRoughnessTexture&&(r.metallicRoughnessTextureId=this._getInternalTexture(e.metallicRoughnessTexture,!0)?.id)}_setInternalMaterialParameters(e,t,r){null!=e.color&&ze(e.color,t,r),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=se(e.colorTextureTransform),t.normalTextureTransformMatrix=se(e.normalTextureTransform);const o=null!=e.normalTextureTransform?.scale?e.normalTextureTransform?.scale:d;t.scale=[o[0],o[1]],t.occlusionTextureTransformMatrix=se(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=se(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=se(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(e,t=this._materialColor){const r=this._drivenProperties.color,o=this._drivenProperties.opacity;if(r)e.externalColor=S;else{const r=t??null;if(r){const t=r.toUnitRGBA();o&&(t[3]=1),e.externalColor=t}else e.externalColor=he}e.colorMixMode=this.symbolLayer.material?.colorMixMode??"multiply",e.castShadows=!!this.symbolLayer.castShadows,e.emissiveStrengthFromSymbol=this.symbolLayer?.material?.emissive?.strength??1,e.emissiveSource=oe(this.symbolLayer?.material?.emissive?.source??"emissive")}_getOrCreateMaterial(e,t){const r=t.material?.color,o=t.material?.colorTexture,n=t.material?.alphaMode,s="blend"===n,a=!("opaque"===n)&&(ke(e)||null!=r&&r.a<1||o?.transparent||s),i=this._materialProperties(e,t,a),l=this._materialInfoCache.byUid(i.uid);if(l)return this._setInternalMaterialTextureParameters(i,l.material.parameters),l.material;const c={uid:i.uid,material:null,isComponentTransparent:a,alphaMode:t.material?t.material.alphaMode:"opaque"},u=Ae({normalTexture:i.normalTexture,metallicRoughnessTexture:i.metallicRoughnessTexture,metallicFactor:i.metallic,roughnessFactor:i.roughness,emissiveTexture:i.unlit?void 0:i.emissiveTexture,emissiveFactor:i.unlit?R:i.emissiveColor?.toUnitRGB(),occlusionTexture:i.occlusionTexture}),m={usePBR:this._usePBR(),isSchematic:u,hasVertexColors:i.hasVertexColors,hasSymbolColors:i.hasSymbolVertexColors,hasVertexTangents:i.hasVertexTangents,ambient:R,diffuse:A,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:0,unlit:i.unlit,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,drivenOpacity:this.needsDrivenTransparentPass||c.isComponentTransparent};m.mrrFactors=u?Se:[i.metallic,i.roughness,Pe[2]],t.material&&(m.doubleSided=t.material.doubleSided,m.cullFace=t.material.doubleSided?0:2,m.textureAlphaCutoff=t.material.alphaCutoff),this._setExternalMaterialParameters(m),this._setMaterialTextureAlphaMode(m,c),this._setInternalMaterialParameters(i,m,c);const f=new Me(m,this._context);return c.material=f,this._materialInfoCache.set(i.uid,c),f}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchColor(e,t),this._preparePatchEmissive(e,t)}_preparePatchColor(e,t){if(!t.material||"partial"!==t.material.type)return;const r=t.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const o=r.color.newValue;delete r.color,e.symbolLayerStatePatches.push(()=>{this._updateMaterialParameters(e=>{const t=e.material.parameters;this._setExternalMaterialParameters(t,o),this._setMaterialTextureAlphaMode(t,e),e.material.setParameters({externalColor:t.externalColor})})})}_preparePatchEmissive(e,t){return ue(e,t,e=>{this._updateMaterialParameters(t=>{t.material.setParameters({emissiveStrengthFromSymbol:e??1})})},this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result)}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTextureAlphaMode(e,t){if("auto"===t.alphaMode){const r=this.needsDrivenTransparentPass||t.isComponentTransparent||(e.layerOpacity??1)<1||(e.opacity??1)<1||(e.externalColor?.[3]??1)<1;e.textureAlphaMode=r?3:1}else e.textureAlphaMode="opaque"===t.alphaMode?1:"mask"===t.alphaMode?2:0}_createFaceDebugNormals(e,t){const r=t.length,o=e.spatialReference.isGeographic?20015077/180:1,n=.1*Math.max(e.extent.width*o,e.extent.height*o,e.extent.zmax-e.extent.zmin),a=[],l=[],c=t[0].transformation,u=s(i(),c);for(let s=0;s<r;s++){const e=t[s].attributes.get("position");if(!e)continue;const r=e.data,o=e.indices;for(let t=0;t<o.length;t+=3)De(r,o,t,tt),Ge(r,o,t,Xe,Ze,et),x(Xe,Xe,Ze),x(Xe,Xe,et),_(Xe,Xe,1/3),y(Xe,Xe,c),a.push(...Xe),v(tt,tt,u),T(tt,tt),b(Xe,Xe,tt,n),a.push(...Xe),l.push(l.length),l.push(l.length)}return a.length?new we(this._debugFaceNormalMaterial,[["position",new be(a,l,3,!0)]],null):null}_createPerVertexDebugVectors(e,t,r,o,n){const l=t.length,c=e.spatialReference.isGeographic?20015077/180:1,u=.1*n*Math.max(e.extent.width*c,e.extent.height*c,e.extent.zmax-e.extent.zmin),m=[],f=[],p=t[0].transformation,h=s(i(),p);"tangent"===r&&a(h,p);for(let s=0;s<l;s++){const e=t[s],o=e.attributes.get("position"),n=e.attributes.get(r);if(!o||!n)continue;const a=o.data,i=o.indices,l=n.data,c=n.indices;for(let t=0;t<i.length;t++){const e=3*i[t],r=c[t]*n.stride;g(Xe,a[e+0],a[e+1],a[e+2]),y(Xe,Xe,p),m.push(...Xe),g(Ze,l[r+0],l[r+1],l[r+2]),v(Ze,Ze,h),T(Ze,Ze),b(Xe,Xe,Ze,u),m.push(...Xe),f.push(f.length),f.push(f.length)}}return m.length?new we(o,[["position",new be(m,f,3,!0)]],null):null}_createAs3DShape(e,t,r,o){const n=e.geometry;if("mesh"!==n.type)return null;const s=this._createGeometryInfo(n,t,o);if(null==s)return null;const{geometries:a,objectTransformation:i}=s;if(Te.DRAW_MESH_GEOMETRY_NORMALS){const e=this._createPerVertexDebugVectors(n,a,"normal",this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(n,a,"tangent",this._debugTangentNormalMaterial,.5),r=this._createFaceDebugNormals(n,a);e&&a.push(e),t&&a.push(t),r&&a.push(r)}const l=this._context.layerViewUid,c=new je({geometries:a,layerViewUid:l,graphicUid:o,isElevationSource:!0});c.transformation=i;const u=ve(this.symbolLayer,{opacity:this._getLayerOpacity()}),m=u?new fe(a[0].material,u,this._context.slicePlaneEnabled):null,f=new me(this,c,null,ie,r,m);this._fastUpdateProcessor.onAddGraphic(),f.needsElevationUpdates=le(r.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(n),r.centerInElevationSR=this._getCenterInElevationSR(c.transformation);const{elevationProvider:p,renderCoordsHelper:h}=this._context,d=(e,t)=>ce(e,p,r,h,t);return f.alignedSampledElevation=ie(f,r,p.spatialReference,d,h),f}_fastTransformUpdatesAllowed(e){const{vertexSpace:t,spatialReference:r}=e;if(!k(t))return!1;const{type:o}=t,{view:n}=this._context.graphicsCoreOwner,{viewingMode:s}=n.state,a=n.spatialReference;return 1===s&&"local"===o||2===s&&q(a,r)&&"georeferenced"===o&&!r.isGeographic}_getElevationSR(){return this._context.elevationProvider.spatialReference??null}_getCenterInElevationSR(e){const t=P(),r=g(at,e[12],e[13],e[14]);return E(r,this._context.renderCoordsHelper.spatialReference,t,this._getElevationSR()),t}_passthroughReprojectionInfo(e){return 0===e.reprojection&&!!e.objectTransformation}_createPositionBuffer(e,t){const r=e.vertexAttributes.position;let o,n=r;if(0===t.reprojection)return{position:n,georeferencedPositionBuffer:o};const s=1===t.reprojection?t.transformBeforeProject:null;s&&(n=Y(new Float64Array(n.length),n,s));const{normal:a,tangent:i}=e.vertexAttributes;this._passthroughReprojectionInfo(t)||!a&&!i||(o=n);const l=n===r||n===o?new Float64Array(n.length):n;return B(n,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:o}}_createNormalBuffer(e,t,r,o){const n=e.vertexAttributes.normal;if(null==n)return null;let s=n;const a=1===o.reprojection?o.transformBeforeProject:null;a&&(s=K(s,new Float32Array(s.length),a));const i=this._context.graphicsCoreOwner.view.viewingMode;if(0===o.reprojection)return s;if("local"===i){if(!W(this._context.renderCoordsHelper.spatialReference))return s;if(null==r)return null;if(e.spatialReference.isGeographic){const e=s===n?new Float32Array(s.length):s;return J(s,0,r,e)}if(e.spatialReference.isWebMercator){const e=s===n?new Float32Array(s.length):s;return Q(s,0,r,e)}return s}if(null==r)return null;const l=s===n?new Float32Array(s.length):s,c=this._context.renderCoordsHelper.spatialReference;return X(s,r,e.spatialReference,t,c,l)}_createTangentBuffer(e,t,r,o){const n=e.vertexAttributes.tangent;if(null==n)return null;let s=n;const a=1===o.reprojection?o.transformBeforeProject:null;a&&(s=Z(s,new Float32Array(s.length),a));const i=this._context.graphicsCoreOwner.view.viewingMode;if(0===o.reprojection)return s;if("local"===i){if(!W(this._context.renderCoordsHelper.spatialReference))return s;if(null==r)return null;if(e.spatialReference.isGeographic){const e=s===n?new Float32Array(s.length):s;return J(s,1,r,e)}if(e.spatialReference.isWebMercator){const e=s===n?new Float32Array(s.length):s;return Q(s,1,r,e)}return s}if(null==r)return null;const l=s===n?new Float32Array(s.length):s,c=this._context.renderCoordsHelper.spatialReference;return ee(s,r,e.spatialReference,t,c,l)}_createSymbolColorBuffer(e){return this._requiresSymbolVertexColors()?new Uint8Array(this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!0)):null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,n=e.vertexAttributes.uv,s=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(s&&s.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(n&&n.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const a=this._computeReprojectionInfo(e),{position:i,georeferencedPositionBuffer:l}=this._createPositionBuffer(e,a),c=Ke(e),u=this._createSymbolColorBuffer(t),m=this._createNormalBuffer(e,i,l,a),p=this._createTangentBuffer(e,i,l,a),h=n,{transformation:d,position:g,normal:x,tangent:_}=this._passthroughReprojectionInfo(a)?{transformation:a.objectTransformation,position:i,normal:m,tangent:p}:this._transformOriginLocal(e,i,m,p);return{positionBuffer:g,normalBuffer:x,tangentBuffer:_,uvBuffer:h,colorBuffer:c,symbolColorBuffer:u,objectTransformation:d,geometryTransformation:0===a.reprojection&&a.geometryTransformation?a.geometryTransformation:f()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?q(this._context.renderCoordsHelper.spatialReference,e.spatialReference)?0:1:0;if(z(t))return{reprojection:r};const o=t.origin,n=f(),s=e.transform?.localMatrix??p;if(0===r){U(e.spatialReference,o,n,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:n,geometryTransformation:h(s)}}const a=l(f(),o);return c(a,a,s),{reprojection:r,transformBeforeProject:a}}_transformOriginLocal(e,t,r,o){const n=this._context.renderCoordsHelper.spatialReference,s=e.origin;Qe[0]=s.x,Qe[1]=s.y,Qe[2]=s.z??0;const a=f();U(e.spatialReference,Qe,a,n),u(rt,a);const{position:i,normal:l,tangent:c}=e.vertexAttributes,m=t===i?new Float64Array(t.length):t;Y(m,t,rt);const p=r?r===l?new Float32Array(r.length):r:null,h=o?o===c?new Float32Array(o.length):o:null;return r&&p&&K(r,p,rt),o&&h&&Z(o,h,rt),{transformation:a,position:m,normal:p,tangent:h}}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o&&o.length>0){let e=-1;for(let t=0;t<o.length;t++){const r=o[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=te(e,r??e.spatialReference);return!!o&&(F(o,nt),!O(nt,this._context.clippingExtent))}_createGeometryInfo(e,t,r){if(!I(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(!this._validateVertexSpace(e))return null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:n,uvBuffer:s,colorBuffer:a,symbolColorBuffer:i,normalBuffer:l,tangentBuffer:c,objectTransformation:u,geometryTransformation:f}=o,p=e.components??st,h=new Array;let d=!1;const g=m(Xe,u),x=this._context.localOriginFactory.getOrigin(g);for(const m of p){if(!this._validateFaces(e,m))return null;const t=Ee(e,m);if(0===t.length)continue;const o=Fe(n,l,m,t);o.didFlipNormals&&(d=!0);const u=[["position",new be(n,t,3,!0)],["normal",new be(o.normals,o.indices,3,!0)]];a&&u.push(["color",new be(a,t,4,!0)]);let p=null;i&&(p=G(t.length),u.push(["symbolColor",new be(i,p,4,!0)])),s&&u.push(["uv0",new be(s,t,2,!0)]),c&&u.push(["tangent",new be(c,t,4,!0)]);const g=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerViewUid:this._context.layerViewUid});g&&(p??=G(t.length),xe(u,g,p));const _=this._getOrCreateMaterial(e,m),y=new we(_,u,null);y.transformation=f,y.localOrigin=x,h.push(y)}return d&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),0===h.length?null:{geometries:h,objectTransformation:u}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial((e,t)=>{t.setParameters(e.parameters)})}_validateVertexSpace(e){const{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:r}=e;return 2!==t||"local"!==r.type||(this.logger.warn("Displaying a mesh with a local vertex space in a view in local viewing mode is not supported."),!1)}test(){return{...super.test(),materials:this._materialInfoCache.materials}}get _materialColor(){return this.symbolLayer.material?.color}}class Be{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}function Ee(e,t){return t.faces??D(e.vertexAttributes.position.length/3)}function Fe(e,t,r,o){switch(r.shading||"flat"){default:case"source":return Ve(e,t,r,o);case"flat":return Oe(e,o);case"smooth":return $e(e,o)}}function Oe(e,t){const r=$(t.length),o=new Array(3*t.length);for(let n=0;n<t.length;n+=3){const s=De(e,t,n,tt);for(let e=0;e<3;e++)r[n+e]=s[e],o[n+e]=n/3}return new Be(r,o,!1)}function Ve(e,t,r,o){if(null==t)return Oe(e,o);let n=!1;if(!r.trustSourceNormals)for(let s=0;s<o.length;s+=3){De(e,o,s,tt);for(let e=0;e<3;e++){const r=3*o[s+e];Xe[0]=t[r],Xe[1]=t[r+1],Xe[2]=t[r+2],j(tt,Xe)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],n=!0)}}return new Be(t,o,n)}function $e(e,t){const r={};for(let s=0;s<t.length;s+=3){const o=De(e,t,s,tt);for(let e=0;e<3;e++){const n=t[s+e];let a=r[n];a||(a={normal:P(),count:0},r[n]=a),x(a.normal,a.normal,o),a.count++}}const o=$(3*t.length),n=new Array(3*t.length);for(let s=0;s<t.length;s++){const e=r[t[s]];1!==e.count&&(T(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*s+t]=e.normal[t];n[s]=s}return new Be(o,n,!1)}function Ge(e,t,r,o,n,s){const a=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[a],o[1]=e[a+1],o[2]=e[a+2],n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],s[0]=e[l],s[1]=e[l+1],s[2]=e[l+2]}function De(e,t,r,o){return Ge(e,t,r,Xe,Ze,et),w(Ze,Ze,Xe),w(et,et,Xe),C(Xe,Ze,et),T(o,Xe),o}function Le(e){if(!e)return null;const{scale:t,offset:o,rotation:n}=e;return{scale:t,offset:o,rotation:r(n)}}function Ne(e="repeat"){if("string"==typeof e){const t=He(e);return{s:t,t}}return{s:He(e.horizontal),t:He(e.vertical)}}function He(e){switch(e){case"clamp":return 33071;case"mirror":return 33648;default:return 10497}}function ke(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}function ze(e,t,r){t.diffuse=e.toUnitRGB(),t.opacity="opaque"===r.alphaMode?1:e.a}function qe(e){return e.data??e.url}function We(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}function Ye(e){const{offset:t,scale:r,rotation:o}=e??Je;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}function Ke(e){return e.vertexAttributes.color}const Je=new H,Qe=P(),Xe=P(),Ze=P(),et=P(),tt=P(),rt=f(),ot=f(),nt=V(),st=[new L],at=P();export{Ue as Graphics3DMeshFillSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import t from"../../../../geometry/Extent.js";import e from"../../../../geometry/Polygon.js";import{getContinuousIndexArray as i,getZeroIndexArray as o}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as n}from"./olidUtils.js";import{Attribute as r}from"../../webgl-engine/lib/Attribute.js";import{Geometry as a}from"../../webgl-engine/lib/Geometry.js";function u(t){const e=t.attributeData.position.length/3,u=i(e),s=[["position",new r(t.attributeData.position,u,3,!0)]],{boundingRect:l,textureElementIndices:c,boundingRectIndices:p}=t.attributeData,m=null!=l,b=o(m?p?.length??1:e);null!=t.attributeData.colorFeature?s.push(["colorFeatureAttribute",new r([t.attributeData.colorFeature],b,1,!0)]):t.attributeData.color&&s.push(["color",new r(t.attributeData.color,b,4,!0)]),t.attributeData.uvMapSpace&&s.push(["uvMapSpace",new r(t.attributeData.uvMapSpace,u,4,!0)]),m&&(s.push(["boundingRect",new r(l,p??[0],9,!0)]),null!=c&&s.push(["textureElementIndex",new r(c,u,1,!0)]));const d=t.attributeData.olidColor;return null!=d&&n(s,d,o(e)),new a(t.material,s,t.mapPositions,0,void 0,void 0,t.indices)}function s(t,e=null){const u=t.attributeData.position.length/3,s=i(u),l=[["position",new r(t.attributeData.position,s,3,!0)],["uv0",new r(t.attributeData.uv0,s,2,!0)]];return null!=e&&n(l,e,o(u)),new a(t.material,l,t.mapPositions,0,void 0,void 0,t.indices)}function l(i){switch(i.type){case"extent":if(i instanceof t)return e.fromExtent(i);break;case"polygon":return i}return null}class c{constructor(t,e,i){this.renderData=t,this.layerViewUid=e,this.graphicUid=i,this.outGeometries=new Array}}export{c as PolygonCreationDataBase,u as createColorGeometry,s as createWaterGeometry,l as geometryAsPolygon};
2
+ import t from"../../../../geometry/Extent.js";import e from"../../../../geometry/Polygon.js";import{getContinuousIndexArray as i,getZeroIndexArray as o}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as n}from"./olidUtils.js";import{Attribute as r}from"../../webgl-engine/lib/Attribute.js";import{Geometry as a}from"../../webgl-engine/lib/Geometry.js";function u(t){const e=t.attributeData.position.length/3,u=i(e),s=[["position",new r(t.attributeData.position,u,3,!0)]],{boundingRect:l,textureElementIndices:c,boundingRectIndices:p}=t.attributeData,m=null!=l,b=o(m?p?.length??1:e);null!=t.attributeData.colorFeature?s.push(["colorFeatureAttribute",new r([t.attributeData.colorFeature],b,1,!0)]):t.attributeData.color&&s.push(["color",new r(t.attributeData.color,b,4,!0)]),t.attributeData.uvMapSpace&&s.push(["uvMapSpace",new r(t.attributeData.uvMapSpace,u,4,!0)]),m&&(s.push(["boundingRect",new r(l,p??[0],9,!0)]),null!=c&&s.push(["textureElementIndex",new r(c,u,1,!0)]));const d=t.attributeData.olidColor;return null!=d&&n(s,d,o(e)),new a(t.material,s,t.mapPositions,void 0,void 0,t.indices)}function s(t,e=null){const u=t.attributeData.position.length/3,s=i(u),l=[["position",new r(t.attributeData.position,s,3,!0)],["uv0",new r(t.attributeData.uv0,s,2,!0)]];return null!=e&&n(l,e,o(u)),new a(t.material,l,t.mapPositions,void 0,void 0,t.indices)}function l(i){switch(i.type){case"extent":if(i instanceof t)return e.fromExtent(i);break;case"polygon":return i}return null}class c{constructor(t,e,i){this.renderData=t,this.layerViewUid=e,this.graphicUid=i,this.outGeometries=new Array}}export{c as PolygonCreationDataBase,u as createColorGeometry,s as createWaterGeometry,l as geometryAsPolygon};
@@ -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{normalize as r,copy as n,set as e,dist as s,sub as o,dot as i,scaleAndAdd as u,cross as c,add as f,scale as a,len as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l,fromValues as m,freeze as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as _}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBuffer as g}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as b}from"../../../../geometry/projection/projectVec3Array.js";import{fromValues as S,signedDistance as M}from"../../../../geometry/support/plane.js";import{Frustum as F}from"../../state/Frustum.js";class R{constructor(t,r){this._renderCoordsHelper=t,this.opaqueGround=r,this._cache=new Map,this._cameraForward=l(),this._cameraEye=l(),this._cameraFovY=55*Math.PI/180,this._frustumBoundingSphereCenter=l(),this._frustumBoundingSphereRadius=0,this._frustum=new F(t),this._renderSR=t.spatialReference;const n=_(this._renderSR);this._renderSREllipsoidRadius=d(n).radius}setup(t){this._aboveGround=t.aboveGround,this._frustum.update(t),r(this._cameraForward,t.viewForward),n(this._cameraEye,t.eye),this._cameraFovY=t.fovY,this._updateFrustumBoundingSphere()}done(){this._cache.clear()}compute(t){if(this._cache.has(t.id))return this._cache.get(t.id);const r=this._isVisibleInFrustum(t);return this._cache.set(t.id,r),r}_isVisibleInFrustum(t){return 2===this._renderCoordsHelper.viewingMode?this._isTileVisibleInFrustumLocal(t):this._isTileVisibleInFrustumGlobal(t)}_updateFrustumBoundingSphere(){const t=this._frustum.boundingSphere;n(this._frustumBoundingSphereCenter,t.center),this._frustumBoundingSphereRadius=t.radius+xt}_isTileVisibleInFrustumLocal(t){const r=t.spatialReference,n=t.extent,c=this._renderSR;if(!n)return!0;if(E[0]=n[0],E[1]=n[1],E[2]=0,E[3]=n[2],E[4]=n[3],E[5]=0,!g(E,r,0,E,c,0))return!1;e(P[0],E[0],E[1],0),e(P[1],E[3],E[1],0),e(P[2],E[3],E[4],0),e(P[3],E[0],E[4],0),e(T,.5*(E[0]+E[3]),.5*(E[1]+E[4]),.5*(E[2]+E[5]));const f=vt,a=.5*s(P[0],P[2]),h=this._frustum,l=this._frustumBoundingSphereRadius,m=this._frustumBoundingSphereCenter,p=z;o(p,m,T);const d=i(f,p),_=W;u(_,T,f,d);if(s(_,m)>a+l)return!1;const b=this._cameraForward,S=i(b,vt),M=this._cameraFovY,F=this._cameraEye;if(Math.abs(S)<Math.abs(Math.cos(.5*M))){let t=!0;const r=e(jt,b[0],b[1],0),n=i(F,r);for(let e=0;e<4;++e){const s=P[e];if(i(s,r)-n>0){t=!1;break}}if(t)return!1}{const t=P[0],r=P[2];if(t[0]<=F[0]&&F[0]<=r[0]&&t[1]<=F[1]&&F[1]<=r[1])return!0}const R=C,v=this.opaqueGround&&this._aboveGround,j=this.opaqueGround&&!this._aboveGround,G=Math.min(j?_t:1/0,d+l),B=Math.max(v?-_t:-1/0,d-l);for(let e=0;e<4;++e)u(R[e],P[e],f,G),u(R[e+4],P[e],f,B);if(q(h.planes,R,8))return!1;if(w(h.planes,R,8))return!0;for(let e=0;e<4;++e){const t=R[e],r=R[e+4];if(Gt(h.planes,t,r))return!0;const n=R[(e+1)%4];if(Gt(h.planes,t,n))return!0;const s=R[4+(e+1)%4];if(Gt(h.planes,r,s))return!0}if(qt[0][3]=+P[0][0],qt[1][3]=-P[2][0],qt[2][3]=+P[0][1],qt[3][3]=-P[2][1],qt[4][3]=+B,qt[5][3]=-G,w(qt,h.points))return!0;for(let e=0;e<4;++e){const t=F,r=h.points[e+4];if(Bt(qt,t,r))return!0;const n=h.points[4+(e+1)%4];if(Bt(qt,r,n))return!0}return!1}_isTileVisibleInFrustumGlobal(n){if(n.level<x)return!0;const l=n.spatialReference,m=n.extent;if(!m||!l)return!0;const p=this.opaqueGround&&this._aboveGround,d=this.opaqueGround&&!this._aboveGround,_=P,g=.5*(m[0]+m[2]);if(e(_[0],m[0],m[1],0),e(_[1],m[2],m[1],0),e(_[2],m[2],m[3],0),e(_[3],m[0],m[3],0),e(_[4],g,m[1],0),e(_[5],g,m[3],0),!b(_,l,0,_,this._renderSR,0,6))return!1;const S=_[0][2]>0,F=_[3][2]<0,R=S||F,B=this._renderSREllipsoidRadius;if(R){const t=k;v(t,wt,_[0]);const r=U;if(v(r,wt,_[1]),S){const n=Y,e=_[4],s=H;v(s,e,wt),v(n,s,e);const o=_[0];c(o,t,n),G(o,B);const i=_[1];c(i,r,n),G(i,B)}else if(F){const n=Y,e=_[5],s=H;v(s,e,wt),v(n,e,s);const o=_[3];c(o,n,t),G(o,B);const i=_[2];c(i,n,r),G(i,B)}}const y=T,w=o(O,_[3],_[0]);r(w,w);const I=f(Q,_[0],_[3]);a(I,I,.5);const C=-i(I,w),E=f(X,_[0],_[1]);a(E,E,.5);const W=f(Z,_[2],_[3]);a(W,W,.5);const z=o($,W,E);r(z,z);const st=-(C+i(w,E))/i(w,z);u(y,E,z,st),G(y,B);const lt=this._frustumBoundingSphereRadius,mt=this._frustumBoundingSphereCenter,pt=this._frustum,vt=pt.planes,jt=L;r(jt,y);const Gt=i(_[0],jt)/h(_[0]),Bt=Math.sqrt(1-Gt*Gt),yt=pt.origin,qt=pt.points;let xt=!1;if(p){xt=!0;const t=r(gt,yt);for(let n=0;n<4;++n){const e=qt[4+n],s=o(St,e,yt);r(s,s);const u=c(Mt,t,s);r(u,u);const f=c(Ft,s,u);r(f,f);if(i(yt,f)>B){xt=!1;break}}if(xt){if(i(yt,jt)<B*Gt-_t)return!1}if(i(t,jt)<-Bt)return!1;{const t=r(bt,pt.direction);if(i(t,jt)>Rt)return!1}}if(Bt>.9)return!0;let It=!1;const Vt=i(jt,mt),Ct=h(mt);if(Ct<=lt&&!vt.some(t=>M(t,D)>0)){if(!p)return!0;It=!0}if(!It&&Vt<=0){if(-Vt>lt)return!1}if(!It&&Ct>lt){const r=t(Vt/Ct,-1,1),n=Math.sqrt(1-r*r),e=t(lt/Ct,0,1);if(n*Math.sqrt(1-e*e)-e*r>Bt)return!1}if(!xt){if(_.some(t=>pt.intersectsPoint(t)))return!0;if(pt.intersectsPoint(y))return!0}const Et=J;o(Et,mt,D);const Pt=i(Et,jt),Tt=A;a(Tt,jt,Pt);const Yt=s(Tt,mt),kt=l.isWGS84,Ut=n.lij,Ht=kt&&Ut[2]===2**Ut[0]-1,Lt=kt&&0===Ut[2],At=Lt?ft:Ht?ut:ot,Wt=Lt?at:Ht?ct:it;if(!It){const t=_,r=ht,n=tt,e=rt,s=D;for(const o of At){const u=t[o];if(j(n,t[(o+1)%4],u),j(e,s,u),v(r,e,n),i(r,jt)>0&&a(r,r,-1),V(r,qt,1))return!1}}let zt=null;if(!p&&Pt<1.01*lt){const t=2.5*lt;if(Yt>Gt*t+lt)return!1;const r=N,n=t/Gt;for(let e=0;e<4;++e)a(r[e],_[e],n/B);e(r[4],0,0,0),zt=r}else{const t=(d?B+_t:Pt+lt)/Gt,r=p?B-_t:(Pt-lt)/Gt,n=K;for(let e=0;e<4;++e){const s=_[e];a(n[e],s,r/B),a(n[e+4],s,t/B)}zt=n}if(q(vt,zt,zt.length))return!1;const Dt=pt.lines,Jt=nt,Kt=et;for(const t of Dt){r(Kt,t.direction);for(const t of Wt){const n=zt[t];if(r(Jt,n),dt(Kt,Jt,zt,qt))return!1;const e=(t+1)%4;if(p){const t=zt[e];if(o(Jt,t,n),r(Jt,Jt),dt(Kt,Jt,zt,qt))return!1}if(d){const n=zt[4+t],s=zt[4+e];if(o(Jt,s,n),r(Jt,Jt),dt(Kt,Jt,zt,qt))return!1}}}return!0}}function v(t,n,e){return c(t,n,e),r(t,t),t}function j(t,n,e){return o(t,n,e),r(t,t),t}function G(t,r){return a(t,t,r/h(t)),t}const B=[0,1,2,3,5];function y(t,r,n){for(let e=0;e<n;++e)if(M(t,r[e])<=0)return!1;return!0}function q(t,r,n){for(const e of B)if(y(t[e],r,n))return!0;return!1}function w(t,r,n=r.length){for(let e=0;e<n;++e){const n=r[e];let s=!0;for(const r of t){if(M(r,n)>0){s=!1;break}}if(s)return!0}return!1}const x=2,I=4;function V(t,r,n){for(const e of r)if(i(e,t)<n)return!1;return!0}const C=[l(),l(),l(),l(),l(),l(),l(),l()],E=[0,0,0,0,0,0],P=[l(),l(),l(),l(),l(),l()],T=l(),Y=l(),k=l(),U=l(),H=l(),L=l(),A=l(),W=l(),z=l(),D=p(0,0,0),J=l(),K=[l(),l(),l(),l(),l(),l(),l(),l()],N=[l(),l(),l(),l(),l()],O=l(),Q=l(),X=l(),Z=l(),$=l(),tt=l(),rt=l(),nt=l(),et=l(),st=l(),ot=[0,1,2,3],it=[0,1,2,3],ut=[0,1,3],ct=[0,1,3],ft=[1,2,3],at=[1,2,3],ht=l();function lt(t,r,n){let e=1/0,s=-1/0;for(const o of n){const t=i(r,o);e=Math.min(e,t),s=Math.max(s,t)}t[0]=e,t[1]=s}function mt(t,r,n,e){let s=1/0,o=-1/0;for(const u of e){const e=i(n,u);if(s=Math.min(s,e),o=Math.max(o,e),s<=r&&o>=t)return!1}return!0}const pt=[0,0];function dt(t,r,n,e){const s=n.length,o=e.length;if(0===s||0===o)return!0;const i=st;v(i,t,r);const u=o<s,c=u?n:e,f=pt;return lt(f,i,u?e:n),mt(f[0],f[1],i,c)}const _t=430,gt=l(),bt=l(),St=l(),Mt=l(),Ft=l(),Rt=Math.cos(.25*Math.PI),vt=m(0,0,1),jt=l();function Gt(t,r,n){const e={t0:0,t1:1};for(const s of B){if(!yt(t[s],r,n,e))return!1}return e.t0<e.t1}function Bt(t,r,n){const e={t0:0,t1:1};for(const s of t){if(!yt(s,r,n,e))return!1}return e.t0<e.t1}function yt(t,r,n,e){let{t0:s,t1:o}=e;const i=M(t,r),u=M(t,n);if(i>=0&&u>=0)return!1;if(i<0&&u>=0){const t=-i/(u-i);if(t<s)return!1;t<o&&(o=t)}else if(i>=0&&u<0){const t=i/(i-u);if(t>o)return!1;t>s&&(s=t)}return e.t0=s,e.t1=o,!0}const qt=[S(-1,0,0,1),S(1,0,0,-1),S(0,-1,0,1),S(0,1,0,-1),S(0,0,-1,1),S(0,0,1,-1)],wt=p(0,0,1),xt=1;export{R as FeatureTileVisibility3D,w as isAnyVertexInPolyhedron,q as isConvexHullOutsideOfFrustum,I as maxLODLevelDelta,x as minTileLOD};
2
+ import{normalize as t,copy as r,set as e,dist as s,sub as i,dot as o,scaleAndAdd as n,scale as u,cross as c,len as f,direction as a,crossAndNormalize as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m,fromValues as l,freeze as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as _}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBuffer as g}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as b}from"../../../../geometry/projection/projectVec3Array.js";import{isAnyVertexInPolyhedron as S,edgeIntersectsPolyhedron as j}from"../../../../geometry/support/convexPolyhedron.js";import{isConvexHullOutsideOfFrustum as v,edgeIntersectsFrustum as F}from"../../../../geometry/support/frustum.js";import{fromValues as R,signedDistance as M}from"../../../../geometry/support/plane.js";import{Frustum as y}from"../../state/Frustum.js";import{sphereIntersectsInfiniteRadialConeConservative as G}from"../../support/ElevationAgnosticVisibility.js";import{correctSphericalTileCornersForLatitude as B,computeSmallestSphericalTileCone as x,getSphericalTilePole as V}from"../../support/sphericalTileUtils.js";class w{constructor(t,r){this._renderCoordsHelper=t,this.opaqueGround=r,this._cache=new Map,this._cameraForward=m(),this._cameraEye=m(),this._cameraFovY=55*Math.PI/180,this._frustumBoundingSphereCenter=m(),this._frustumBoundingSphereRadius=0,this._frustum=new y(t),this._renderSR=t.spatialReference;const e=_(this._renderSR);this._renderSREllipsoidRadius=d(e).radius}setup(e){this._aboveGround=e.aboveGround,this._frustum.update(e),t(this._cameraForward,e.viewForward),r(this._cameraEye,e.eye),this._cameraFovY=e.fovY,this._updateFrustumBoundingSphere()}done(){this._cache.clear()}compute(t){if(this._cache.has(t.id))return this._cache.get(t.id);const r=this._isVisibleInFrustum(t);return this._cache.set(t.id,r),r}_isVisibleInFrustum(t){return 2===this._renderCoordsHelper.viewingMode?this._isTileVisibleInFrustumLocal(t):this._isTileVisibleInFrustumGlobal(t)}_updateFrustumBoundingSphere(){const t=this._frustum.boundingSphere;r(this._frustumBoundingSphereCenter,t.center),this._frustumBoundingSphereRadius=t.radius+bt}_isTileVisibleInFrustumLocal(t){const r=t.spatialReference,u=t.extent,c=this._renderSR;if(!u)return!0;if(P[0]=u[0],P[1]=u[1],P[2]=0,P[3]=u[2],P[4]=u[3],P[5]=0,!g(P,r,0,P,c,0))return!1;e(T[0],P[0],P[1],0),e(T[1],P[3],P[1],0),e(T[2],P[3],P[4],0),e(T[3],P[0],P[4],0),e(Y,.5*(P[0]+P[3]),.5*(P[1]+P[4]),.5*(P[2]+P[5]));const f=dt,a=.5*s(T[0],T[2]),h=this._frustum,m=this._frustumBoundingSphereRadius,l=this._frustumBoundingSphereCenter,p=H;i(p,l,Y);const d=o(f,p),_=A;n(_,Y,f,d);if(s(_,l)>a+m)return!1;const b=this._cameraForward,R=o(b,dt),M=this._cameraFovY,y=this._cameraEye;if(Math.abs(R)<Math.abs(Math.cos(.5*M))){let t=!0;const r=e(_t,b[0],b[1],0),s=o(y,r);for(let e=0;e<4;++e){const i=T[e];if(o(i,r)-s>0){t=!1;break}}if(t)return!1}{const t=T[0],r=T[2];if(t[0]<=y[0]&&y[0]<=r[0]&&t[1]<=y[1]&&y[1]<=r[1])return!0}const G=C,B=this.opaqueGround&&this._aboveGround,x=this.opaqueGround&&!this._aboveGround,V=Math.min(x?ct:1/0,d+m),w=Math.max(B?-ct:-1/0,d-m);for(let e=0;e<4;++e)n(G[e],T[e],f,V),n(G[e+4],T[e],f,w);if(v(h.planes,G,8))return!1;if(S(h.planes,G,8))return!0;for(let e=0;e<4;++e){const t=G[e],r=G[e+4];if(F(h.planes,t,r))return!0;const s=G[(e+1)%4];if(F(h.planes,t,s))return!0;const i=G[4+(e+1)%4];if(F(h.planes,r,i))return!0}if(gt[0][3]=+T[0][0],gt[1][3]=-T[2][0],gt[2][3]=+T[0][1],gt[3][3]=-T[2][1],gt[4][3]=+w,gt[5][3]=-V,S(gt,h.points))return!0;for(let e=0;e<4;++e){const t=y,r=h.points[e+4];if(j(gt,t,r))return!0;const s=h.points[4+(e+1)%4];if(j(gt,r,s))return!0}return!1}_isTileVisibleInFrustumGlobal(r){if(r.level<I)return!0;const n=r.spatialReference,m=r.extent;if(!m||!n)return!0;const l=this.opaqueGround&&this._aboveGround,p=this.opaqueGround&&!this._aboveGround,d=T,_=.5*(m[0]+m[2]);if(e(d[0],m[0],m[1],0),e(d[1],m[2],m[1],0),e(d[2],m[2],m[3],0),e(d[3],m[0],m[3],0),e(d[4],_,m[1],0),e(d[5],_,m[3],0),!b(d,n,0,d,this._renderSR,0,6))return!1;const g=this._renderSREllipsoidRadius;B(d,g);const S=Y,j=this._frustumBoundingSphereRadius,F=this._frustumBoundingSphereCenter,R=this._frustum,y=R.planes,w=U,E=x(d[0],d[1],d[2],d[3],w);u(S,w,g);const C=Math.sqrt(1-E*E),P=R.origin,A=R.points;let H=!1;if(l){H=!0;const r=t(ft,P);for(let e=0;e<4;++e){const s=A[4+e],n=i(ht,s,P);t(n,n);const u=c(mt,r,n);t(u,u);const f=c(lt,n,u);t(f,f);if(o(P,f)>g){H=!1;break}}if(H){if(o(P,w)<g*C-ct)return!1}if(o(r,w)<-E)return!1;{const r=t(at,R.direction);if(o(r,w)>pt)return!1}}if(E>.9)return!0;let Q=!1;const it=o(w,F),ot=f(F);if(ot<=j&&!y.some(t=>M(t,L)>0)){if(!l)return!0;Q=!0}if(!Q&&it<=0){if(-it>j)return!1}if(!Q&&ot>j&&!G(w,E,F,j))return!1;if(!H){if(d.some(t=>R.intersectsPoint(t)))return!0;if(R.intersectsPoint(S))return!0}const nt=W;i(nt,F,L);const dt=o(nt,w),_t=k;u(_t,w,dt);const gt=s(_t,F),bt=V(r.lij,n.isWGS84),St=1===bt||3===bt,jt=2===bt||3===bt,vt=jt?rt:St?$:X,Ft=jt?et:St?tt:Z;if(!Q){const t=d,r=st,e=J,s=K,i=L;for(const n of vt){const c=t[n],f=t[(n+1)%4];if(a(e,f,c),a(s,i,c),h(r,s,e),o(r,w)>0&&u(r,r,-1),q(r,A,1))return!1}}let Rt=null;if(!l&&dt<1.01*j){const t=2.5*j;if(gt>C*t+j)return!1;const r=D,s=t/C;for(let e=0;e<4;++e)u(r[e],d[e],s/g);e(r[4],0,0,0),Rt=r}else{const t=(p?g+ct:dt+j)/C,r=l?g-ct:(dt-j)/C,e=z;for(let s=0;s<4;++s){const i=d[s];u(e[s],i,r/g),u(e[s+4],i,t/g)}Rt=e}if(v(y,Rt,Rt.length))return!1;const Mt=R.lines,yt=N,Gt=O;for(const e of Mt){t(Gt,e.direction);for(const r of Ft){const e=Rt[r];if(t(yt,e),ut(Gt,yt,Rt,A))return!1;const s=(r+1)%4;if(l){const r=Rt[s];if(i(yt,r,e),t(yt,yt),ut(Gt,yt,Rt,A))return!1}if(p){const e=Rt[4+r],o=Rt[4+s];if(i(yt,o,e),t(yt,yt),ut(Gt,yt,Rt,A))return!1}}}return!0}}const I=2,E=4;function q(t,r,e){for(const s of r)if(o(s,t)<e)return!1;return!0}const C=[m(),m(),m(),m(),m(),m(),m(),m()],P=[0,0,0,0,0,0],T=[m(),m(),m(),m(),m(),m()],Y=m(),U=m(),k=m(),A=m(),H=m(),L=p(0,0,0),W=m(),z=[m(),m(),m(),m(),m(),m(),m(),m()],D=[m(),m(),m(),m(),m()],J=m(),K=m(),N=m(),O=m(),Q=m(),X=[0,1,2,3],Z=[0,1,2,3],$=[0,1,3],tt=[0,1,3],rt=[1,2,3],et=[1,2,3],st=m();function it(t,r,e){let s=1/0,i=-1/0;for(const n of e){const t=o(r,n);s=Math.min(s,t),i=Math.max(i,t)}t[0]=s,t[1]=i}function ot(t,r,e,s){let i=1/0,n=-1/0;for(const u of s){const s=o(e,u);if(i=Math.min(i,s),n=Math.max(n,s),i<=r&&n>=t)return!1}return!0}const nt=[0,0];function ut(t,r,e,s){const i=e.length,o=s.length;if(0===i||0===o)return!0;const n=Q;h(n,t,r);const u=o<i,c=u?e:s,f=nt;return it(f,n,u?s:e),ot(f[0],f[1],n,c)}const ct=430,ft=m(),at=m(),ht=m(),mt=m(),lt=m(),pt=Math.cos(.25*Math.PI),dt=l(0,0,1),_t=m(),gt=[R(-1,0,0,1),R(1,0,0,-1),R(0,-1,0,1),R(0,1,0,-1),R(0,0,-1,1),R(0,0,1,-1)],bt=1;export{w as FeatureTileVisibility3D,E as maxLODLevelDelta,I as minTileLOD};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t}from"../../../../core/arrayUtils.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{estimateFixedArrayMemory as a,estimateNumberMemory as s,estimateAttributesMemory as o}from"../../../../core/memoryEstimations.js";import{EsriPromise as n}from"../../../../core/Promise.js";import{initial as l,sync as d,watch as p}from"../../../../core/reactiveUtils.js";import{pt2px as u}from"../../../../core/screenUtils.js";import{property as h,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{projectPointToVector as _}from"../../../../geometry/projection/projectPointToVector.js";import{getContinuousIndexArray as g}from"../../../../geometry/support/Indices.js";import{getResolutionForScale as f}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as F}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as R}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as v}from"../../../../layers/graphics/OptimizedFeature.js";import b from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as w}from"../../../../layers/support/fieldUtils.js";import{generateGradient as S}from"../../../../renderers/support/heatmapUtils.js";import{DisplayFeatureLimit as P}from"../graphics/DisplayFeatureLimit.js";import{GraphicsCorePerformanceInfo as j}from"../graphics/GraphicsCorePerformanceInfo.js";import{FeatureVisibilityFilter as G}from"./FeatureVisibilityFilter.js";import{emptyHighlightHandle as V}from"./highlightUtils.js";import{Attribute as x}from"../../webgl-engine/lib/Attribute.js";import{DrapedHeatmapRenderer as M}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as T}from"../../webgl-engine/lib/Geometry.js";import{GeometryBaseInstance as I}from"../../webgl-engine/lib/GeometryBaseInstance.js";import{RenderGeometry as N}from"../../webgl-engine/lib/RenderGeometry.js";import{HeatmapDensityMaterial as A}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as H,isScaleRangeActive as U}from"../../../support/layerViewUtils.js";import{PixelType as L}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as O,fallBackHeatmapConfiguration as C}from"../../../webgl/heatmapTextureUtils.js";const D=112;let E=class extends n{constructor(e){super(e),this.type="heatmap",this.preferredUpdatePolicy=0,this.dataExtent=null,this.drapeSourceType=1,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=L.HALF_FLOAT,this._pixelFormat=6408,this._baseInstance=new I([]),this._updatingHandles=new y}initialize(){let e;try{e=O(this._renderView.renderingContext,i.getLogger(this))}catch(m){this.addResolvingPromise(Promise.reject(m)),e=C}const{dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o}=e;this._featureStore=new b({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM}),this._dataType=t,this._pixelFormat=s;const n=t!==L.FLOAT,u=this.view.overlayManager,h={...this._rendererParameters,stage:this.view.stage,dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o,rendererContext:u.renderer,drapeSource:this};this._drapeSourceRenderer=new M(h),u.registerDrapeSource(this,this._drapeSourceRenderer),this._material=new A({usesHalfFloats:n}),this._materialWithField=new A({usesHalfFloats:n,isAttributeDriven:!0}),this._filterVisibility=new G({context:{configuration:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this._updatingHandles.addOnCollectionChange(()=>this._loadedPointGraphics,e=>this._onLoadedFeaturesChange(e),l),this._updatingHandles.addWhen(()=>this._materialParameters,e=>this._forEachMaterial(t=>t.setParameters(e)),l),this._updatingHandles.add(()=>this._rendererParameters,e=>this._drapeSourceRenderer.set(e)),this._updatingHandles.add(()=>this._heatmapRendererField,()=>{this._recreate()},d),this._updatingHandles.add(()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric}),({fieldName:e,numeric:t})=>{if(null!=e&&t){let t=0;this._featureStore.forEach(r=>t+=r.attributes[e]??0),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures},l),this.addHandles([p(()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField}),({fieldName:e,field:t})=>{e&&!t&&i.getLogger(this).warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)}),p(()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric}),({field:e,numeric:t})=>{null==e||t||i.getLogger(this).warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)}),r(()=>this.view.overlayManager.unregisterDrapeSource(this))])}destroy(){this._renderGeometries.clear(),this._material=null,this._materialWithField=null,this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy(),this._baseInstance=null}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){const e=this.owner?.view?.quality??1,t=this.owner?.view?.qualitySettings,r=t?Math.ceil(t.graphics3D.maxTotalNumberOfFeatures*e):0;return new P(r*6,r)}get hasZ(){return"hasZ"in this.layer&&!0===this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;const{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:r}=this.view;return!H(r,e??0,t??0)}get usedMemory(){const e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=6403===this._pixelFormat?1:4,r=this._dataType===L.FLOAT?4:2,i=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return i*i*t*r+e+W}get usedMemoryPerFeature(){const e=this._loadedPointGraphics.find(()=>!0);if(null==e)return 0;const t=o(e);return a([0,0],s)+(this._heatmapRendererFieldIsNumeric?s:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return new j(this._renderGeometries.size,this._visibleFeatures,0,0)}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.overlayManager.renderer}get _overlaySpatialReference(){return this.view.overlayManager.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const e=this._heatmapRenderer;if(null==e)return null;const{minDensity:t,maxDensity:r}=e;return{minDensity:t,maxDensity:r,fieldTotal:this._fieldTotal}}get _radiusParameter(){const e=this._heatmapRenderer;return e?{searchRadius:u(this._clampSearchRadius(e.radius))}:null}get _resolutionForScaleParameter(){const e=this._heatmapRenderer;if(!e)return null;const{referenceScale:t}=e;return{resolutionForScale:0===t?0:f(t,this.view.spatialReference)}}get _colorRampParameter(){const e=this._heatmapRenderer;return e?{colorRampData:S(e.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){return this.owner?.view?.qualitySettings.heatmap.pixelRatio??1}get _renderView(){return this.view.stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===e?.type?e:null}get _heatmapRendererFieldName(){return this._heatmapRenderer?.field}get _heatmapRendererField(){const e=this._heatmapRendererFieldName;return null!=e?this.layer.fieldsIndex.get(e):null}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return null!=e&&w(e)}get _isScaleRangeActive(){const{layer:e}=this;if(!("effectiveScaleRange"in e))return!1;const{minScale:t,maxScale:r}=e.effectiveScaleRange;return U(t,r)}get _visibleFeatures(){return this._renderGeometries.values().reduce((e,{visible:t})=>e+(t?1:0),0)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlightByGraphics(){return V}highlightByObjectIds(){return V}maskOccludee(){return r()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:r}=this.layer;this._featureStore.removeManyById(e.removed.map(e=>F(e,r))),this._featureStore.addMany(e.added.map(e=>{const{attributes:t,centroid:i,geometry:a}=e,s=new v(R(a),t,i?R(i):null,F(e,r));return s.displayId=e.uid,s}));const i=e.added,a=e.removed;this._fieldTotal+=this._computeFieldTotalChange(i,a);const s=a.map(({uid:e})=>{const t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t}).filter(t),o=i.map(e=>{const t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t});s.length>0&&this._drapeSourceRenderer.removeGeometries(s,2),o.length>0&&this._drapeSourceRenderer.addGeometries(o,0),(o.length>0||s.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const t=this._heatmapRendererFieldName,r=null!=t?this._materialWithField:this._material,i=c();_(e.geometry,i,this._overlaySpatialReference);const a=g(1),s=[["position",new x([i[0],i[1]],a,2)]],o=this._heatmapRendererFieldIsNumeric;null!=t&&s.push(["featureAttribute",new x([o?e.attributes[t]??0:0],a,1)]);const n=new N(new T(r,s,null,1,void 0,this._baseInstance),{layerViewUid:this.owner.layerViewUid,graphicUid:e.uid});return n.visible=this.filterVisibility.defaultVisibility,n}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(null==this._heatmapRendererFieldName||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;const r=this._heatmapRendererFieldName,i=(e,t)=>e+(t.attributes[r]??0);return e.reduce(i,0)-t.reduce(i,0)}_clampSearchRadius(e){return e>D&&i.getLogger(this).warnOnce(`SceneView supports a maximum radius of ${D} pt for HeatmapRenderer.`),Math.min(e,D)}_updateFeatureVisibilities(e){const t=[];this._featureStore.forEach(({objectId:r,displayId:i})=>{const a=e(r),s=this._renderGeometries.get(i);s&&s.visible!==a&&(t.push(s),s.visible=a)}),this._drapeSourceRenderer.modifyGeometries(t,1)}_setAllFeaturesVisibility(e){const t=[];for(const r of this._renderGeometries.values())r.visible!==e&&(t.push(r),r.visible=e);this._drapeSourceRenderer.modifyGeometries(t,1)}get test(){}};e([h()],E.prototype,"type",void 0),e([h({constructOnly:!0})],E.prototype,"owner",void 0),e([h()],E.prototype,"layer",null),e([h()],E.prototype,"featureStore",null),e([h()],E.prototype,"updating",null),e([h()],E.prototype,"updatingRemaining",null),e([h()],E.prototype,"suspendInfo",null),e([h()],E.prototype,"legendEnabled",null),e([h()],E.prototype,"filterVisibility",null),e([h()],E.prototype,"displayFeatureLimit",null),e([h()],E.prototype,"preferredUpdatePolicy",void 0),e([h()],E.prototype,"hasZ",null),e([h()],E.prototype,"hasM",null),e([h()],E.prototype,"dataExtent",void 0),e([h()],E.prototype,"view",null),e([h()],E.prototype,"fullOpacity",null),e([h()],E.prototype,"updatePolicy",null),e([h()],E.prototype,"drapeSourceType",void 0),e([h()],E.prototype,"scaleVisibilitySuspended",null),e([h()],E.prototype,"renderer",null),e([h()],E.prototype,"_featureStore",void 0),e([h()],E.prototype,"_filterVisibility",void 0),e([h()],E.prototype,"_overlayRenderer",null),e([h()],E.prototype,"_overlaySpatialReference",null),e([h()],E.prototype,"_rendererParameters",null),e([h()],E.prototype,"_materialParameters",null),e([h()],E.prototype,"_densityParameters",null),e([h()],E.prototype,"_radiusParameter",null),e([h()],E.prototype,"_resolutionForScaleParameter",null),e([h()],E.prototype,"_colorRampParameter",null),e([h()],E.prototype,"_pixelRatioParameter",null),e([h()],E.prototype,"_densityMapPixelRatio",null),e([h()],E.prototype,"_renderGeometries",void 0),e([h()],E.prototype,"_material",void 0),e([h()],E.prototype,"_materialWithField",void 0),e([h()],E.prototype,"_renderView",null),e([h()],E.prototype,"_featuresArePoints",null),e([h()],E.prototype,"_loadedPointGraphics",null),e([h()],E.prototype,"_heatmapRenderer",null),e([h()],E.prototype,"_heatmapRendererFieldName",null),e([h()],E.prototype,"_heatmapRendererField",null),e([h()],E.prototype,"_heatmapRendererFieldIsNumeric",null),e([h()],E.prototype,"_fieldTotal",void 0),e([h()],E.prototype,"_drapeSourceRenderer",void 0),e([h()],E.prototype,"_isScaleRangeActive",null),E=e([m("esri.views.3d.layers.support.HeatmapFeatureProcessor")],E);const W=a([0,0,0,0,0,0,0,0],s);export{E as HeatmapFeatureProcessor,D as maxRadiusPt};
2
+ import{__decorate as e}from"tslib";import{isSome as t}from"../../../../core/arrayUtils.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{estimateFixedArrayMemory as a,estimateNumberMemory as s,estimateAttributesMemory as o}from"../../../../core/memoryEstimations.js";import{EsriPromise as n}from"../../../../core/Promise.js";import{initial as l,sync as d,watch as p}from"../../../../core/reactiveUtils.js";import{pt2px as u}from"../../../../core/screenUtils.js";import{property as h,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{projectPointToVector as _}from"../../../../geometry/projection/projectPointToVector.js";import{getContinuousIndexArray as g}from"../../../../geometry/support/Indices.js";import{getResolutionForScale as f}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as F}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as R}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as v}from"../../../../layers/graphics/OptimizedFeature.js";import b from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as w}from"../../../../layers/support/fieldUtils.js";import{generateGradient as S}from"../../../../renderers/support/heatmapUtils.js";import{DisplayFeatureLimit as P}from"../graphics/DisplayFeatureLimit.js";import{GraphicsCorePerformanceInfo as j}from"../graphics/GraphicsCorePerformanceInfo.js";import{FeatureVisibilityFilter as G}from"./FeatureVisibilityFilter.js";import{emptyHighlightHandle as V}from"./highlightUtils.js";import{Attribute as x}from"../../webgl-engine/lib/Attribute.js";import{DrapedHeatmapRenderer as M}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as T}from"../../webgl-engine/lib/Geometry.js";import{GeometryBaseInstance as I}from"../../webgl-engine/lib/GeometryBaseInstance.js";import{RenderGeometry as N}from"../../webgl-engine/lib/RenderGeometry.js";import{HeatmapDensityMaterial as A}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as H,isScaleRangeActive as U}from"../../../support/layerViewUtils.js";import{PixelType as L}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as O,fallBackHeatmapConfiguration as C}from"../../../webgl/heatmapTextureUtils.js";const D=112;let E=class extends n{constructor(e){super(e),this.type="heatmap",this.preferredUpdatePolicy=0,this.dataExtent=null,this.drapeSourceType=1,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=L.HALF_FLOAT,this._pixelFormat=6408,this._baseInstance=new I([]),this._updatingHandles=new y}initialize(){let e;try{e=O(this._renderView.renderingContext,i.getLogger(this))}catch(m){this.addResolvingPromise(Promise.reject(m)),e=C}const{dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o}=e;this._featureStore=new b({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM}),this._dataType=t,this._pixelFormat=s;const n=t!==L.FLOAT,u=this.view.overlayManager,h={...this._rendererParameters,stage:this.view.stage,dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o,rendererContext:u.renderer,drapeSource:this};this._drapeSourceRenderer=new M(h),u.registerDrapeSource(this,this._drapeSourceRenderer),this._material=new A({usesHalfFloats:n}),this._materialWithField=new A({usesHalfFloats:n,isAttributeDriven:!0}),this._filterVisibility=new G({context:{configuration:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this._updatingHandles.addOnCollectionChange(()=>this._loadedPointGraphics,e=>this._onLoadedFeaturesChange(e),l),this._updatingHandles.addWhen(()=>this._materialParameters,e=>this._forEachMaterial(t=>t.setParameters(e)),l),this._updatingHandles.add(()=>this._rendererParameters,e=>this._drapeSourceRenderer.set(e)),this._updatingHandles.add(()=>this._heatmapRendererField,()=>{this._recreate()},d),this._updatingHandles.add(()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric}),({fieldName:e,numeric:t})=>{if(null!=e&&t){let t=0;this._featureStore.forEach(r=>t+=r.attributes[e]??0),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures},l),this.addHandles([p(()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField}),({fieldName:e,field:t})=>{e&&!t&&i.getLogger(this).warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)}),p(()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric}),({field:e,numeric:t})=>{null==e||t||i.getLogger(this).warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)}),r(()=>this.view.overlayManager.unregisterDrapeSource(this))])}destroy(){this._renderGeometries.clear(),this._material=null,this._materialWithField=null,this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy(),this._baseInstance=null}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){const e=this.owner?.view?.quality??1,t=this.owner?.view?.qualitySettings,r=t?Math.ceil(t.graphics3D.maxTotalNumberOfFeatures*e):0;return new P(r*6,r)}get hasZ(){return"hasZ"in this.layer&&!0===this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;const{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:r}=this.view;return!H(r,e??0,t??0)}get usedMemory(){const e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=6403===this._pixelFormat?1:4,r=this._dataType===L.FLOAT?4:2,i=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return i*i*t*r+e+W}get usedMemoryPerFeature(){const e=this._loadedPointGraphics.find(()=>!0);if(null==e)return 0;const t=o(e);return a([0,0],s)+(this._heatmapRendererFieldIsNumeric?s:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return new j(this._renderGeometries.size,this._visibleFeatures,0,0)}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.overlayManager.renderer}get _overlaySpatialReference(){return this.view.overlayManager.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const e=this._heatmapRenderer;if(null==e)return null;const{minDensity:t,maxDensity:r}=e;return{minDensity:t,maxDensity:r,fieldTotal:this._fieldTotal}}get _radiusParameter(){const e=this._heatmapRenderer;return e?{searchRadius:u(this._clampSearchRadius(e.radius))}:null}get _resolutionForScaleParameter(){const e=this._heatmapRenderer;if(!e)return null;const{referenceScale:t}=e;return{resolutionForScale:0===t?0:f(t,this.view.spatialReference)}}get _colorRampParameter(){const e=this._heatmapRenderer;return e?{colorRampData:S(e.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){return this.owner?.view?.qualitySettings.heatmap.pixelRatio??1}get _renderView(){return this.view.stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===e?.type?e:null}get _heatmapRendererFieldName(){return this._heatmapRenderer?.field}get _heatmapRendererField(){const e=this._heatmapRendererFieldName;return null!=e?this.layer.fieldsIndex.get(e):null}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return null!=e&&w(e)}get _isScaleRangeActive(){const{layer:e}=this;if(!("effectiveScaleRange"in e))return!1;const{minScale:t,maxScale:r}=e.effectiveScaleRange;return U(t,r)}get _visibleFeatures(){return this._renderGeometries.values().reduce((e,{visible:t})=>e+(t?1:0),0)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlightByGraphics(){return V}highlightByObjectIds(){return V}maskOccludee(){return r()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:r}=this.layer;this._featureStore.removeManyById(e.removed.map(e=>F(e,r))),this._featureStore.addMany(e.added.map(e=>{const{attributes:t,centroid:i,geometry:a}=e,s=new v(R(a),t,i?R(i):null,F(e,r));return s.displayId=e.uid,s}));const i=e.added,a=e.removed;this._fieldTotal+=this._computeFieldTotalChange(i,a);const s=a.map(({uid:e})=>{const t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t}).filter(t),o=i.map(e=>{const t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t});s.length>0&&this._drapeSourceRenderer.removeGeometries(s,2),o.length>0&&this._drapeSourceRenderer.addGeometries(o,0),(o.length>0||s.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const t=this._heatmapRendererFieldName,r=null!=t?this._materialWithField:this._material,i=c();_(e.geometry,i,this._overlaySpatialReference);const a=g(1),s=[["position",new x([i[0],i[1]],a,2)]],o=this._heatmapRendererFieldIsNumeric;null!=t&&s.push(["featureAttribute",new x([o?e.attributes[t]??0:0],a,1)]);const n=new N(new T(r,s,null,void 0,this._baseInstance),{layerViewUid:this.owner.layerViewUid,graphicUid:e.uid});return n.visible=this.filterVisibility.defaultVisibility,n}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(null==this._heatmapRendererFieldName||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;const r=this._heatmapRendererFieldName,i=(e,t)=>e+(t.attributes[r]??0);return e.reduce(i,0)-t.reduce(i,0)}_clampSearchRadius(e){return e>D&&i.getLogger(this).warnOnce(`SceneView supports a maximum radius of ${D} pt for HeatmapRenderer.`),Math.min(e,D)}_updateFeatureVisibilities(e){const t=[];this._featureStore.forEach(({objectId:r,displayId:i})=>{const a=e(r),s=this._renderGeometries.get(i);s&&s.visible!==a&&(t.push(s),s.visible=a)}),this._drapeSourceRenderer.modifyGeometries(t,1)}_setAllFeaturesVisibility(e){const t=[];for(const r of this._renderGeometries.values())r.visible!==e&&(t.push(r),r.visible=e);this._drapeSourceRenderer.modifyGeometries(t,1)}get test(){}};e([h()],E.prototype,"type",void 0),e([h({constructOnly:!0})],E.prototype,"owner",void 0),e([h()],E.prototype,"layer",null),e([h()],E.prototype,"featureStore",null),e([h()],E.prototype,"updating",null),e([h()],E.prototype,"updatingRemaining",null),e([h()],E.prototype,"suspendInfo",null),e([h()],E.prototype,"legendEnabled",null),e([h()],E.prototype,"filterVisibility",null),e([h()],E.prototype,"displayFeatureLimit",null),e([h()],E.prototype,"preferredUpdatePolicy",void 0),e([h()],E.prototype,"hasZ",null),e([h()],E.prototype,"hasM",null),e([h()],E.prototype,"dataExtent",void 0),e([h()],E.prototype,"view",null),e([h()],E.prototype,"fullOpacity",null),e([h()],E.prototype,"updatePolicy",null),e([h()],E.prototype,"drapeSourceType",void 0),e([h()],E.prototype,"scaleVisibilitySuspended",null),e([h()],E.prototype,"renderer",null),e([h()],E.prototype,"_featureStore",void 0),e([h()],E.prototype,"_filterVisibility",void 0),e([h()],E.prototype,"_overlayRenderer",null),e([h()],E.prototype,"_overlaySpatialReference",null),e([h()],E.prototype,"_rendererParameters",null),e([h()],E.prototype,"_materialParameters",null),e([h()],E.prototype,"_densityParameters",null),e([h()],E.prototype,"_radiusParameter",null),e([h()],E.prototype,"_resolutionForScaleParameter",null),e([h()],E.prototype,"_colorRampParameter",null),e([h()],E.prototype,"_pixelRatioParameter",null),e([h()],E.prototype,"_densityMapPixelRatio",null),e([h()],E.prototype,"_renderGeometries",void 0),e([h()],E.prototype,"_material",void 0),e([h()],E.prototype,"_materialWithField",void 0),e([h()],E.prototype,"_renderView",null),e([h()],E.prototype,"_featuresArePoints",null),e([h()],E.prototype,"_loadedPointGraphics",null),e([h()],E.prototype,"_heatmapRenderer",null),e([h()],E.prototype,"_heatmapRendererFieldName",null),e([h()],E.prototype,"_heatmapRendererField",null),e([h()],E.prototype,"_heatmapRendererFieldIsNumeric",null),e([h()],E.prototype,"_fieldTotal",void 0),e([h()],E.prototype,"_drapeSourceRenderer",void 0),e([h()],E.prototype,"_isScaleRangeActive",null),E=e([m("esri.views.3d.layers.support.HeatmapFeatureProcessor")],E);const W=a([0,0,0,0,0,0,0,0],s);export{E as HeatmapFeatureProcessor,D as maxRadiusPt};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as r,asinClamped as o}from"../../../../core/mathUtils.js";import{createScreenPointArray as i}from"../../../../core/screenUtils.js";import{fromRotation as a,exactEquals as s,rotate as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as u,create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as p}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as h,length as M,dot as g,subtract as d,normalize as y,squaredDistance as b,copy as x,transformMat4 as j,add as v,distance as w,cross as P,scale as I,lerp as z,set as T,crossAndNormalize as S,scaleAndAdd as R}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as q,create as A}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as H,axis as F,fromPoints as U,wrapAxisAngle as E}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as G,vectorCoordinates as k}from"../../../../geometry/support/coordinateSystem.js";import{create as C,fromNormalAndOffset as O,intersectRay as W,projectVector as B,fromPositionAndNormal as D,distance as J,projectPoint as K}from"../../../../geometry/support/plane.js";import{create as L}from"../../../../geometry/support/ray.js";import{Sphere as N}from"../../../../geometry/support/sphere.js";import{sm4d as Q,sv3d as V}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as X,fromScreen as Y}from"../../support/geometryUtils/ray.js";import{intersectScreen as Z}from"../../support/geometryUtils/sphere.js";import $ from"../../webgl/RenderCamera.js";import{Intersector as _}from"../../webgl-engine/lib/Intersector.js";import{terrainId as tt}from"../../webgl-engine/lib/verticalOffsetUtils.js";const et=30,nt=[1,3e8],rt=8,ot=[200,1508e5],it=5,at=50,st=5,ct=10,lt=80,ut=90,mt=1e-6,pt={exclude:new Set([tt])};function ft(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function ht(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function Mt(t,e,n){const r=a(Q.get(),n[3],F(n));null==r||s(r,u)||(d(ke,t.eye,e),j(ke,ke,r),t.eye=v(ke,ke,e),d(ke,t.center,e),j(ke,ke,r),t.center=v(ke,ke,e),t.up=j(ke,t.up,r))}function gt(t,e,n,r){return W(t,Y(e,n,Je),r)}function dt(t,e,n,r){return W(t,X(e,n,Je),r)}function yt(t,e,n,r){const o=V.get();let i=1-n;d(o,e,t.eye);const a=M(o);let s=a*(1-i);i>=0&&s<r&&(s=r,i=-(s-a)/a),Math.abs(a-s)<mt||(I(o,o,i),t.eye=v(ke,t.eye,o),t.center=z(ke,t.center,e,i))}function bt(t,e,n){e.getScreenCenter(xt),Z(t,e,xt,ke)&&(e.center=ke);const r=e.distance,o=r*n;if(Math.abs(r-o)<mt)return;const i=I(V.get(),e.viewForward,o);e.eye=d(ke,e.center,i)}const xt=i();function jt(t,e){T(e,0,0,0);for(const n of t)v(e,e,n);I(e,e,1/t.length)}function vt(t,e,n,r){return Math.sin(t/M(e))*(n+r.radius)}function wt(t,e,n,r){return vt(Math.PI/2,e,n,r)+(t-Math.PI/2)}const Pt={Elevation:3e4,Angle:e(16)},It=e(80);function zt(t,e,n,r,o,i){const a=t.sceneIntersectionHelper,s=new _(t.state.viewingMode);s.options.selectionMode=!0,s.options.store=0,s.options.hud=!1,s.options.normalRequired=!0;let c=null;const l=A(),u=new N;let m=!0,p=!0;const{eye:f}=e;a.intersectIntersectorScreen(n,s,i);const g=s.results.min;return g.getIntersectionPoint(l)&&!h(f,l)&&ve(f,l,r)?(c=q(g.normal),u.radius=M(l)):(p=!1,e.aboveGround&&0!==o?u.radius=Math.max(M(e.center),.9*r):u.radius=M(e.eye)-e.relativeElevation,1===o?qt(u,e,n,l):m=Z(u,e,n,l)),{sphere:u,scenePickPoint:m?l:null,hasGeometryIntersection:p,intersectorType:g.intersector,normal:c}}function Tt(t,e,n,r){const o=t.relativeElevation;if(o>Pt.Elevation&&"global"===r)return 1;X(t,e,Ke);const i=Math.sign(o),a=n.worldUpAtPosition(t.eye,ke);return-i*g(a,Ke.direction)<Math.sin(Pt.Angle)*M(Ke.direction)?0:1}function St(t,e,n){d(Rt,n,e),t.eye=d(ke,t.eye,Rt),t.center=d(ke,t.center,Rt)}const Rt=A();function qt(t,e,n,r){const o=X(e,n,Je);return null!=o&&(t.closestPointOnSilhouette(o,At),t.intersectRay(o,r)?!(b(At,o.origin)<b(r,o.origin))||(x(r,At),!1):(d(Ht,e.eye,e.center),y(Ht,Ht),O(Ht,-g(y(Ht,Ht),At),Ft),W(Ft,o,r),!1))}const At=A(),Ht=A(),Ft=C(),Ut=A(),Et=A(),Gt=i();function kt(t,e){return B(e,t.viewForward,Ut),v(Et,t.eye,Ut),t.projectToScreen(Et,Gt),Gt[1]}const Ct=A(),Ot=C(),Wt=A(),Bt=A(),Dt=A(),Jt=A(),Kt=A(),Lt=A(),Nt=A(),Qt=A(),Vt=A(),Xt=A(),Yt=i(),Zt=L();function $t(t,e,n){const r=t.eye;if(w(e.center,r)<e.radius)return y(Kt,r),P(Lt,Kt,t.viewRight),v(Et,r,Lt),t.projectToScreen(Et,Yt),Yt[1];const o=t.up;X(t,n,Zt);const i=e.radius;if(S(Ct,o,Zt.direction),D(r,Ct,Ot),J(Ot,e.center)>i)return null;K(Ot,e.center,Wt);const a=w(e.center,Wt),s=Math.sqrt(i**2-a**2);d(Bt,r,Wt),y(Dt,Bt),S(Jt,Ct,Dt);const c=g(Bt,Dt),l=g(Bt,Jt),u=Math.sqrt(c**2+l**2),m=s**2/u**2,p=s/u**2*Math.sqrt(u**2-s**2),f=m*c,h=p*-l,M=m*l,b=p*c,x=f-h,j=M+b,z=M-b;v(Nt,Wt,R(Nt,I(Nt,Dt,f+h),Jt,j)),v(Qt,Wt,R(Qt,I(Qt,Dt,x),Jt,z)),d(Vt,Nt,r),y(Vt,Vt),d(Xt,Qt,r),y(Xt,Xt);return g(t.viewForward,Vt)>=g(t.viewForward,Xt)?t.projectToScreen(Nt,Yt):t.projectToScreen(Qt,Yt),Yt[1]}function _t(t,e,n){return e?t>n:t<n}const te=.05,ee=12;function ne(t,e){const n=t.fullHeight/t.pixelRatio,r=Math.max(e,n-e);return Math.max(ee,te*r)}function re(t,e){const n=t.fullHeight/t.pixelRatio;return Math.min(n,e+ne(t,e))}function oe(t,e){return Math.max(0,e-ne(t,e))}function ie(i,a,s,c,l,u){let m=0;if(P(We,i,a),d(Ce,i,a),M(i)<=l||!c.aboveGround){P(s,Ce,c.eye);const p=g(i,a)/(M(i)*M(a));if(p<.9999)m=r(p);else{const t=M(P(A(),i,a))/(M(i)*M(a));m=o(t)}const f=Math.cos(n(t.normalize(e(u)),0,It));m=-m-Math.max(0,M(a)-l)/(f*l)}else d(ae,c.eye,c.center),P(s,Ce,ae),m=-M(Ce)/l;return y(s,s),I(s,s,M(We)),m}const ae=A();function se(o,i,a,s){let c,l;const u=Math.cos(n(t.normalize(e(s)),0,It));return c=i>a?-(i-a)/(u*a):i<-a?Math.PI-(i+a)/(u*a):r(i/a),l=o>a?-(o-a)/(u*a):o<-a?Math.PI-(o+a)/(u*a):r(o/a),(l-c)*a}function ce(t,e,n,r,o,i,a,s,c,l){const u=se(t[2],e[2],i.radius,s),m=c?se(t[0],e[0],i.radius,180):e[0]-t[0],f=Math.sin(a)*m-Math.cos(a)*u,h=Math.cos(a)*m+Math.sin(a)*u;y(ke,o);const M=c?f/Math.sqrt(Math.abs(i.radius**2-g(n,ke)**2)):f/i.radius,d=h/Math.sqrt(Math.abs(i.radius**2-g(n,r)**2));p(l,M,d)}function le(t,e,n,r,o,i,a,s,c,l){P(We,t,e),G(i.up,i.eye,ze,Te,Se),G([0,0,1],i.eye,we,Pe,Ie),x(n,Pe),x(r,we),y(n,n),I(n,n,M(We)),k(t,y(Te,Te),y(Se,Se),y(ze,ze),Re),k(e,Te,Se,ze,qe),ce(Re,qe,t,we,Pe,a,s,c,l,o)}function ue(t,e,n,r,o,i,s){a(Fe,o,r),a(Ue,s,i),l(Ee,Fe,Ue),d(e,t,n),j(e,e,Ee),v(e,e,n)}function me(t,e,n,r,o,i){a(Fe,r,n),a(Ue,i,o),l(Ee,Fe,Ue),d(ke,t.eye,e),j(ke,ke,Ee),t.eye=v(ke,ke,e),d(ke,t.center,e),j(ke,ke,Ee),t.center=v(ke,ke,e),d(ke,t.up,e),j(ke,ke,Ee),t.up=v(ke,ke,e)}const pe={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let fe=!1;function he(t,e,n,r,o,i){const a=Math.abs(r)>Math.PI-pe.Angle||Math.abs(r)<pe.Angle,s=(Math.abs(t[2])<n*pe.Pole||Math.abs(e)>n)&&i;return a&&s?!fe&&o<pe.Tilt-pe.TiltHysteresisMargin?fe=!0:fe&&o>pe.Tilt+pe.TiltHysteresisMargin&&(fe=!1):fe=!1,fe}function Me(t,e,n,r,o,i){if(i)U(n,r,He),Mt(e,t.center,He);else{const i=ie(n,r,Be,e,t.radius,o);Mt(e,t.center,E(Be,i))}}function ge(t,e,n,r,o,i,a){const s=a?20:1,c=1e-12;let l,u;x(Ge,r),Oe.copyFrom(e);for(let m=0;m<s&&b(n,Ge)>c&&(l=b(n,Ge),le(n,Ge,Pe,we,Ae,Oe,t,o,i,a),me(Oe,t.center,we,Ae[1],Pe,Ae[0]),ue(Ge,Ge,t.center,we,Ae[1],Pe,Ae[0]),u=b(n,Ge),u<l||0===m);m++)e.copyFrom(Oe)}function de(n,r,o,i,a,s,c){he(o,g(r.up,o),n.radius,-t.normalize(e(a)),s,r.aboveGround)?ge(n,r,o,i,-t.normalize(e(a)),s,c):Me(n,r,o,i,s,c)}function ye(t,e,n,r,o,i){const{eye:a}=t;G([0,0,1],a,we,Pe,Ie);const s=e.translation[0]*n.pan,l="zoom"===o.mode?0:e.translation[1]*n.pan,u=Math.max(Math.sqrt(Math.abs(1-g(t.center,we)**2/M(t.center)**2)),.5),m=(Math.sin(i)*l+Math.cos(i)*s)/u,p=-Math.cos(i)*l+Math.sin(i)*s;switch(c(r.pan.matrix,r.pan.matrix,m,we),r.pan.enabled=!0,o.mode){case"pan":c(r.pan.matrix,r.pan.matrix,p,Pe),r.pan.enabled=!0;break;case"zoom":r.zoom=-e.translation[1]*n.zoom}}function be(t,e,n,r,o){const{eye:i,viewRight:a}=t,s=P(V.get(),a,i),l=e.translation[0]*n.pan;switch(0!==l&&(c(r.pan.matrix,r.pan.matrix,-l,s),r.pan.enabled=!0),o.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(r.pan.matrix,r.pan.matrix,t,a),r.pan.enabled=!0);break}case"zoom":r.zoom=-e.translation[1]*n.zoom}}function xe(n,r,o,i,a,s,c,l,u){he(n.center,g(n.up,n.center),M(n.center),-t.normalize(e(s)),c,r.aboveGround)?ye(r,o,i,l,u,-t.normalize(e(a))):be(r,o,i,l,u)}function je(t,e,n=1/0){const r=Math.abs(g(t,e));return Math.min(n,1/r)}function ve(t,e,n){const r=w(t,e),o=M(t);return r<Math.max(o,n)}const we=A(),Pe=A(),Ie=A(),ze=A(),Te=A(),Se=A(),Re=A(),qe=A(),Ae=f(),He=H(),Fe=m(),Ue=m(),Ee=m(),Ge=A(),ke=A(),Ce=A();let Oe=new $;const We=A(),Be=A();function De(){Oe=new $}const Je={origin:A(),direction:A()},Ke={origin:A(),direction:A()};export{It as TiltThresholdPanningSpeed,Pt as VerticalPanTresholds,St as applyPanPlanar,Me as applyPanSphericalDirectRotation,ge as applyPanSphericalPreserveHeading,Mt as applyRotation,me as applyRotationWithTwoAxes,bt as applyZoomOnSphere,yt as applyZoomToPoint,jt as centroid,De as cleanupNavigationUtils,oe as computeHorizonDownLimitScreenY,ne as computeHorizonPadding,re as computeHorizonUpLimitScreenY,mt as distanceComparisonTolerance,pt as excludeTerrain,kt as findPlaneHorizonY,$t as findSphereHorizonY,je as getTiltScaleFactor,Tt as inferNavigationMode,gt as intersectPlaneFromScreenPoint,dt as intersectPlaneFromScreenPointAtEye,ve as isHitOnSamePlanetSide,se as lengthFromPoints,it as maxPanDistanceModifier,st as maxRotatePivotDistanceModifier,et as maxZoomPivotDistanceModifier,rt as maxZoomStepDistanceModifier,at as minPinchAndPanCameraHeight,ct as minRotatePivotDistance,ft as normalizeCoordinate,ht as normalizeRotationDelta,wt as offSurfaceTiltToEyeTiltGlobal,vt as onSurfaceTiltToEyeTiltGlobal,xe as panMotionToRotationMatrix,de as panToPosition,zt as pickPointAndInitSphere,lt as pivotSearchAreaSize,pe as preservingHeadingThresholds,te as relativeHorizonPanPadding,ut as rotatePivotSearchAreaSize,ue as rotatePointAroundTwoAxes,ie as rotationAngleAndAxisDirectRotation,le as rotationAnglesAndAxesHeadingPreserving,ce as rotationAnglesHeadingPreserving,_t as shouldClampScreenY,he as shouldPreserveHeading,qt as sphereOrPlanePointFromScreenPoint,nt as zoomPivotDistanceClamp,ot as zoomStepDistanceClamp};
2
+ import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as o,asinClamped as r}from"../../../../core/mathUtils.js";import{createScreenPointArray as i}from"../../../../core/screenUtils.js";import{fromRotation as s,exactEquals as a,rotate as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as m,create as u}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as p}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as h,length as M,dot as g,subtract as y,normalize as d,squaredDistance as b,copy as x,transformMat4 as j,add as v,distance as P,cross as w,scale as I,lerp as z,set as A}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as T,create as R}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as S,axis as U,fromPoints as q,wrapAxisAngle as E}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as G,vectorCoordinates as H}from"../../../../geometry/support/coordinateSystem.js";import{create as k,fromNormalAndOffset as C,intersectRay as F}from"../../../../geometry/support/plane.js";import{Sphere as O}from"../../../../geometry/support/sphere.js";import{sm4d as W,sv3d as B}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as D,fromScreen as J}from"../../support/geometryUtils/ray.js";import{intersectScreen as K}from"../../support/geometryUtils/sphere.js";import L from"../../webgl/RenderCamera.js";import{Intersector as N}from"../../webgl-engine/lib/Intersector.js";import{terrainId as Q}from"../../webgl-engine/lib/verticalOffsetUtils.js";const V=30,X=[1,3e8],Y=8,Z=[200,1508e5],$=5,_=50,tt=5,et=10,nt=80,ot=90,rt=1e-6,it={exclude:new Set([Q])};function st(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function at(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function ct(t,e,n){const o=s(W.get(),n[3],U(n));null==o||a(o,m)||(y(ie,t.eye,e),j(ie,ie,o),t.eye=v(ie,ie,e),y(ie,t.center,e),j(ie,ie,o),t.center=v(ie,ie,e),t.up=j(ie,t.up,o))}function lt(t,e,n,o){return F(t,J(e,n,ue),o)}function mt(t,e,n,o){return F(t,D(e,n,ue),o)}function ut(t,e,n,o){const r=B.get();let i=1-n;y(r,e,t.eye);const s=M(r);let a=s*(1-i);i>=0&&a<o&&(a=o,i=-(a-s)/s),Math.abs(s-a)<rt||(I(r,r,i),t.eye=v(ie,t.eye,r),t.center=z(ie,t.center,e,i))}function pt(t,e,n){e.getScreenCenter(ft),K(t,e,ft,ie)&&(e.center=ie);const o=e.distance,r=o*n;if(Math.abs(o-r)<rt)return;const i=I(B.get(),e.viewForward,r);e.eye=y(ie,e.center,i)}const ft=i();function ht(t,e){A(e,0,0,0);for(const n of t)v(e,e,n);I(e,e,1/t.length)}function Mt(t,e,n,o){return Math.sin(t/M(e))*(n+o.radius)}function gt(t,e,n,o){return Mt(Math.PI/2,e,n,o)+(t-Math.PI/2)}const yt={Elevation:3e4,Angle:e(16)},dt=e(80);function bt(t,e,n,o,r,i){const s=t.sceneIntersectionHelper,a=new N(t.state.viewingMode);a.options.selectionMode=!0,a.options.store=0,a.options.hud=!1,a.options.normalRequired=!0;let c=null;const l=R(),m=new O;let u=!0,p=!0;const{eye:f}=e;s.intersectIntersectorScreen(n,a,i);const g=a.results.min;return g.getIntersectionPoint(l)&&!h(f,l)&&Kt(f,l,o)?(c=T(g.normal),m.radius=M(l)):(p=!1,e.aboveGround&&0!==r?m.radius=Math.max(M(e.center),.9*o):m.radius=M(e.eye)-e.relativeElevation,1===r?Pt(m,e,n,l):u=K(m,e,n,l)),{sphere:m,scenePickPoint:u?l:null,hasGeometryIntersection:p,intersectorType:g.intersector,normal:c}}function xt(t,e,n,o){const r=t.relativeElevation;if(r>yt.Elevation&&"global"===o)return 1;D(t,e,pe);const i=Math.sign(r),s=n.worldUpAtPosition(t.eye,ie);return-i*g(s,pe.direction)<Math.sin(yt.Angle)*M(pe.direction)?0:1}function jt(t,e,n){y(vt,n,e),t.eye=y(ie,t.eye,vt),t.center=y(ie,t.center,vt)}const vt=R();function Pt(t,e,n,o){const r=D(e,n,ue);return null!=r&&(t.closestPointOnSilhouette(r,wt),t.intersectRay(r,o)?!(b(wt,r.origin)<b(o,r.origin))||(x(o,wt),!1):(y(It,e.eye,e.center),d(It,It),C(It,-g(d(It,It),wt),zt),F(zt,r,o),!1))}const wt=R(),It=R(),zt=k();function At(i,s,a,c,l,m){let u=0;if(w(ce,i,s),y(se,i,s),M(i)<=l||!c.aboveGround){w(a,se,c.eye);const p=g(i,s)/(M(i)*M(s));if(p<.9999)u=o(p);else{const t=M(w(R(),i,s))/(M(i)*M(s));u=r(t)}const f=Math.cos(n(t.normalize(e(m)),0,dt));u=-u-Math.max(0,M(s)-l)/(f*l)}else y(Tt,c.eye,c.center),w(a,se,Tt),u=-M(se)/l;return d(a,a),I(a,a,M(ce)),u}const Tt=R();function Rt(r,i,s,a){let c,l;const m=Math.cos(n(t.normalize(e(a)),0,dt));return c=i>s?-(i-s)/(m*s):i<-s?Math.PI-(i+s)/(m*s):o(i/s),l=r>s?-(r-s)/(m*s):r<-s?Math.PI-(r+s)/(m*s):o(r/s),(l-c)*s}function St(t,e,n,o,r,i,s,a,c,l){const m=Rt(t[2],e[2],i.radius,a),u=c?Rt(t[0],e[0],i.radius,180):e[0]-t[0],f=Math.sin(s)*u-Math.cos(s)*m,h=Math.cos(s)*u+Math.sin(s)*m;d(ie,r);const M=c?f/Math.sqrt(Math.abs(i.radius**2-g(n,ie)**2)):f/i.radius,y=h/Math.sqrt(Math.abs(i.radius**2-g(n,o)**2));p(l,M,y)}function Ut(t,e,n,o,r,i,s,a,c,l){w(ce,t,e),G(i.up,i.eye,Vt,Xt,Yt),G([0,0,1],i.eye,Lt,Nt,Qt),x(n,Nt),x(o,Lt),d(n,n),I(n,n,M(ce)),H(t,d(Xt,Xt),d(Yt,Yt),d(Vt,Vt),Zt),H(e,Xt,Yt,Vt,$t),St(Zt,$t,t,Lt,Nt,s,a,c,l,r)}function qt(t,e,n,o,r,i,a){s(ee,r,o),s(ne,a,i),l(oe,ee,ne),y(e,t,n),j(e,e,oe),v(e,e,n)}function Et(t,e,n,o,r,i){s(ee,o,n),s(ne,i,r),l(oe,ee,ne),y(ie,t.eye,e),j(ie,ie,oe),t.eye=v(ie,ie,e),y(ie,t.center,e),j(ie,ie,oe),t.center=v(ie,ie,e),y(ie,t.up,e),j(ie,ie,oe),t.up=v(ie,ie,e)}const Gt={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let Ht=!1;function kt(t,e,n,o,r,i){const s=Math.abs(o)>Math.PI-Gt.Angle||Math.abs(o)<Gt.Angle,a=(Math.abs(t[2])<n*Gt.Pole||Math.abs(e)>n)&&i;return s&&a?!Ht&&r<Gt.Tilt-Gt.TiltHysteresisMargin?Ht=!0:Ht&&r>Gt.Tilt+Gt.TiltHysteresisMargin&&(Ht=!1):Ht=!1,Ht}function Ct(t,e,n,o,r,i){if(i)q(n,o,te),ct(e,t.center,te);else{const i=At(n,o,le,e,t.radius,r);ct(e,t.center,E(le,i))}}function Ft(t,e,n,o,r,i,s){const a=s?20:1,c=1e-12;let l,m;x(re,o),ae.copyFrom(e);for(let u=0;u<a&&b(n,re)>c&&(l=b(n,re),Ut(n,re,Nt,Lt,_t,ae,t,r,i,s),Et(ae,t.center,Lt,_t[1],Nt,_t[0]),qt(re,re,t.center,Lt,_t[1],Nt,_t[0]),m=b(n,re),m<l||0===u);u++)e.copyFrom(ae)}function Ot(n,o,r,i,s,a,c){kt(r,g(o.up,r),n.radius,-t.normalize(e(s)),a,o.aboveGround)?Ft(n,o,r,i,-t.normalize(e(s)),a,c):Ct(n,o,r,i,a,c)}function Wt(t,e,n,o,r,i){const{eye:s}=t;G([0,0,1],s,Lt,Nt,Qt);const a=e.translation[0]*n.pan,l="zoom"===r.mode?0:e.translation[1]*n.pan,m=Math.max(Math.sqrt(Math.abs(1-g(t.center,Lt)**2/M(t.center)**2)),.5),u=(Math.sin(i)*l+Math.cos(i)*a)/m,p=-Math.cos(i)*l+Math.sin(i)*a;switch(c(o.pan.matrix,o.pan.matrix,u,Lt),o.pan.enabled=!0,r.mode){case"pan":c(o.pan.matrix,o.pan.matrix,p,Nt),o.pan.enabled=!0;break;case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Bt(t,e,n,o,r){const{eye:i,viewRight:s}=t,a=w(B.get(),s,i),l=e.translation[0]*n.pan;switch(0!==l&&(c(o.pan.matrix,o.pan.matrix,-l,a),o.pan.enabled=!0),r.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(o.pan.matrix,o.pan.matrix,t,s),o.pan.enabled=!0);break}case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Dt(n,o,r,i,s,a,c,l,m){kt(n.center,g(n.up,n.center),M(n.center),-t.normalize(e(a)),c,o.aboveGround)?Wt(o,r,i,l,m,-t.normalize(e(s))):Bt(o,r,i,l,m)}function Jt(t,e,n=1/0){const o=Math.abs(g(t,e));return Math.min(n,1/o)}function Kt(t,e,n){const o=P(t,e),r=M(t);return o<Math.max(r,n)}const Lt=R(),Nt=R(),Qt=R(),Vt=R(),Xt=R(),Yt=R(),Zt=R(),$t=R(),_t=f(),te=S(),ee=u(),ne=u(),oe=u(),re=R(),ie=R(),se=R();let ae=new L;const ce=R(),le=R();function me(){ae=new L}const ue={origin:R(),direction:R()},pe={origin:R(),direction:R()};export{dt as TiltThresholdPanningSpeed,yt as VerticalPanTresholds,jt as applyPanPlanar,Ct as applyPanSphericalDirectRotation,Ft as applyPanSphericalPreserveHeading,ct as applyRotation,Et as applyRotationWithTwoAxes,pt as applyZoomOnSphere,ut as applyZoomToPoint,ht as centroid,me as cleanupNavigationUtils,rt as distanceComparisonTolerance,it as excludeTerrain,Jt as getTiltScaleFactor,xt as inferNavigationMode,lt as intersectPlaneFromScreenPoint,mt as intersectPlaneFromScreenPointAtEye,Kt as isHitOnSamePlanetSide,Rt as lengthFromPoints,$ as maxPanDistanceModifier,tt as maxRotatePivotDistanceModifier,V as maxZoomPivotDistanceModifier,Y as maxZoomStepDistanceModifier,_ as minPinchAndPanCameraHeight,et as minRotatePivotDistance,st as normalizeCoordinate,at as normalizeRotationDelta,gt as offSurfaceTiltToEyeTiltGlobal,Mt as onSurfaceTiltToEyeTiltGlobal,Dt as panMotionToRotationMatrix,Ot as panToPosition,bt as pickPointAndInitSphere,nt as pivotSearchAreaSize,Gt as preservingHeadingThresholds,ot as rotatePivotSearchAreaSize,qt as rotatePointAroundTwoAxes,At as rotationAngleAndAxisDirectRotation,Ut as rotationAnglesAndAxesHeadingPreserving,St as rotationAnglesHeadingPreserving,kt as shouldPreserveHeading,Pt as sphereOrPlanePointFromScreenPoint,X as zoomPivotDistanceClamp,Z as zoomStepDistanceClamp};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{createScreenPointArray as e}from"../../../../core/screenUtils.js";import{copy as t,distance as n,scaleAndAdd as o,add as r,normalize as i,cross as s,crossAndNormalize as a,subtract as c,dot as u,scale as l,length as m}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../../../geometry/ellipsoidUtils.js";import{create as f,fromPositionAndNormal as h,projectVector as S,distance as g,projectPoint as j}from"../../../../geometry/support/plane.js";import{create as P}from"../../../../geometry/support/ray.js";import{Sphere as w}from"../../../../geometry/support/sphere.js";import{getVoxelWasm as v}from"../../layers/VoxelWasm.js";import{pickPointAndInitSphere as y,sphereOrPlanePointFromScreenPoint as I,intersectPlaneFromScreenPoint as b}from"./navigationUtils.js";import{fromScreenAtEye as z}from"../../support/geometryUtils/ray.js";import{Intersector as M}from"../../webgl-engine/lib/Intersector.js";const k=90,x=1.5,R=x,A=x,T=1e4,F=.1,G=12,q=p(),O=p(),H=e(),N=p(),U=f(),Y=p(),C=p(),D=p(),V=p(),E=p(),L=p(),W=p(),_=p(),B=p(),J=p(),K=e(),Q=P(),X=new w,Z=p(),$=f(),ee=p();function te(e,t){return S(t,e.viewForward,q),r(O,e.eye,q),e.projectToScreen(O,H),H[1]}function ne(e,t,m){const p=e.eye;if(n(t.center,p)<t.radius)return i(E,p),s(L,E,e.viewRight),r(O,p,L),e.projectToScreen(O,K),K[1];const d=e.up;z(e,m,Q);const f=t.radius;if(a(N,d,Q.direction),h(p,N,U),g(U,t.center)>f)return null;j(U,t.center,Y);const S=n(t.center,Y),P=Math.sqrt(f**2-S**2);c(C,p,Y),i(D,C),a(V,N,D);const w=u(C,D),v=u(C,V),y=Math.sqrt(w**2+v**2),I=P**2/y**2,b=P/y**2*Math.sqrt(y**2-P**2),M=I*w,k=b*-v,x=I*v,R=b*w,A=M-k,T=x+R,F=x-R;r(W,Y,o(W,l(W,D,M+k),V,T)),r(_,Y,o(_,l(_,D,A),V,F)),c(B,W,p),i(B,B),c(J,_,p),i(J,J);return u(e.viewForward,B)>=u(e.viewForward,J)?e.projectToScreen(W,K):e.projectToScreen(_,K),K[1]}function oe(e,t,n=!0){return n?e<t:e<=t}function re(e,t,n=!0){return n?e>t:e>=t}function ie(e,t,n){return t?e>n:e<n}function se(e,t){const n=e.fullHeight/e.pixelRatio,o=Math.max(t,n-t);return Math.max(G,F*o)}function ae(e,t){return[ce(e,t),ue(e,t)]}function ce(e,t){const n=e.fullHeight/e.pixelRatio;return Math.min(n,t+se(e,t))}function ue(e,t){return Math.max(0,t-se(e,t))}function le(e,t,n){const o={translation:e,location:t};return n&&(o.normal=n),o}function me(e){const{view:o,originalScreenPoint:r,horizonY:s,horizonPadding:a,outRopeTranslation:c,outGrabLocation:u,outGrabNormal:l,intersectionOptions:m,depthSearchSize:p}=e,f=o.state.camera,h=le(c,u,l);X.radius=d(o.spatialReference).radius;const S=y(o,f,r,X.radius,1,m);if(null==S.scenePickPoint)return!1;const g=S.hasGeometryIntersection;t(Z,S.scenePickPoint),t(h.location,Z);const j=S.sphere;h.normal&&S.normal&&t(h.normal,S.normal);const P=fe(r,s,a,g),w=n(Z,f.eye);if(P.wasAdjusted){Se({view:o,screenAdjustment:P,intersector:he(o),fallbackCheck:(e,t,n)=>{const o=I(j,f,e,t);return o&&n&&i(n,t),o},output:h,intersectionOptions:m})}return je({view:o,screenPoint:P.adjustedScreenPoint,camera:f,initialRopeDistance:w,depthSearchSize:p??k,output:h}),!0}function pe(e){const{view:r,originalScreenPoint:s,horizonY:a,horizonPadding:c,outRopeTranslation:u,outGrabLocation:l,outGrabNormal:m,intersectionOptions:p,depthSearchSize:d}=e,f=r.sceneIntersectionHelper,S=r.state.camera,g=he(r),j=le(u,l,m);f.intersectIntersectorScreen(s,g,p);const P=g.results.min.getIntersectionPoint(Z),w=P?n(Z,S.eye):Number.POSITIVE_INFINITY;P&&(t(j.location,Z),j.normal&&t(j.normal,g.results.min.normal)),r.renderCoordsHelper.worldUpAtPosition(S.eye,E),o(ee,S.eye,E,-S.relativeElevation),h(ee,E,$);const v=fe(s,a,c,P);if(v.wasAdjusted){Se({view:r,screenAdjustment:v,intersector:g,fallbackCheck:(e,t,n)=>{const o=b($,S,e,t);return o&&n&&i(n,E),o},output:j,intersectionOptions:p})}return je({view:r,screenPoint:v.adjustedScreenPoint,camera:S,initialRopeDistance:w,depthSearchSize:d??k,output:j}),!0}function de(e,t,n,o){return!o&&oe(e,t)||o&&ie(e,!1,n[0])?n[0]:!o&&re(e,t,!1)?n[1]:null}function fe(t,n,o,r){const i=de(t[1],n,o,r);return{originalScreenPoint:t,adjustedScreenPoint:e(t[0],i??t[1]),horizonY:n,horizonPadding:o,wasAdjusted:null!==i}}function he(e){const t=new M(e.state.viewingMode);return t.options.selectionMode=!0,t.options.store=0,t.options.hud=!1,t.options.normalRequired=!0,t}function Se(e){const{view:n,screenAdjustment:o,fallbackCheck:r,intersector:i,output:s,intersectionOptions:a}=e,c=n.sceneIntersectionHelper;c.intersectIntersectorScreen(o.adjustedScreenPoint,i,{...a,requiresGroundFeedback:!0});let u=i.results.min.getIntersectionPoint(s.location);if(u)return void(s.normal&&t(s.normal,i.results.min.normal));const l=ge(o);c.intersectIntersectorScreen(l,i,{...a,requiresGroundFeedback:!0}),u=i.results.min.getIntersectionPoint(s.location),u?s.normal&&t(s.normal,i.results.min.normal):(u=r(o.adjustedScreenPoint,s.location,s.normal),u||r(l,s.location,s.normal))}function ge(t){const{originalScreenPoint:n,adjustedScreenPoint:o,horizonY:r,horizonPadding:i}=t,s=re(o[1],r)?Math.min(i[1],n[1]):Math.max(i[0],n[1]);return e(o[0],s)}function je(e){const{view:t,screenPoint:n,camera:o,initialRopeDistance:s,depthSearchSize:a,output:u}=e,p=a>0?t.stage.renderView.getMinimalDepthForArea(v(t),n[0],n[1],o,a):null;c(u.translation,u.location,o.eye);let d=Math.min(m(u.translation),s);p&&p<=d&&(d=p),i(u.translation,u.translation),l(u.translation,u.translation,d),r(u.location,u.translation,o.eye)}export{se as computeHorizonPadding,ae as computeHorizonPaddingLimits,me as findGlobalModeRopePullGrabLocation,pe as findLocalModeRopePullGrabLocation,te as findPlaneHorizonY,ne as findSphereHorizonY,oe as isAboveHorizon,re as isBelowHorizon,T as ropePullMaxElevation,A as ropePullXSpeedMultiplier,R as ropePullYSpeedMultiplier,ie as shouldClampScreenY};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{clamp as t}from"../../../core/mathUtils.js";import{length as r,dot as o}from"../../../core/libs/gl-matrix-2/math/vec3.js";function s(s,i,n,c){const e=r(n);if(e<=c)return!0;const m=o(s,n);if(m<=0)return-m<=c;const a=t(m/e,-1,1),f=Math.sqrt(1-a*a),h=t(c/e,0,1);return f*Math.sqrt(1-h*h)-h*a<=i}export{s as sphereIntersectsInfiniteRadialConeConservative};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as t,dist 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{ONES as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as s}from"../../../../geometry/support/HalfFloatArray.js";import{getZeroIndexArray as l}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as c}from"../../layers/graphics/olidUtils.js";import{Attribute as p}from"../../webgl-engine/lib/Attribute.js";import{Geometry as f}from"../../webgl-engine/lib/Geometry.js";function m(t,e,r=null){const o=[],n=e.mapPositions,i=h(e,o),a=i.data,u=i.indices.length,s=l(u);return g(e,o,s),w(e,o,s),b(e,o,s),y(e,o,i.indices,s),d(e,o,i.indices,s),D(e,o),F(e,o,i.indices,s),j(e,o,a),null!=r&&c(o,r,s),new f(t,o,n,2)}function h(t,e){const{attributeData:{position:r},removeDuplicateStartEnd:o}=t,n=r.length/3,i=n>2&&A(r)&&o,a=n-(i?1:0),u=new Array(2*(a-1)),s=i?r.slice(0,-3):r;let l=0;for(let p=0;p<a-1;p++)u[l++]=p,u[l++]=p+1;const c=new p(s,u,3,i);return e.push(["position",c]),c}function g(t,e,r){if(null!=t.attributeData.colorFeature)return;const n=t.attributeData.color;e.push(["color",new p(n??o,r,4)])}function b(t,e,r){t.attributeData.normal&&e.push(["normal",new p(t.attributeData.normal,r,3)])}function y(t,e,r,o){const n=t.attributeData.colorFeature;null!=n&&("number"==typeof n?e.push(["colorFeatureAttribute",new p([n],o,1,!0)]):e.push(["colorFeatureAttribute",new p(n,r,1,!0)]))}function w(t,e,r){null==t.attributeData.sizeFeature&&e.push(["size",new p([t.attributeData.size??1],r,1,!0)])}function d(t,e,r,o){const n=t.attributeData.sizeFeature;null!=n&&("number"==typeof n?e.push(["sizeFeatureAttribute",new p([n],o,1,!0)]):e.push(["sizeFeatureAttribute",new p(n,r,1,!0)]))}function D(t,e){const{attributeData:{position:r,timeStamps:o}}=t;if(!o)return;const n=r.length/3,i=new Array(2*(n-1));let a=0;for(let u=0;u<n-1;u++)i[a++]=u,i[a++]=u+1;e.push(["timeStamps",new p(o,i,S,!0)])}function F(t,e,r,o){const n=t.attributeData.opacityFeature;null!=n&&("number"==typeof n?e.push(["opacityFeatureAttribute",new p([n],o,1,!0)]):e.push(["opacityFeatureAttribute",new p(n,r,1,!0)]))}function j(r,o,s){if(null==r.overlayInfo||1!==r.overlayInfo.renderCoordsHelper.viewingMode||!r.overlayInfo.spatialReference.isGeographic)return;const l=a(s.length),c=n(r.overlayInfo.spatialReference);for(let t=0;t<l.length;t+=3)i(s,t,l,t,c);const f=s.length/3,m=u(f+1);let h=v,g=z,b=0,y=0;t(h,l[y++],l[y++]),y++,m[0]=0;for(let n=1;n<f+1;++n)n===f&&(y=0),t(g,l[y++],l[y++]),y++,b+=e(h,g),m[n]=b,[h,g]=[g,h];o.push(["distanceToStart",new p(m,o[0][1].indices,1,!0)])}function A(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}const v=r(),z=r(),S=4;function E(t,e,r,o,n){if(null==t||0===t.length)return[];const i=[];return t.forEach((t,u)=>{const s=t.length,l=a(3*s);t.forEach((t,e)=>{l[3*e]=t[0],l[3*e+1]=t[1],l[3*e+2]=t[2]});const c={attributeData:{position:l,normal:e,colorFeature:r?.[u],opacityFeature:o?.[u],sizeFeature:n?.[u]},removeDuplicateStartEnd:!1};i.push(c)}),i}function I(t,e,r,o,n,i){if(null==t||0===t.length)return[];const a=E(t,e,o,n,i);return t.forEach((t,e)=>{const o=r?.[e],n=null!=o?G(o.timeStamps,o.stage):void 0;a[e].attributeData.timeStamps=n}),a}function x(t,e=0,r=.01){const o=s(t.length);o[0]=0;for(let i=1;i<t.length;i++){const e=t[i-1],r=t[i],n=Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2+(r[2]-e[2])**2);o[i]=o[i-1]+n}const n=o.map(t=>t*r);if(0!==e&&e<n.length){const t=n[e];for(let e=0;e<n.length;e++)n[e]-=t}return n}function G(t,e){const r=s(t.length*S),o=t[0],n=t[t.length-1];for(let i=0;i<t.length;i++)r[i*S]=t[i],r[i*S+1]=o,r[i*S+2]=n,r[i*S+3]=e+.5;return r}export{I as animatedLineStripsToParameters,m as createGeometry,x as getLinearTimeStamps,E as lineStripsToParameters,S as numTimeStampValuesPerVertex,G as timeStampsToAttribute};
2
+ import{set as t,dist 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{ONES as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as s}from"../../../../geometry/support/HalfFloatArray.js";import{getZeroIndexArray as l}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as c}from"../../layers/graphics/olidUtils.js";import{Attribute as p}from"../../webgl-engine/lib/Attribute.js";import{Geometry as f}from"../../webgl-engine/lib/Geometry.js";function m(t,e,r=null){const o=[],n=e.mapPositions,i=h(e,o),a=i.data,u=i.indices.length,s=l(u);return g(e,o,s),w(e,o,s),b(e,o,s),y(e,o,i.indices,s),d(e,o,i.indices,s),D(e,o),F(e,o,i.indices,s),j(e,o,a),null!=r&&c(o,r,s),new f(t,o,n)}function h(t,e){const{attributeData:{position:r},removeDuplicateStartEnd:o}=t,n=r.length/3,i=n>2&&A(r)&&o,a=n-(i?1:0),u=new Array(2*(a-1)),s=i?r.slice(0,-3):r;let l=0;for(let p=0;p<a-1;p++)u[l++]=p,u[l++]=p+1;const c=new p(s,u,3,i);return e.push(["position",c]),c}function g(t,e,r){if(null!=t.attributeData.colorFeature)return;const n=t.attributeData.color;e.push(["color",new p(n??o,r,4)])}function b(t,e,r){t.attributeData.normal&&e.push(["normal",new p(t.attributeData.normal,r,3)])}function y(t,e,r,o){const n=t.attributeData.colorFeature;null!=n&&("number"==typeof n?e.push(["colorFeatureAttribute",new p([n],o,1,!0)]):e.push(["colorFeatureAttribute",new p(n,r,1,!0)]))}function w(t,e,r){null==t.attributeData.sizeFeature&&e.push(["size",new p([t.attributeData.size??1],r,1,!0)])}function d(t,e,r,o){const n=t.attributeData.sizeFeature;null!=n&&("number"==typeof n?e.push(["sizeFeatureAttribute",new p([n],o,1,!0)]):e.push(["sizeFeatureAttribute",new p(n,r,1,!0)]))}function D(t,e){const{attributeData:{position:r,timeStamps:o}}=t;if(!o)return;const n=r.length/3,i=new Array(2*(n-1));let a=0;for(let u=0;u<n-1;u++)i[a++]=u,i[a++]=u+1;e.push(["timeStamps",new p(o,i,S,!0)])}function F(t,e,r,o){const n=t.attributeData.opacityFeature;null!=n&&("number"==typeof n?e.push(["opacityFeatureAttribute",new p([n],o,1,!0)]):e.push(["opacityFeatureAttribute",new p(n,r,1,!0)]))}function j(r,o,s){if(null==r.overlayInfo||1!==r.overlayInfo.renderCoordsHelper.viewingMode||!r.overlayInfo.spatialReference.isGeographic)return;const l=a(s.length),c=n(r.overlayInfo.spatialReference);for(let t=0;t<l.length;t+=3)i(s,t,l,t,c);const f=s.length/3,m=u(f+1);let h=v,g=z,b=0,y=0;t(h,l[y++],l[y++]),y++,m[0]=0;for(let n=1;n<f+1;++n)n===f&&(y=0),t(g,l[y++],l[y++]),y++,b+=e(h,g),m[n]=b,[h,g]=[g,h];o.push(["distanceToStart",new p(m,o[0][1].indices,1,!0)])}function A(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}const v=r(),z=r(),S=4;function E(t,e,r,o,n){if(null==t||0===t.length)return[];const i=[];return t.forEach((t,u)=>{const s=t.length,l=a(3*s);t.forEach((t,e)=>{l[3*e]=t[0],l[3*e+1]=t[1],l[3*e+2]=t[2]});const c={attributeData:{position:l,normal:e,colorFeature:r?.[u],opacityFeature:o?.[u],sizeFeature:n?.[u]},removeDuplicateStartEnd:!1};i.push(c)}),i}function I(t,e,r,o,n,i){if(null==t||0===t.length)return[];const a=E(t,e,o,n,i);return t.forEach((t,e)=>{const o=r?.[e],n=null!=o?G(o.timeStamps,o.stage):void 0;a[e].attributeData.timeStamps=n}),a}function x(t,e=0,r=.01){const o=s(t.length);o[0]=0;for(let i=1;i<t.length;i++){const e=t[i-1],r=t[i],n=Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2+(r[2]-e[2])**2);o[i]=o[i-1]+n}const n=o.map(t=>t*r);if(0!==e&&e<n.length){const t=n[e];for(let e=0;e<n.length;e++)n[e]-=t}return n}function G(t,e){const r=s(t.length*S),o=t[0],n=t[t.length-1];for(let i=0;i<t.length;i++)r[i*S]=t[i],r[i*S+1]=o,r[i*S+2]=n,r[i*S+3]=e+.5;return r}export{I as animatedLineStripsToParameters,m as createGeometry,x as getLinearTimeStamps,E as lineStripsToParameters,S as numTimeStampValuesPerVertex,G as timeStampsToAttribute};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{crossAndNormalize as t,cross as o,scaleTo as n,add as c,sub as r,len as s,dot as e,negate as i,normalize as f}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{freeze as m,create as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";function a(t,o){if(!o)return 0;const n=t[2]===2**t[0]-1,c=0===t[2];return n?c?3:1:c?2:0}function l(c,r){const s=c[0][2]>0,e=c[3][2]<0;if(!s&&!e)return;const i=v;t(i,b,c[0]);const f=M;if(t(f,b,c[1]),s){const s=N,e=c[4],m=q;t(m,e,b),t(s,m,e);const u=c[0];o(u,i,s),n(u,r);const a=c[1];o(a,f,s),n(a,r)}else{const s=N,e=c[5],m=q;t(m,e,b),t(s,e,m);const u=c[3];o(u,s,i),n(u,r);const a=c[2];o(a,s,f),n(a,r)}}function x(t,n,m,u,a){c(h,t,n),c(p,m,u),o(g,h,p),r(j,u,t),o(a,g,j),s(a)<=Number.EPSILON&&(c(a,t,n),c(a,a,m),c(a,a,u)),e(a,h)<0&&i(a,a),f(a,a);const l=e(a,t)/s(t);return Math.sqrt(Math.max(0,1-l*l))}const b=m(0,0,1),h=u(),p=u(),g=u(),j=u(),v=u(),M=u(),N=u(),q=u();export{x as computeSmallestSphericalTileCone,l as correctSphericalTileCornersForLatitude,a as getSphericalTilePole};
@@ -40,9 +40,15 @@ cov3D[2], cov3D[4], cov3D[5]
40
40
  mat3 covariance2D = transpose(covarianceProjection) * transpose(covariance3D) * covarianceProjection;
41
41
  return vec3(covariance2D[0][0], covariance2D[0][1], covariance2D[1][1]);
42
42
  }
43
- void computePackedGaussianCovariance3D(uvec4 packedGaussian, out vec3 covarianceA, out vec3 covarianceB) {
44
- vec3 scale = unpackScale(packedGaussian);
43
+ void computePackedGaussianCovariance3D(
44
+ uvec4 packedGaussian,
45
+ out vec3 covarianceA,
46
+ out vec3 covarianceB,
47
+ out vec3 scale,
48
+ out mat3 rotation
49
+ ) {
50
+ scale = unpackScale(packedGaussian);
45
51
  vec4 quaternion = unpackQuaternion(packedGaussian);
46
- mat3 rotation = quaternionToRotationMatrix(quaternion);
52
+ rotation = quaternionToRotationMatrix(quaternion);
47
53
  computeCovariance3D(rotation, scale.xyz, covarianceA, covarianceB);
48
54
  }`)}export{c as GaussianSplatCovariance};
@@ -32,18 +32,15 @@ return normalize(vec2(covariance2D.y, majorEigenvalue - covariance2D.x));
32
32
  vec2 computeGaussianUnitQuadCorner(int vertexID) {
33
33
  return vec2((vertexID << 1) & 2, vertexID & 2) - 1.0;
34
34
  }
35
- vec2 computeGaussianQuadOffset(vec3 covariance2D, vec2 eigenvalues, vec2 axisLengths, int vertexID) {
35
+ vec2 computeGaussianQuadOffset(vec3 covariance2D, vec2 eigenvalues, vec2 axisLengths, vec2 corner) {
36
36
  vec2 majorAxisDirection = computeGaussianMajorAxisDirection(covariance2D, eigenvalues.x);
37
37
  vec2 majorAxis = axisLengths.x * majorAxisDirection;
38
38
  vec2 minorAxis = axisLengths.y * vec2(majorAxisDirection.y, -majorAxisDirection.x);
39
- vec2 corner = computeGaussianUnitQuadCorner(vertexID);
40
39
  return corner.x * majorAxis + corner.y * minorAxis;
41
40
  }
42
- vec3 computeGaussianConic(vec3 covariance2D, float determinant) {
43
- return vec3(covariance2D.z, -covariance2D.y, covariance2D.x) * (1.0 / determinant);
41
+ vec2 computeGaussianCanonicalCoordinates(vec2 corner, vec2 eigenvalues, vec2 axisLengths) {
42
+ return corner * axisLengths * inversesqrt(eigenvalues);
44
43
  }
45
- float evaluateGaussianExponent(vec3 conic, vec2 offsetFromCenter) {
46
- float x = offsetFromCenter.x;
47
- float y = offsetFromCenter.y;
48
- return -0.5 * dot(conic, vec3(x * x, 2.0 * x * y, y * y));
44
+ float evaluateGaussianExponent(vec2 canonicalCoordinates) {
45
+ return -0.5 * dot(canonicalCoordinates, canonicalCoordinates);
49
46
  }`)}export{a as GaussianSplatEvaluation};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{IDENTITY as t,clone as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{getContinuousIndexArray as s}from"../../../../geometry/support/Indices.js";import{cloneAttributeData as n}from"./AttributeArray.js";import{BoundingInfo as o}from"./BoundingInfo.js";import{GeometryBaseInstance as r}from"./GeometryBaseInstance.js";import{computeAttachmentOriginTriangles as h,computeAttachmentOriginLines as a,computeAttachmentOriginPoints as u}from"./geometryDataUtils.js";import{Object3DHighlightStateID as g}from"./Object3DStateID.js";import{createPositionAttributeReader as l}from"./PositionReader.js";import{assert as d}from"./Util.js";import{webglDebugEnabled as c}from"../../../webgl/checkWebGLError.js";class m extends r{constructor(t,i,e=null,s=0,n=-1,o,r){super(i),this.material=t,this.mapPositions=e,this.type=s,this.edgeIndicesLength=n,this.baseGeometry=o,this.drawIndices=r,this._readPrimitivePosition=null,this._vertexPositionIndicesCache=void 0,this._transformation=void 0,this.localOrigin=void 0,this._highlights=null,this._highlightOptionsCounts=null,this.occludees=void 0,this.visible=!0,this._boundingInfo=null,d((t?.useIndexing??!1)===(null!=r),"Material index requirement and Geometry must match"),this.edgeIndicesLength<0&&(this.edgeIndicesLength=this.indexCount)}get readPrimitivePosition(){return this._readPrimitivePosition??=l(this.positionAttribute,this.drawIndices),this._readPrimitivePosition}_invalidateReadPrimitivePosition(){this._readPrimitivePosition=null}instantiate(t={}){const i=new m(t.material||this.material,[],this.mapPositions,this.type,this.edgeIndicesLength,this.baseGeometry,this.drawIndices);return this._attributes.forEach((t,e)=>{t.exclusive=!1,i._attributes.set(e,t)}),i._boundingInfo=this._boundingInfo,i.transformation=t.transformation||this.transformation,i}getMutableAttribute(t){let i=this._attributes.get(t);return i&&!i.exclusive&&(i={...i,exclusive:!0,data:n(i.data)},this._attributes.set(t,i),"position"===t&&this._invalidateReadPrimitivePosition()),i}setAttributeData(t,i){const e=this._attributes.get(t);e?(this._attributes.set(t,{...e,exclusive:!0,data:i}),"position"===t&&this._invalidateReadPrimitivePosition()):c()&&console.warn(`Setting undefined attribute ${t} data`)}get primitivePositionIndices(){return void 0!==this._vertexPositionIndicesCache||(this._vertexPositionIndicesCache=this._computePrimitivePositionIndices()),this._vertexPositionIndicesCache}_computePrimitivePositionIndices(){const{drawIndices:t}=this,i=this.positionAttribute;if(null!=t&&null!=i){const e=new Array;for(const s of t)e.push(i.indices[s]);return e}return i?.indices??null}get positionAttribute(){return this.attributes.get("position")??this.baseGeometry?.attributes.get("position")}get indexCount(){const t=this.drawIndices??this.positionAttribute?.indices;return t?.length??0}get faceCount(){return this.indexCount/3}get boundingInfo(){return this._boundingInfo??=this._calculateBoundingInfo(),this._boundingInfo}computeAttachmentOrigin(t){return!!this._calculateAttachmentOrigin(t)&&(null!=this._transformation&&e(t,t,this._transformation),!0)}_calculateAttachmentOrigin(t){return 0===this.type?this._computeAttachmentOriginTriangles(t):2===this.type?this._computeAttachmentOriginLines(t):this._computeAttachmentOriginPoints(t)}_computeAttachmentOriginTriangles(t){return h(t,this.readPrimitivePosition,this.indexCount/3)}_computeAttachmentOriginLines(t){const{indexCount:i}=this;return a(t,this.readPrimitivePosition,i,_(this.material.parameters,i))}_computeAttachmentOriginPoints(t){return u(t,this.readPrimitivePosition,this.indexCount)}invalidateBoundingInfo(){this._boundingInfo=null,this._vertexPositionIndicesCache=void 0}_calculateBoundingInfo(){const t=this.positionAttribute,i=this.indexCount;if(!t||0===i)return null;const e=0===this.type?3:1;d(i%e===0,"Indexing error: "+i+" not divisible by "+e);const n=s(i/e);return new o(n,e,this.readPrimitivePosition)}get transformation(){return this._transformation??t}set transformation(e){this._transformation=e&&e!==t?i(e):null}get highlights(){return this._highlights||p}get hasHighlights(){return(this._highlightOptionsCounts?.size??0)>0}foreachHighlightOptions(t){this._highlightOptionsCounts?.forEach((i,e)=>t(e))}allocateIdAndHighlight(t){const i=new g(t);return this.addHighlight(i)}addHighlight(t){this._ensureHighlights().add(t);const{highlightName:i}=t,e=(this._highlightOptionsCounts?.get(i)??0)+1;return this._ensureHighlightOptionsCounts().set(i,e),t}_ensureHighlights(){let t=this._highlights;return t||(t=new Set,this._highlights=t),t}_ensureHighlightOptionsCounts(){let t=this._highlightOptionsCounts;return t||(t=new Map,this._highlightOptionsCounts=t),t}removeHighlight(t){if(this._highlights?.delete(t)){const{highlightName:i}=t,e=this._highlightOptionsCounts?.get(i)??0;e<=1?this._highlightOptionsCounts?.delete(i):this._ensureHighlightOptionsCounts().set(i,e-1)}}}function _(t,i){return!(!("isClosed"in t)||!t.isClosed)&&i>2}const p=new Set;export{m as Geometry};
2
+ import{IDENTITY as t,clone as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{getContinuousIndexArray as s}from"../../../../geometry/support/Indices.js";import{cloneAttributeData as n}from"./AttributeArray.js";import{BoundingInfo as o}from"./BoundingInfo.js";import{GeometryBaseInstance as r}from"./GeometryBaseInstance.js";import{computeAttachmentOriginTriangles as h,computeAttachmentOriginLines as a,computeAttachmentOriginPoints as u}from"./geometryDataUtils.js";import{Object3DHighlightStateID as g}from"./Object3DStateID.js";import{createPositionAttributeReader as l}from"./PositionReader.js";import{assert as d}from"./Util.js";import{webglDebugEnabled as m}from"../../../webgl/checkWebGLError.js";class c extends r{constructor(t,i,e=null,s=-1,n,o){super(i),this.material=t,this.mapPositions=e,this.edgeIndicesLength=s,this.baseGeometry=n,this.drawIndices=o,this._readPrimitivePosition=null,this._vertexPositionIndicesCache=void 0,this._transformation=void 0,this.localOrigin=void 0,this._highlights=null,this._highlightOptionsCounts=null,this.occludees=void 0,this.visible=!0,this._boundingInfo=null,d((t?.useIndexing??!1)===(null!=o),"Material index requirement and Geometry must match"),this.edgeIndicesLength<0&&(this.edgeIndicesLength=this.indexCount)}get readPrimitivePosition(){return this._readPrimitivePosition??=l(this.positionAttribute,this.drawIndices),this._readPrimitivePosition}_invalidateReadPrimitivePosition(){this._readPrimitivePosition=null}instantiate(t={}){const i=new c(t.material||this.material,[],this.mapPositions,this.edgeIndicesLength,this.baseGeometry,this.drawIndices);return this._attributes.forEach((t,e)=>{t.exclusive=!1,i._attributes.set(e,t)}),i._boundingInfo=this._boundingInfo,i.transformation=t.transformation||this.transformation,i}getMutableAttribute(t){let i=this._attributes.get(t);return i&&!i.exclusive&&(i={...i,exclusive:!0,data:n(i.data)},this._attributes.set(t,i),"position"===t&&this._invalidateReadPrimitivePosition()),i}setAttributeData(t,i){const e=this._attributes.get(t);e?(this._attributes.set(t,{...e,exclusive:!0,data:i}),"position"===t&&this._invalidateReadPrimitivePosition()):m()&&console.warn(`Setting undefined attribute ${t} data`)}get primitivePositionIndices(){return void 0!==this._vertexPositionIndicesCache||(this._vertexPositionIndicesCache=this._computePrimitivePositionIndices()),this._vertexPositionIndicesCache}_computePrimitivePositionIndices(){const{drawIndices:t}=this,i=this.positionAttribute;if(null!=t&&null!=i){const e=new Array;for(const s of t)e.push(i.indices[s]);return e}return i?.indices??null}get positionAttribute(){return this.attributes.get("position")??this.baseGeometry?.attributes.get("position")}get indexCount(){const t=this.drawIndices??this.positionAttribute?.indices;return t?.length??0}get faceCount(){return this.indexCount/3}get boundingInfo(){return this._boundingInfo??=this._calculateBoundingInfo(),this._boundingInfo}computeAttachmentOrigin(t){return!!this._calculateAttachmentOrigin(t)&&(null!=this._transformation&&e(t,t,this._transformation),!0)}_calculateAttachmentOrigin(t){return 0===this.material.geometryType?this._computeAttachmentOriginTriangles(t):2===this.material.geometryType?this._computeAttachmentOriginLines(t):this._computeAttachmentOriginPoints(t)}_computeAttachmentOriginTriangles(t){return h(t,this.readPrimitivePosition,this.indexCount/3)}_computeAttachmentOriginLines(t){const{indexCount:i}=this;return a(t,this.readPrimitivePosition,i,_(this.material.parameters,i))}_computeAttachmentOriginPoints(t){return u(t,this.readPrimitivePosition,this.indexCount)}invalidateBoundingInfo(){this._boundingInfo=null,this._vertexPositionIndicesCache=void 0}_calculateBoundingInfo(){const t=this.positionAttribute,i=this.indexCount;if(!t||0===i)return null;const e=0===this.material.geometryType?3:1;d(i%e===0,"Indexing error: "+i+" not divisible by "+e);const n=s(i/e);return new o(n,e,this.readPrimitivePosition)}get transformation(){return this._transformation??t}set transformation(e){this._transformation=e&&e!==t?i(e):null}get highlights(){return this._highlights||p}get hasHighlights(){return(this._highlightOptionsCounts?.size??0)>0}foreachHighlightOptions(t){this._highlightOptionsCounts?.forEach((i,e)=>t(e))}allocateIdAndHighlight(t){const i=new g(t);return this.addHighlight(i)}addHighlight(t){this._ensureHighlights().add(t);const{highlightName:i}=t,e=(this._highlightOptionsCounts?.get(i)??0)+1;return this._ensureHighlightOptionsCounts().set(i,e),t}_ensureHighlights(){let t=this._highlights;return t||(t=new Set,this._highlights=t),t}_ensureHighlightOptionsCounts(){let t=this._highlightOptionsCounts;return t||(t=new Map,this._highlightOptionsCounts=t),t}removeHighlight(t){if(this._highlights?.delete(t)){const{highlightName:i}=t,e=this._highlightOptionsCounts?.get(i)??0;e<=1?this._highlightOptionsCounts?.delete(i):this._ensureHighlightOptionsCounts().set(i,e-1)}}}function _(t,i){return!(!("isClosed"in t)||!t.isClosed)&&i>2}const p=new Set;export{c as Geometry};