@arcgis/core 5.2.0-next.119 → 5.2.0-next.120

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 (114) hide show
  1. package/arcade/ArcadeDate.js +1 -1
  2. package/arcgisGlobal.d.ts +1 -0
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/090c9c2dbf92f2cac0b8.js +1 -0
  5. package/assets/esri/core/workers/chunks/2cf571d968118b6bdde0.js +1 -0
  6. package/assets/esri/core/workers/chunks/{be4de7111bc21bc69de1.js → 2e999b05ce179dd9fa08.js} +1 -1
  7. package/assets/esri/core/workers/chunks/39985c51465b79ff0910.js +1 -0
  8. package/assets/esri/core/workers/chunks/4165eb86471ea3bbf364.js +1 -0
  9. package/assets/esri/core/workers/chunks/{731ec5de16753e10b963.js → 46388b86d1b10e6121bd.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{bdcca906fdfb8e179abb.js → 4efe5827a5c61db3b19d.js} +2 -2
  11. package/assets/esri/core/workers/chunks/50ae209237f104735a30.js +1 -0
  12. package/assets/esri/core/workers/chunks/519ed8e6edd0f0014686.js +1 -0
  13. package/assets/esri/core/workers/chunks/{3c3e5e952fd6740bb234.js → 54f9062526c2002b7fd7.js} +1 -1
  14. package/assets/esri/core/workers/chunks/56b7ac280bf0be938c14.js +1 -0
  15. package/assets/esri/core/workers/chunks/61bcbafd676804ce3e1d.js +1 -0
  16. package/assets/esri/core/workers/chunks/66ef6c034455abd61f39.js +1 -0
  17. package/assets/esri/core/workers/chunks/75410a4de76e67ed5da4.js +1 -0
  18. package/assets/esri/core/workers/chunks/85780f4fa4b5509f864e.js +1 -0
  19. package/assets/esri/core/workers/chunks/87aaed3dfa903bdf853c.js +1 -0
  20. package/assets/esri/core/workers/chunks/892dc038d569cffd26dc.js +1 -0
  21. package/assets/esri/core/workers/chunks/8ce14dd209462f88b163.js +1 -0
  22. package/assets/esri/core/workers/chunks/ab3d19c77e81fe3a099d.js +1 -0
  23. package/assets/esri/core/workers/chunks/bdf0b4653ee455e72f04.js +1 -0
  24. package/assets/esri/core/workers/chunks/c118b88a7c4359e68d9b.js +1 -0
  25. package/assets/esri/core/workers/chunks/cbeba973ef5593ffbba3.js +1 -0
  26. package/assets/esri/core/workers/chunks/ceda1e08c9ff26248db0.js +1 -0
  27. package/assets/esri/core/workers/chunks/{06e7411c5bed0a414031.js → d6130cd8a20d24dd9d3c.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{49c6dc487714f9cd55c7.js → ddb5d29a8998d0a76fd4.js} +1 -1
  29. package/assets/esri/core/workers/chunks/e9f8325a4cf89ae816cc.js +1 -0
  30. package/assets/esri/core/workers/chunks/f2fca9a3a40170996ea2.js +1 -0
  31. package/assets/esri/core/workers/chunks/f5d06cd6d30a5f742f73.js +1 -0
  32. package/assets/esri/core/workers/chunks/f75e57d3e02f9828b049.js +1 -0
  33. package/chunks/ColorMaterial.glsl.js +8 -8
  34. package/chunks/GaussianSplat.glsl.js +13 -8
  35. package/chunks/GaussianSplatShadow.glsl.js +33 -4
  36. package/chunks/languageUtils.js +1 -1
  37. package/config.js +1 -1
  38. package/core/has.js +1 -1
  39. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  40. package/kernel.js +1 -1
  41. package/layers/support/NumericRange.d.ts +41 -0
  42. package/layers/support/fieldUtils.d.ts +9 -0
  43. package/linkChart/LinkChartProperties.js +1 -1
  44. package/package.json +4 -4
  45. package/support/revision.js +1 -1
  46. package/time/ianaZone.js +2 -0
  47. package/time/timeZoneUtils.js +1 -1
  48. package/views/3d/analysis/LineOfSight/LineOfSightAuthoringUtils.js +1 -1
  49. package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
  50. package/views/3d/analysis/LineOfSight/LineOfSightObserverPlugin.js +1 -1
  51. package/views/3d/analysis/LineOfSight/LineOfSightRootPlugin.js +1 -1
  52. package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +1 -1
  53. package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
  54. package/views/3d/analysis/LineOfSight/types.d.ts +1 -0
  55. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementVisualization.js +1 -1
  56. package/views/3d/focusAreaUtils.js +1 -1
  57. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  58. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  59. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  60. package/views/3d/layers/graphics/extrudePolygon.js +2 -0
  61. package/views/3d/navigation/Navigation3D.js +1 -1
  62. package/views/3d/state/utils/groundNavigationUtils.js +1 -1
  63. package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
  64. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  65. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  66. package/views/3d/webgl-engine/lib/EmissionComposite.js +1 -1
  67. package/views/3d/webgl-engine/lib/GaussianSplatDepthRenderer.js +1 -1
  68. package/views/3d/webgl-engine/lib/GaussianSplatPrepassDepthRenderer.js +2 -0
  69. package/views/3d/webgl-engine/lib/GaussianSplatRenderUtils.js +1 -1
  70. package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
  71. package/views/3d/webgl-engine/lib/GaussianSplatShadows.js +1 -1
  72. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  73. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  74. package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
  75. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  76. package/views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js +38 -27
  77. package/views/3d/webgl-engine/shaders/GaussianSplatShadow.glsl.js +1 -1
  78. package/views/SceneView.d.ts +1 -1
  79. package/views/SceneView.js +1 -1
  80. package/views/draw/plugins/PolygonPlugin.js +1 -1
  81. package/webmap/utils.js +1 -1
  82. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  83. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +43 -2
  84. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  85. package/widgets/BatchAttributeForm/inputs/support/inputUtils.d.ts +11 -0
  86. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  87. package/widgets/BatchAttributeForm/inputs/types.d.ts +8 -0
  88. package/widgets/OrientedImageryViewer.js +1 -1
  89. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  90. package/assets/esri/core/workers/chunks/2c21f4744e19b925a6ae.js +0 -1
  91. package/assets/esri/core/workers/chunks/2c9783e3b44986e86797.js +0 -1
  92. package/assets/esri/core/workers/chunks/45858d1c6487f4a98e40.js +0 -1
  93. package/assets/esri/core/workers/chunks/497c5a9c95e9a89ac217.js +0 -1
  94. package/assets/esri/core/workers/chunks/515fe302743c0b46f7e0.js +0 -1
  95. package/assets/esri/core/workers/chunks/54f3bc940cea15fce2c7.js +0 -1
  96. package/assets/esri/core/workers/chunks/5f79ba5639067f734791.js +0 -1
  97. package/assets/esri/core/workers/chunks/61ea3493b477ddc442e6.js +0 -1
  98. package/assets/esri/core/workers/chunks/6b9d29ca568590358478.js +0 -1
  99. package/assets/esri/core/workers/chunks/7243d5721bb6a7329055.js +0 -1
  100. package/assets/esri/core/workers/chunks/7adff63fd66fab505ae6.js +0 -1
  101. package/assets/esri/core/workers/chunks/84b89c523d3e16a5ee46.js +0 -1
  102. package/assets/esri/core/workers/chunks/85c876ee9e63d5732937.js +0 -1
  103. package/assets/esri/core/workers/chunks/8cc95d827f460909d442.js +0 -1
  104. package/assets/esri/core/workers/chunks/97fea852f8e93e1286e4.js +0 -1
  105. package/assets/esri/core/workers/chunks/a5466c864c3ead9aac5a.js +0 -1
  106. package/assets/esri/core/workers/chunks/a774006be107e449bc29.js +0 -1
  107. package/assets/esri/core/workers/chunks/bb56ab53c5a10c9518a6.js +0 -1
  108. package/assets/esri/core/workers/chunks/d5defba320f2e49a377f.js +0 -1
  109. package/assets/esri/core/workers/chunks/e5f0c47957a4e9663720.js +0 -1
  110. package/assets/esri/core/workers/chunks/ebe7ba2557b50e18e547.js +0 -1
  111. package/assets/esri/core/workers/chunks/edd36e98355f1655e5c8.js +0 -1
  112. package/assets/esri/core/workers/chunks/f66e597e524b26e61cd3.js +0 -1
  113. package/views/3d/layers/graphics/extrudeUtils.js +0 -2
  114. /package/assets/esri/core/workers/chunks/{bdcca906fdfb8e179abb.js.LICENSE.txt → 4efe5827a5c61db3b19d.js.LICENSE.txt} +0 -0
@@ -26,6 +26,7 @@ export interface LineOfSightPlacementOptions extends AbortOptions {
26
26
  /**
27
27
  * Specifies how placed items are positioned on the vertical axis (z). A single elevation information object applies
28
28
  * to both the observer and targets. Alternatively, separate elevation information can be provided for each.
29
+ * When omitted, positions are stored with absolute heights.
29
30
  *
30
31
  * @since 5.2
31
32
  */
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{onLocaleChange as t,substitute as i,fetchMessageBundle as s}from"../../../../intl.js";import{volumeMeasurementConfiguration as o}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import n from"../../../../core/Accessor.js";import{equals as r}from"../../../../core/arrayUtils.js";import{cyclicalPI as l}from"../../../../core/Cyclical.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import{isPromiseLike as c}from"../../../../core/promiseUtils.js";import{preferredVolumePrecision as u,formatDecimal as d}from"../../../../core/quantityFormatUtils.js";import{initial as m}from"../../../../core/reactiveUtils.js";import{adaptiveVolumeUnit as h}from"../../../../core/units.js";import{property as p,subclass as g}from"../../../../core/accessorSupport/decorators.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as _,normalize as y,subtract as f,cross as j,dot as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as L,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as C}from"../../../../core/support/UpdatingHandles.js";import{computeTranslationToOriginAndRotation as G}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{angleAroundAxis as P}from"../../../../geometry/support/vector.js";import{t as V}from"../../../../chunks/vec3.js";import x from"../../../../symbols/support/ElevationInfo.js";import{LabelVisualElement as O}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as R}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as D}from"../../interactive/visualElements/OutlineVisualElement.js";import{EuclideanSegment as M}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as A}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as H}from"../../layers/graphics/extrudeUtils.js";import{polygonToRenderInfoElevationAligned as U}from"../../support/renderInfoUtils/polygon.js";import{CutFill as F,VolumeGeometry as E}from"../../webgl-engine/lib/CutFill.js";import{createStipplePatternSimple as S}from"../../webgl-engine/materials/lineStippleUtils.js";let z=class extends n{get visible(){return this.viewData.visible&&null!=this.viewData.elevationAlignedGeometry&&null!=this.viewData.targetGeometry}get inView(){return this.viewData.analysisObb?.intersectsFrustum(this.view.frustum)??!1}get updating(){return this.loadingMessages||this._updatingHandles.updating}get hasUnsupportedError(){const{error:e}=this.viewData;return!!e&&["unsupported-coordinate-system","unsupported-layer-transparency"].includes(e.name)}get _extrusionHeights(){const{renderCoordsHelper:e}=this.view,{depthExtremaPositions:t,targetGeometry:i}=this.viewData,{targetElevationRange:s}=o;if(!i||!t)return{cut:s,fill:-s};let n=-1/0;for(const o of i.rings)for(const e of o)n=Math.max(n,e[2]);const r=1,l=e.getAltitude(t.fill);return{cut:s,fill:Math.min(l-n,0)-r}}constructor(e){super(e),this.unitsMessages=null,this.messages=null,this.loadingMessages=!0,this._updatingHandles=new C,this._elevationContext=A.fromElevationInfo(new x({mode:"absolute-height"})),this._projectionLines=[]}initialize(){const{view:e}=this,i={view:e,isDecoration:!0},s=o,n={...i,width:s.geometryOutlineWidth};this._elevationAlignedGeometry=new D({...n,isDraped:!0,color:s.geometryOutlineColor.toUnitRGBA()}),this._targetGeometry=new D(n);const r={...i,attached:!0,width:s.projectionLineWidth,renderOccluded:4,polygonOffset:3},l={...r,stipplePattern:S(s.projectionLineStippleSize)},a=s.cutProjectionLineColor.toUnitRGBA(),c=s.fillProjectionLineColor.toUnitRGBA();this._cutProjectionLines=new R({...r,color:a}),this._occludedCutProjectionLines=new R({...l,color:a}),this._fillProjectionLines=new R({...r,color:c,renderOccluded:8}),this._occludedFillProjectionLines=new R({...l,color:c});const u={...i,attached:!0};this._cutVolumeLabel=new O({...u,distance:s.labelDistance}),this._fillVolumeLabel=new O({...u,distance:-s.labelDistance}),this._visualization=new F({view:e,cutColor:s.cutColor,fillColor:s.fillColor,borderColor:s.geometryOutlineColor}),this.addHandles([this._updatingHandles.add(()=>({elevationAlignedGeometry:this.viewData.elevationAlignedGeometry,targetGeometry:this.viewData.targetGeometry}),({elevationAlignedGeometry:e,targetGeometry:t})=>{this._elevationAlignedGeometry.geometry=e,this._targetGeometry.geometry=t},m),this._updatingHandles.add(()=>({interactive:this.viewData.interactive,measureType:this.analysis.measureType,visible:this.visible}),({visible:e,interactive:t,measureType:i})=>{this._elevationAlignedGeometry.visible=e&&!t,this._targetGeometry.visible=e&&"cut-fill"===i,this._visualization.measureType=i},m),this._updatingHandles.add(()=>({elevationAlignedGeometry:this.viewData.elevationAlignedGeometry,targetGeometry:this.viewData.targetGeometry,visible:this.visible}),({elevationAlignedGeometry:e,targetGeometry:t,visible:i})=>this._updateProjectionLines(e,t,i),m),this._updatingHandles.add(()=>({interactive:this.viewData.interactive,accentColor:this.view.effectiveTheme.accentColor,hasResult:!!this.viewData.result}),({interactive:e,accentColor:t,hasResult:i})=>{this._updateColors(e,t,i)},m),this._updatingHandles.add(()=>[this.viewData.targetGeometry,this.inView,this._extrusionHeights,this._polygonRenderInfo],()=>this._updateCutFillGeometry(),m),this._updatingHandles.add(()=>this.visible&&this.inView&&this.view.state.camera.aboveGround&&!this.hasUnsupportedError,e=>this._updateCutFillVisibility(e),m),this._updatingHandles.add(()=>{const{messages:e,unitsMessages:t,visible:i,viewData:s}=this;return{depthExtremaPositions:s.depthExtremaPositions,effectiveDisplayUnits:s.effectiveDisplayUnits,messages:e,unitsMessages:t,result:s.result,visible:i&&!!s.result}},e=>this._updateLabels(e)),this._updatingHandles.add(()=>this.view.state.camera,e=>this._updateProjectionLineOcclusion(e),m),t(()=>this._updateMessageBundle())]),this._updateMessageBundle()}destroy(){this._elevationAlignedGeometry=a(this._elevationAlignedGeometry),this._targetGeometry=a(this._targetGeometry),this._cutProjectionLines=a(this._cutProjectionLines),this._occludedCutProjectionLines=a(this._occludedCutProjectionLines),this._fillProjectionLines=a(this._fillProjectionLines),this._occludedFillProjectionLines=a(this._occludedFillProjectionLines),this._cutVolumeLabel=a(this._cutVolumeLabel),this._fillVolumeLabel=a(this._fillVolumeLabel),this._visualization.destroy(),this._updatingHandles.destroy()}_updateProjectionLines(e,t,i){if(this._cutProjectionLines.visible=i,this._occludedCutProjectionLines.visible=i,this._fillProjectionLines.visible=i,this._occludedFillProjectionLines.visible=i,!e||!t)return;const{renderCoordsHelper:s}=this.view,o=[],n=[],l=[],a=[],c=[],u=e.spatialReference;for(let d=0;d<e.rings.length;d++){const i=e.rings[d],m=i.length>1&&r(i[0],i[i.length-1]),h=i.length-(m?1:0),p=[];for(let e=0;e<h;++e){const o=i[e],n=_(L(),o[0],o[1],o[2]);s.toRenderCoords(n,u,n);const r=t.rings[d][e],l=_(L(),r[0],r[1],r[2]);s.toRenderCoords(l,u,l);const a=new M(n,l);p.push(a)}const g=this.view.state.camera;for(let e=0;e<p.length;++e){const s=p[e],r=p[0===e?p.length-1:e-1],u=p[e===p.length-1?0:e+1],m=i[e],h=t.rings[d][e],v=m[2]>h[2],_=new I(s,r,u,v);o.push(_),_.updateOccluded(g);const y=_.isOccluded;v?(y?l:n).push(s):(y?c:a).push(s)}}this._projectionLines=o,this._cutProjectionLines.setGeometryFromSegments(n),this._occludedCutProjectionLines.setGeometryFromSegments(l),this._fillProjectionLines.setGeometryFromSegments(a),this._occludedFillProjectionLines.setGeometryFromSegments(c)}_updateProjectionLineOcclusion(e){const t=[],i=[],s=[],o=[];let n=!1,r=!1;for(const l of this._projectionLines){l.updateOccluded(e)&&(n||=l.isCut,r||=!l.isCut);const a=l.isOccluded;(l.isCut?a?i:t:a?o:s).push(l.segment)}r&&(this._fillProjectionLines.setGeometryFromSegments(s),this._occludedFillProjectionLines.setGeometryFromSegments(o)),n&&(this._cutProjectionLines.setGeometryFromSegments(t),this._occludedCutProjectionLines.setGeometryFromSegments(i))}_updateColors(e,t,i){const{geometryOutlineColor:s,cutColor:n,fillColor:r,cutColorMuted:l,fillColorMuted:a,cutProjectionLineColor:c,fillProjectionLineColor:u}=o;if(this._visualization.cutColor=i?n:l,this._visualization.fillColor=i?r:a,e){const e=t.toUnitRGBA();this._targetGeometry.color=e,this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e,this._fillProjectionLines.color=e,this._occludedFillProjectionLines.color=e,this._visualization.borderColor=t}else{this._targetGeometry.color=s.toUnitRGBA();const e=(i?c:l).toUnitRGBA();this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e;const t=(i?u:a).toUnitRGBA();this._fillProjectionLines.color=t,this._occludedFillProjectionLines.color=t,this._visualization.borderColor=s}}_updateLabels(e){const{effectiveDisplayUnits:t,depthExtremaPositions:s,messages:o,unitsMessages:n,result:r,visible:l}=e;if(this._cutVolumeLabel.visible=l,this._fillVolumeLabel.visible=l,this._cutVolumeLabel.geometry=s?{type:"point",point:s.cut}:null,this._fillVolumeLabel.geometry=s?{type:"point",point:s.fill}:null,null==r||null==o||null==n)return this._cutVolumeLabel.text="-",void(this._fillVolumeLabel.text="-");const a=t.volume,c=i(o.labels.cut,{volume:B(n,r.cutVolume,a)}),u=i(o.labels.fill,{volume:B(n,r.fillVolume,a)});this._cutVolumeLabel.text=c,this._fillVolumeLabel.text=u}_updateCutFillVisibility(e){e?this._visualization.enable():this._visualization.disable()}get _polygonRenderInfo(){const{renderCoordsHelper:e,elevationProvider:t}=this.view,{targetGeometry:i}=this.viewData;if(null==i)return null;const s=U(i,t,e,this._elevationContext,{outlineOutput:"tessellated-indices"});return c(s)?(this._updatingHandles.consumePromise(s),null):s}_updateCutFillGeometry(){const{view:e,viewData:t,inView:i}=this,{renderCoordsHelper:s}=e,{targetGeometry:o}=t,{cut:n,fill:r}=this._extrusionHeights;if(!o?.extent||!i)return;const{center:l}=o.extent,a=w(l.x,l.y,0),c=L();s.toRenderCoords(a,o.spatialReference,c);const u=this._getExtrudedVolume(n,a,c),d=this._getExtrudedVolume(r,a,c);null!=u&&null!=d&&this._visualization.updateGeometries(u,d,c)}_getExtrudedVolume(e,t,i){const{renderCoordsHelper:s,spatialReference:o}=this.view,n=L(),r=1===s.viewingMode;s.worldUpAtPosition(i,n);const{_polygonRenderInfo:l}=this;if(null==l)return null;const a=H(l,{height:e,worldUp:n,spherical:r,requireElevation:!1,requireNormals:!0,requireSizes:!1});if(null==a)return null;const c=v(),u=v();if(G(o,t,c,s.spatialReference),u[12]=-c[12],u[13]=-c[13],u[14]=-c[14],V(a.vertices,a.vertices,u),"stockpile"===this.analysis.measureType)for(let d=0;d<a.normals.length;d+=3)a.normals[d]=n[0],a.normals[d+1]=n[1],a.normals[d+2]=n[2];return new E(a.vertices,a.bottomIndices,a.indices,a.normals)}async _updateMessageBundle(){this.loadingMessages=!0;try{this.unitsMessages=await s("esri/core/t9n/Units"),this.messages=await s("esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis")}finally{this.loadingMessages=!1}}};function B(e,t,i){if(!t||!e)return null;const s=h(t.value,t.unit,i),o=u(s);return d(e,t,s,o)}e([p({constructOnly:!0})],z.prototype,"view",void 0),e([p({constructOnly:!0})],z.prototype,"analysis",void 0),e([p({constructOnly:!0})],z.prototype,"viewData",void 0),e([p()],z.prototype,"unitsMessages",void 0),e([p()],z.prototype,"messages",void 0),e([p()],z.prototype,"loadingMessages",void 0),e([p({readOnly:!0})],z.prototype,"_updatingHandles",void 0),e([p({readOnly:!0})],z.prototype,"visible",null),e([p()],z.prototype,"inView",null),e([p()],z.prototype,"updating",null),e([p()],z.prototype,"hasUnsupportedError",null),e([p()],z.prototype,"_extrusionHeights",null),e([p()],z.prototype,"_polygonRenderInfo",null),z=e([g("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementVisualization")],z);class I{constructor(e,t,i,s){this.segment=e,this.previous=t,this.next=i,this.isCut=s,this._isOccluded=!1,this._n1=L(),this._n2=L();const o=y(T,f(T,e.endRenderSpace,e.startRenderSpace));y(this._n1,j(this._n1,o,y(q,f(q,t.startRenderSpace,e.startRenderSpace)))),y(this._n2,j(this._n2,o,y(q,f(q,e.startRenderSpace,i.startRenderSpace)))),this._isConvex=l.normalize(P(this._n1,this._n2,o))<0}get isOccluded(){return this._isOccluded}updateOccluded(e){f(T,this.segment.startRenderSpace,e.eye);const t=b(this._n1,T)<0,i=b(this._n2,T)<0,s=this._isOccluded;return this._isOccluded=this._isConvex?t&&i:t||i,this._isOccluded!==s}}const T=L(),q=L();export{z as VolumeMeasurementVisualization};
2
+ import{__decorate as e}from"tslib";import{onLocaleChange as t,substitute as i,fetchMessageBundle as s}from"../../../../intl.js";import{volumeMeasurementConfiguration as o}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import{equals as n}from"../../../../core/arrayUtils.js";import{cyclicalPI as l}from"../../../../core/Cyclical.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import{isPromiseLike as c}from"../../../../core/promiseUtils.js";import{preferredVolumePrecision as u,formatDecimal as d}from"../../../../core/quantityFormatUtils.js";import{initial as m}from"../../../../core/reactiveUtils.js";import{adaptiveVolumeUnit as h}from"../../../../core/units.js";import{property as p,subclass as g}from"../../../../core/accessorSupport/decorators.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as _,normalize as y,subtract as f,cross as j,dot as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as L,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as C}from"../../../../core/support/UpdatingHandles.js";import{computeTranslationToOriginAndRotation as G}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{angleAroundAxis as P}from"../../../../geometry/support/vector.js";import{t as V}from"../../../../chunks/vec3.js";import x from"../../../../symbols/support/ElevationInfo.js";import{LabelVisualElement as O}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as R}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as D}from"../../interactive/visualElements/OutlineVisualElement.js";import{EuclideanSegment as M}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as A}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as H}from"../../layers/graphics/extrudePolygon.js";import{polygonToRenderInfoElevationAligned as F}from"../../support/renderInfoUtils/polygon.js";import{CutFill as U,VolumeGeometry as E}from"../../webgl-engine/lib/CutFill.js";import{createStipplePatternSimple as S}from"../../webgl-engine/materials/lineStippleUtils.js";let z=class extends r{get visible(){return this.viewData.visible&&null!=this.viewData.elevationAlignedGeometry&&null!=this.viewData.targetGeometry}get inView(){return this.viewData.analysisObb?.intersectsFrustum(this.view.frustum)??!1}get updating(){return this.loadingMessages||this._updatingHandles.updating}get hasUnsupportedError(){const{error:e}=this.viewData;return!!e&&["unsupported-coordinate-system","unsupported-layer-transparency"].includes(e.name)}get _extrusionHeights(){const{renderCoordsHelper:e}=this.view,{depthExtremaPositions:t,targetGeometry:i}=this.viewData,{targetElevationRange:s}=o;if(!i||!t)return{cut:s,fill:-s};let r=-1/0;for(const o of i.rings)for(const e of o)r=Math.max(r,e[2]);const n=1,l=e.getAltitude(t.fill);return{cut:s,fill:Math.min(l-r,0)-n}}constructor(e){super(e),this.unitsMessages=null,this.messages=null,this.loadingMessages=!0,this._updatingHandles=new C,this._elevationContext=A.fromElevationInfo(new x({mode:"absolute-height"})),this._projectionLines=[]}initialize(){const{view:e}=this,i={view:e,isDecoration:!0},s=o,r={...i,width:s.geometryOutlineWidth};this._elevationAlignedGeometry=new D({...r,isDraped:!0,color:s.geometryOutlineColor.toUnitRGBA()}),this._targetGeometry=new D(r);const n={...i,attached:!0,width:s.projectionLineWidth,renderOccluded:4,polygonOffset:3},l={...n,stipplePattern:S(s.projectionLineStippleSize)},a=s.cutProjectionLineColor.toUnitRGBA(),c=s.fillProjectionLineColor.toUnitRGBA();this._cutProjectionLines=new R({...n,color:a}),this._occludedCutProjectionLines=new R({...l,color:a}),this._fillProjectionLines=new R({...n,color:c,renderOccluded:8}),this._occludedFillProjectionLines=new R({...l,color:c});const u={...i,attached:!0};this._cutVolumeLabel=new O({...u,distance:s.labelDistance}),this._fillVolumeLabel=new O({...u,distance:-s.labelDistance}),this._visualization=new U({view:e,cutColor:s.cutColor,fillColor:s.fillColor,borderColor:s.geometryOutlineColor}),this.addHandles([this._updatingHandles.add(()=>({elevationAlignedGeometry:this.viewData.elevationAlignedGeometry,targetGeometry:this.viewData.targetGeometry}),({elevationAlignedGeometry:e,targetGeometry:t})=>{this._elevationAlignedGeometry.geometry=e,this._targetGeometry.geometry=t},m),this._updatingHandles.add(()=>({interactive:this.viewData.interactive,measureType:this.analysis.measureType,visible:this.visible}),({visible:e,interactive:t,measureType:i})=>{this._elevationAlignedGeometry.visible=e&&!t,this._targetGeometry.visible=e&&"cut-fill"===i,this._visualization.measureType=i},m),this._updatingHandles.add(()=>({elevationAlignedGeometry:this.viewData.elevationAlignedGeometry,targetGeometry:this.viewData.targetGeometry,visible:this.visible}),({elevationAlignedGeometry:e,targetGeometry:t,visible:i})=>this._updateProjectionLines(e,t,i),m),this._updatingHandles.add(()=>({interactive:this.viewData.interactive,accentColor:this.view.effectiveTheme.accentColor,hasResult:!!this.viewData.result}),({interactive:e,accentColor:t,hasResult:i})=>{this._updateColors(e,t,i)},m),this._updatingHandles.add(()=>[this.viewData.targetGeometry,this.inView,this._extrusionHeights,this._polygonRenderInfo],()=>this._updateCutFillGeometry(),m),this._updatingHandles.add(()=>this.visible&&this.inView&&this.view.state.camera.aboveGround&&!this.hasUnsupportedError,e=>this._updateCutFillVisibility(e),m),this._updatingHandles.add(()=>{const{messages:e,unitsMessages:t,visible:i,viewData:s}=this;return{depthExtremaPositions:s.depthExtremaPositions,effectiveDisplayUnits:s.effectiveDisplayUnits,messages:e,unitsMessages:t,result:s.result,visible:i&&!!s.result}},e=>this._updateLabels(e)),this._updatingHandles.add(()=>this.view.state.camera,e=>this._updateProjectionLineOcclusion(e),m),t(()=>this._updateMessageBundle())]),this._updateMessageBundle()}destroy(){this._elevationAlignedGeometry=a(this._elevationAlignedGeometry),this._targetGeometry=a(this._targetGeometry),this._cutProjectionLines=a(this._cutProjectionLines),this._occludedCutProjectionLines=a(this._occludedCutProjectionLines),this._fillProjectionLines=a(this._fillProjectionLines),this._occludedFillProjectionLines=a(this._occludedFillProjectionLines),this._cutVolumeLabel=a(this._cutVolumeLabel),this._fillVolumeLabel=a(this._fillVolumeLabel),this._visualization.destroy(),this._updatingHandles.destroy()}_updateProjectionLines(e,t,i){if(this._cutProjectionLines.visible=i,this._occludedCutProjectionLines.visible=i,this._fillProjectionLines.visible=i,this._occludedFillProjectionLines.visible=i,!e||!t)return;const{renderCoordsHelper:s}=this.view,o=[],r=[],l=[],a=[],c=[],u=e.spatialReference;for(let d=0;d<e.rings.length;d++){const i=e.rings[d],m=i.length>1&&n(i[0],i[i.length-1]),h=i.length-(m?1:0),p=[];for(let e=0;e<h;++e){const o=i[e],r=_(L(),o[0],o[1],o[2]);s.toRenderCoords(r,u,r);const n=t.rings[d][e],l=_(L(),n[0],n[1],n[2]);s.toRenderCoords(l,u,l);const a=new M(r,l);p.push(a)}const g=this.view.state.camera;for(let e=0;e<p.length;++e){const s=p[e],n=p[0===e?p.length-1:e-1],u=p[e===p.length-1?0:e+1],m=i[e],h=t.rings[d][e],v=m[2]>h[2],_=new I(s,n,u,v);o.push(_),_.updateOccluded(g);const y=_.isOccluded;v?(y?l:r).push(s):(y?c:a).push(s)}}this._projectionLines=o,this._cutProjectionLines.setGeometryFromSegments(r),this._occludedCutProjectionLines.setGeometryFromSegments(l),this._fillProjectionLines.setGeometryFromSegments(a),this._occludedFillProjectionLines.setGeometryFromSegments(c)}_updateProjectionLineOcclusion(e){const t=[],i=[],s=[],o=[];let r=!1,n=!1;for(const l of this._projectionLines){l.updateOccluded(e)&&(r||=l.isCut,n||=!l.isCut);const a=l.isOccluded;(l.isCut?a?i:t:a?o:s).push(l.segment)}n&&(this._fillProjectionLines.setGeometryFromSegments(s),this._occludedFillProjectionLines.setGeometryFromSegments(o)),r&&(this._cutProjectionLines.setGeometryFromSegments(t),this._occludedCutProjectionLines.setGeometryFromSegments(i))}_updateColors(e,t,i){const{geometryOutlineColor:s,cutColor:r,fillColor:n,cutColorMuted:l,fillColorMuted:a,cutProjectionLineColor:c,fillProjectionLineColor:u}=o;if(this._visualization.cutColor=i?r:l,this._visualization.fillColor=i?n:a,e){const e=t.toUnitRGBA();this._targetGeometry.color=e,this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e,this._fillProjectionLines.color=e,this._occludedFillProjectionLines.color=e,this._visualization.borderColor=t}else{this._targetGeometry.color=s.toUnitRGBA();const e=(i?c:l).toUnitRGBA();this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e;const t=(i?u:a).toUnitRGBA();this._fillProjectionLines.color=t,this._occludedFillProjectionLines.color=t,this._visualization.borderColor=s}}_updateLabels(e){const{effectiveDisplayUnits:t,depthExtremaPositions:s,messages:o,unitsMessages:r,result:n,visible:l}=e;if(this._cutVolumeLabel.visible=l,this._fillVolumeLabel.visible=l,this._cutVolumeLabel.geometry=s?{type:"point",point:s.cut}:null,this._fillVolumeLabel.geometry=s?{type:"point",point:s.fill}:null,null==n||null==o||null==r)return this._cutVolumeLabel.text="-",void(this._fillVolumeLabel.text="-");const a=t.volume,c=i(o.labels.cut,{volume:B(r,n.cutVolume,a)}),u=i(o.labels.fill,{volume:B(r,n.fillVolume,a)});this._cutVolumeLabel.text=c,this._fillVolumeLabel.text=u}_updateCutFillVisibility(e){e?this._visualization.enable():this._visualization.disable()}get _polygonRenderInfo(){const{renderCoordsHelper:e,elevationProvider:t}=this.view,{targetGeometry:i}=this.viewData;if(null==i)return null;const s=F(i,t,e,this._elevationContext,{outlineOutput:"tessellated-indices"});return c(s)?(this._updatingHandles.consumePromise(s),null):s}_updateCutFillGeometry(){const{view:e,viewData:t,inView:i}=this,{renderCoordsHelper:s}=e,{targetGeometry:o}=t,{cut:r,fill:n}=this._extrusionHeights;if(!o?.extent||!i)return;const{center:l}=o.extent,a=w(l.x,l.y,0),c=L();s.toRenderCoords(a,o.spatialReference,c);const u=this._getExtrudedVolume(r,a,c),d=this._getExtrudedVolume(n,a,c);null!=u&&null!=d&&this._visualization.updateGeometries(u,d,c)}_getExtrudedVolume(e,t,i){const{renderCoordsHelper:s,spatialReference:o}=this.view,r=L(),n=1===s.viewingMode;s.worldUpAtPosition(i,r);const l=H(this._polygonRenderInfo,{height:e,worldUp:r,spherical:n,requireElevation:!1,requireNormals:!0,requireSizes:!1});if(null==l)return null;const a=v(),c=v();if(G(o,t,a,s.spatialReference),c[12]=-a[12],c[13]=-a[13],c[14]=-a[14],V(l.vertices,l.vertices,c),"stockpile"===this.analysis.measureType)for(let u=0;u<l.normals.length;u+=3)l.normals[u]=r[0],l.normals[u+1]=r[1],l.normals[u+2]=r[2];return new E(l.vertices,l.bottomIndices,l.indices,l.normals)}async _updateMessageBundle(){this.loadingMessages=!0;try{this.unitsMessages=await s("esri/core/t9n/Units"),this.messages=await s("esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis")}finally{this.loadingMessages=!1}}};function B(e,t,i){if(!t||!e)return null;const s=h(t.value,t.unit,i),o=u(s);return d(e,t,s,o)}e([p({constructOnly:!0})],z.prototype,"view",void 0),e([p({constructOnly:!0})],z.prototype,"analysis",void 0),e([p({constructOnly:!0})],z.prototype,"viewData",void 0),e([p()],z.prototype,"unitsMessages",void 0),e([p()],z.prototype,"messages",void 0),e([p()],z.prototype,"loadingMessages",void 0),e([p({readOnly:!0})],z.prototype,"_updatingHandles",void 0),e([p({readOnly:!0})],z.prototype,"visible",null),e([p()],z.prototype,"inView",null),e([p()],z.prototype,"updating",null),e([p()],z.prototype,"hasUnsupportedError",null),e([p()],z.prototype,"_extrusionHeights",null),e([p()],z.prototype,"_polygonRenderInfo",null),z=e([g("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementVisualization")],z);class I{constructor(e,t,i,s){this.segment=e,this.previous=t,this.next=i,this.isCut=s,this._isOccluded=!1,this._n1=L(),this._n2=L();const o=y(T,f(T,e.endRenderSpace,e.startRenderSpace));y(this._n1,j(this._n1,o,y(q,f(q,t.startRenderSpace,e.startRenderSpace)))),y(this._n2,j(this._n2,o,y(q,f(q,e.startRenderSpace,i.startRenderSpace)))),this._isConvex=l.normalize(P(this._n1,this._n2,o))<0}get isOccluded(){return this._isOccluded}updateOccluded(e){f(T,this.segment.startRenderSpace,e.eye);const t=b(this._n1,T)<0,i=b(this._n2,T)<0,s=this._isOccluded;return this._isOccluded=this._isConvex?t&&i:t||i,this._isOccluded!==s}}const T=L(),q=L();export{z as VolumeMeasurementVisualization};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isPromiseLike as r}from"../../core/promiseUtils.js";import{convertToSpatialReferenceUnit as e,convertFromSpatialReferenceUnit as t}from"../../core/units.js";import{create as o}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as s}from"../../geometry/ellipsoidUtils.js";import{project as n}from"../../geometry/projectionUtils.js";import{execute as l}from"../../geometry/operators/gx/operatorDensify.js";import{fromPolygon as m,toPolygon as p}from"../../geometry/operators/support/apiConverter.js";import{computeTranslationToOriginAndRotation as a}from"../../geometry/projection/computeTranslationToOriginAndRotation.js";import{earth as c}from"../../geometry/support/Ellipsoid.js";import{t as u}from"../../chunks/vec3.js";import{StencilGeometry as f,StencilGeometryWithOrigin as g}from"./StencilGeometry.js";import{extrudePolygon as d}from"./layers/graphics/extrudeUtils.js";import{computeCentroid as j}from"./layers/graphics/graphicUtils.js";import{polygonToRenderInfoElevationAligned as h}from"./support/renderInfoUtils/polygon.js";const y=2e4;function x(o,i,x){const M=i.renderCoordsHelper,R=1===M.viewingMode,b=i.spatialReference,C=s(b).radius/c.radius,I=e(5e5*C,"meters",b,!0);R||M.worldUpAtPosition([0,0,0],U);const A=b.equals(o.spatialReference)?o:n(o,b),E=Math.max(A.extent.width,A.extent.height),O=t(E,b,"meters",!0),P=Math.max(5*O,y*C),S=v(A,P,R?C/10:C),T=j(S);if(null==T)return null;const k=m(S),z=l(k,I,0,0),D=p(z,b);if(null==D)return null;const G=h(D,i.elevationProvider,M,x,{outlineOutput:"tessellated-indices"});if(r(G))return G;if(null==G||0===G.polygonIndexCount)return null;a(b,[T.x,T.y,0],w,M.spatialReference),q[12]=-w[12],q[13]=-w[13],q[14]=-w[14];const H=d(G,{height:P,worldUp:U,spherical:R,requireElevation:!1,requireNormals:!1,requireSizes:!1});if(null==H)return null;u(H.vertices,H.vertices,q);const N=new f(H.vertices,H.bottomIndices,H.indices,P);return new g(N,[w[12],w[13],w[14]])}function v(r,e,t){const o=-12e5*t,i=Math.max(-e/2,o),s=r.rings.map(r=>r.map(r=>[r[0],r[1],i])),n=r.clone();return n.rings=s,n.hasZ=!0,n}const U=i(),w=o(),q=o();export{x as polygonToVolume};
2
+ import{isPromiseLike as r}from"../../core/promiseUtils.js";import{convertToSpatialReferenceUnit as e,convertFromSpatialReferenceUnit as o}from"../../core/units.js";import{create as t}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as s}from"../../geometry/ellipsoidUtils.js";import{project as n}from"../../geometry/projectionUtils.js";import{execute as l}from"../../geometry/operators/gx/operatorDensify.js";import{fromPolygon as m,toPolygon as p}from"../../geometry/operators/support/apiConverter.js";import{computeTranslationToOriginAndRotation as a}from"../../geometry/projection/computeTranslationToOriginAndRotation.js";import{earth as c}from"../../geometry/support/Ellipsoid.js";import{t as u}from"../../chunks/vec3.js";import{StencilGeometry as f,StencilGeometryWithOrigin as g}from"./StencilGeometry.js";import{extrudePolygon as d}from"./layers/graphics/extrudePolygon.js";import{computeCentroid as j}from"./layers/graphics/graphicUtils.js";import{polygonToRenderInfoElevationAligned as h}from"./support/renderInfoUtils/polygon.js";const y=2e4;function x(t,i,x){const M=i.renderCoordsHelper,R=1===M.viewingMode,b=i.spatialReference,C=s(b).radius/c.radius,I=e(5e5*C,"meters",b,!0);R||M.worldUpAtPosition([0,0,0],U);const P=b.equals(t.spatialReference)?t:n(t,b),A=Math.max(P.extent.width,P.extent.height),E=o(A,b,"meters",!0),O=Math.max(5*E,y*C),S=v(P,O,R?C/10:C),T=j(S);if(null==T)return null;const k=m(S),z=l(k,I,0,0),D=p(z,b);if(null==D)return null;const G=h(D,i.elevationProvider,M,x,{outlineOutput:"tessellated-indices"});if(r(G))return G;if(null==G||0===G.polygonIndexCount)return null;a(b,[T.x,T.y,0],w,M.spatialReference),q[12]=-w[12],q[13]=-w[13],q[14]=-w[14];const H=d(G,{height:O,worldUp:U,spherical:R,requireElevation:!1,requireNormals:!1,requireSizes:!1});if(null==H)return null;u(H.vertices,H.vertices,q);const N=new f(H.vertices,H.bottomIndices,H.indices,O);return new g(N,[w[12],w[13],w[14]])}function v(r,e,o){const t=-12e5*o,i=Math.max(-e/2,t),s=r.rings.map(r=>r.map(r=>[r[0],r[1],i])),n=r.clone();return n.rings=s,n.hasZ=!0,n}const U=i(),w=t(),q=t();export{x as polygonToVolume};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as i,removeMaybe as s,destroyMaybe as a}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{watch as n,whenOnce as l,initial as o}from"../../../core/reactiveUtils.js";import{isUint32Array as h}from"../../../core/typedArrayUtil.js";import{unitFromRESTJSON as d,convertUnit as u}from"../../../core/units.js";import{property as c,subclass as p}from"../../../core/accessorSupport/decorators.js";import{fromValues as m}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as f}from"../../../geometry/ellipsoidUtils.js";import g from"../../../geometry/HeightModelInfo.js";import{create as _}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as y}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as w,isWebMercator as b,equals as v,isGeographic as S}from"../../../geometry/support/spatialReferenceUtils.js";import C from"../../../geometry/support/WKIDUnitConversion.js";import{validateEntity3D as M,makeCacheKey as T,getHeightModelInfoFromVCS as I}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as x}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as H}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as P}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as A}from"./LayerView3D.js";import{addLayerViewToWasm as F,getLyr3DWasm as R,removeLayerViewFromWasm as V}from"./Lyr3DWasm.js";import{LayerElevationProvider as j}from"./i3s/LayerElevationProvider.js";import{ElevationRange as E}from"../support/ElevationRange.js";import{projectToBoundingBox as G}from"../support/extentUtils.js";import{Obb as U}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as B,gaussiansPerPage as O,packedGaussianSizeInU32 as D,splatAtlasTextureWidth as z}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as L}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as k}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as q}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as W}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatDepthRenderer as $}from"../webgl-engine/lib/GaussianSplatDepthRenderer.js";import{GaussianSplatRenderer as N}from"../webgl-engine/lib/GaussianSplatRenderer.js";import{GaussianSplatShadows as X}from"../webgl-engine/lib/GaussianSplatShadows.js";import Z from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as K,isInEffectiveScaleRange as Y}from"../../support/layerViewUtils.js";import{TaskPriority as J}from"../../support/Scheduler.js";var Q;const ee=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D"),te=3,ie=te*te,se=255,ae=(()=>{const e=new Int16Array(se+1);e[0]=-255;for(let t=1;t<e.length;t++)e[t]=Math.round(16*Math.log(t/se));return e})();let re=class extends(A(Z)){static{Q=this}static{this.createRenderableBatchSize=64}static{this.uploadBatchPageCount=16}constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(B*Q.uploadBatchPageCount),this._tmpTilesWithChangedVisibility=new Array,this._renderablesBeingCreated=new Set,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._fadeDurationPerVisibilityChange=new Map,this._tmpSortedTileHandles=new Set,this._createRenderableAbortController=new AbortController,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(J.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=_();return G(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderer?.clippingBox??null}initialize(){const{view:e}=this;this.addHandles([n(()=>e.qualitySettings.fadeDuration,e=>{this.data&&(this.fadeHelper.onFadeDurationChanged(e),this.updateFadingTexture())})]),this.addResolvingPromise(this._initializeAsync(e))}async _initializeAsync(e){this._initializationController=new AbortController;const{signal:t}=this._initializationController;if(await l(()=>e?.defaultsFromMap.heightModelInfoReady,t),r(t),!this._canProjectWithoutEngine())throw K("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._wasmLayerId=await F(this,t),r(t),this._renderer=new N({view:e,layerView:this}),this.data=new L(this._renderer,(e,t)=>this._onSortComplete(e,t),()=>this._freeInvisibleTiles()),this._shadows=new X({view:e,layerView:this}),this.fadeHelper=new k(this),this._depthRenderer=new $({view:e,layerView:this});const i=new q(this);this._intersectionHandler=i,e.sceneIntersectionHelper.addIntersectionHandler(i),this._elevationProvider=new j({view:e,layerElevationSource:this,intersectionHandler:i}),e.elevationProvider.register(2,this._elevationProvider),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),n(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),o)]),this._suspendedHandle=n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o),this.addHandles([n(()=>this._clippingBox,e=>{this._renderer&&(this._renderer.clippingBox=e)},o),n(()=>this.maximumGaussianCount,e=>this._wasm?.setMaximumGaussianSplatCount(Math.min(e,this.data.textureAtlas.maximumSupportedVisibleGaussians)),o)]),this._initializationController=null}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}updateFadingTexture(){this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)}get _wasm(){return R(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return x(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new E(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return Y(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{entity3d:t}=e;if(!M(t))throw new Error("entity3D not valid");const i=t.desc.geometry.prims[t.validPrimitiveIndices[0]].atrbs[0],s=t.assets[i.assetId];if(!s)throw new Error("entity3D not valid");const a=s.count;if(0===a)return ee().warnOnce("encountered tile with zero Gaussians"),()=>({memUsageBytes:0,numGaussians:0});let r=null;if("U32"!==s.dataType||!h(s.data))throw new Error("unexpected GaussianSplat Entity3D asset.data format");r=s.data;const n=this.extractHeader(r),l=2.048,o=n.tileOrigin.x*l,d=n.tileOrigin.y*l,u=n.tileOrigin.z*l,c=t.desc,p=c.obb.quaternion,g=new U(c.obb.center,c.obb.halfSize,m(...p)),_=this.view.state.isGlobal,y=_?f(this.view.spatialReference).radius:0,w={handle:e.handle,bufferView:r,totalGaussians:a,packedHeader:n.packedHeader,tileOrigin:{x:o,y:d,z:u},invPosScale:n.invPosScale,obb:g,origin:{x:g.centerX,y:g.centerY,z:g.centerZ},isGlobal:_,ellipsoidRadius:y};let b;this._renderablesBeingCreated.add(e.handle);try{b=await this._frameTask.scheduleGenerator(e=>this._createRenderableTask(w,e),this._createRenderableAbortController.signal)}catch(v){throw this._renderablesBeingCreated.delete(e.handle),v}return this._renderablesBeingCreated.delete(e.handle),()=>b}*_createRenderableTask(e,t){const{handle:i,bufferView:s,totalGaussians:a,packedHeader:r,tileOrigin:n,invPosScale:l,obb:o,origin:h,isGlobal:d,ellipsoidRadius:u}=e,c=n.x,p=n.y,m=n.z,f=h.x,g=h.y,_=h.z,y=new Float32Array(3*a),w=new Uint32Array(a),b=new Uint32Array(a),v=new Array,S=Math.ceil(a/O);let C=1/0,M=-1/0,T=1/0,I=-1/0,x=0,H=-1,P=0,A=0;for(let E=0;E<a;E++){const e=E*D,i=s[e],a=s[e+1],r=s[e+2],n=s[e+3],o=16383&a,h=a>>>14&16383,u=a>>>28&15|(1023&r)<<4,v=n>>>24,S=ae[v],F=(r>>>10&255)+S,R=(r>>>18&255)+S,V=(r>>>26&63|(3&n)<<6)+S,j=F>0?F:0,G=R>0?R:0,U=V>0?V:0,B=j|G<<8|U<<16,O=Math.max(j,G,U),z=o*l+c,L=h*l+p,k=u*l+m;if(y[x]=z-f,y[x+1]=L-g,y[x+2]=k-_,d){const e=z*z+L*L+k*k;T=Math.min(T,e),I=Math.max(I,e)}else C=Math.min(C,k),M=Math.max(M,k);w[E]=i,b[E]=B,O>H&&(H=O),v>P&&(P=v),x+=3,A++,A===Q.createRenderableBatchSize&&(A=0,t.madeProgress()&&(t=yield))}A>0&&t.madeProgress()&&(t=yield),d&&(C=Math.sqrt(T)-u,M=Math.sqrt(I)-u);const F=this._extractGaussianSplatMbsRadiusSquared(H),{fullExtent:R}=this.layer;R?.hasZ&&R.zmax&&R.zmin&&(C=Math.max(C,R.zmin),M=Math.min(M,R.zmax));const V=new E(C,M),j=this.data.textureAtlas,G=this.data.headerTexture;try{for(let e=0;e<S;e+=Q.uploadBatchPageCount){const i=Math.min(S,e+Q.uploadBatchPageCount);for(let t=e;t<i;t++){let e=j.allocatePage();if(null===e&&(this._freeInvisibleTiles(),e=j.allocatePage()),null===e)throw new Error("ran out of gaussian splat memory");v.push(e)}for(let t=e;t<i;){const e=v[t];let n=t+1;for(;n<i&&v[n]===v[n-1]+1;)n++;const l=n-t,o=a-t*O,h=Math.min(o,l*O),d=t*B,u=h*D;this._pageBuffer.set(s.subarray(d,d+u));const c=e*O,p=c%z,m=Math.floor(c/z);j.update(p,m,this._pageBuffer,l),G.update(e,r,l),t=n}t.madeProgress()&&(t=yield)}}catch(L){throw j.freePages(v),L}const U=new W(i,o,v,y,w,b,a,F,P/se,V);return this._tileHandles.set(i,U),this._cacheTileMemory+=U.usedMemory,this._memCache.put(`${U.handle}`,U),{memUsageBytes:U.usedMemory,numGaussians:a}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*ie}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);const t=this.data?.textureAtlas;let i=!1;const s=this._tileHandles.get(e);if(s){0!==s.lifecycleState?(i=!0,this.fadeHelper.onTileDiscarded(s),this._usedTileMemory-=s.usedMemory,this._intersectionHandler.removeTile(s)):this._cacheTileMemory-=s.usedMemory,t&&s.pageIds.forEach(e=>t.freePage(e)),this.freeObject(s),this._tileHandles.delete(e)}i&&this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(e.length,t=>{for(const{obb:i}of e)if(!t(i))break})}setRenderableVisibility(e,t,i){const s=this._currentLyr3dVisibilityChange+1,a=this.fadeHelper.updateFadeDuration();this._fadeDurationPerVisibilityChange.set(s,a);let r=!1;for(let n=0;n<i;n++){const i=this._tileHandles.get(e[n]);if(!i)continue;const l=t[n]?this._prepareTileFadeIn(i,s,a):this._prepareTileFadeOut(i,s);r||=l}r?(this._currentLyr3dVisibilityChange=s,this.updateGaussians()):this._fadeDurationPerVisibilityChange.delete(s)}_prepareTileFadeIn(e,t,i){const s=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return 2===e.lifecycleState?(this.fadeHelper.fadeTile(e,0,i),!1):this._tileFadeInsAwaitingInitialSort.get(e.handle)!==t?(0===e.lifecycleState&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0):s}_prepareTileFadeOut(e,t){const i=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return i&&1===e.lifecycleState&&(this.moveTileToCache(e),e.lifecycleState=0),2!==e.lifecycleState?i:this._tileFadeOutsAwaitingInitialSort.get(e.handle)!==t?(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):i}_onSortComplete(e,t){const i=this._tmpTilesWithChangedVisibility;i.length=0;const s=this._tmpSortedTileHandles;s.clear();for(let r=0;r<e.length;r++){const t=e[r];s.add(t.handle)}this._triggerFadeIns(t,s,i);const a=this._triggerFadeOuts(t,i);s.clear(),i.length>0&&this.notifyTileObbsChanged(i),a&&this.updateGaussians(),this._cleanupVisibilityChangeFadeDurations(t)}_triggerFadeIns(e,t,i){for(const[s,a]of this._tileFadeInsAwaitingInitialSort){if(a>e||!t.has(s))continue;const r=this._tileHandles.get(s);if(!r){this._tileFadeInsAwaitingInitialSort.delete(s);continue}const n=this._getFadeDurationForPendingVisibilityChange(a),l=0===r.lifecycleState;2!==r.lifecycleState&&(r.lifecycleState=2,l&&this._popTileFromCache(r),i.push(r)),this.fadeHelper.fadeTile(r,0,n),this._tileFadeInsAwaitingInitialSort.delete(s)}}_triggerFadeOuts(e,t){let i=!1;for(const[s,a]of this._tileFadeOutsAwaitingInitialSort){if(a>e)continue;const r=this._tileHandles.get(s);if(r){const e=2===r.lifecycleState,s=this._getFadeDurationForPendingVisibilityChange(a);this.fadeHelper.fadeTile(r,1,s),e&&0===r.lifecycleState&&(t.push(r),i=!0)}this._tileFadeOutsAwaitingInitialSort.delete(s)}return i}_getFadeDurationForPendingVisibilityChange(e){return this._fadeDurationPerVisibilityChange.get(e)??this.fadeHelper.baseFadeDuration}_cleanupVisibilityChangeFadeDurations(e){if(0!==this._fadeDurationPerVisibilityChange.size)for(const t of this._fadeDurationPerVisibilityChange.keys())t<=e&&this._fadeDurationPerVisibilityChange.delete(t)}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(T(e.handle))}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(T(e.handle),e)}destroy(){this._initializationController=i(this._initializationController),this._createRenderableAbortController.abort(),V(this),this._suspendedHandle&&(this._suspendedHandle=s(this._suspendedHandle)),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(this._tileHandles.size,e=>{for(const{obb:t}of this._tileHandles.values())if(!e(t))break}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadows=a(this._shadows),this._depthRenderer=a(this._depthRenderer),this._renderer=a(this._renderer),this._memCache.destroy(),this.data=a(this.data)}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(w(this.view.renderSpatialReference)||b(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&v(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=I(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!S(t)&&t.wkid&&-1!==t.wkid&&(i=d(C.units[C[t.wkid]])),i&&(e=new g({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===y(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=u(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=H(e?.unit)/this._metersPerVCSUnit,i=e?.offset??0;this._wasm?.setLayerOffset(this,i*t)}else this._wasm?.setLayerOffset(this,x(e));else this._wasm?.setLayerOffset(this,0)}_slicePlaneEnabledChanged(e){this._renderer&&(this._renderer.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())0!==t.lifecycleState&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange("updating")}get maximumGaussianCount(){return this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*this.view.quality}set maximumGaussianCount(e){this._set("maximumGaussianCount",e)}_freeInvisibleTiles(){for(const e of this._tileHandles.values())0!==e.lifecycleState||this._renderablesBeingCreated.has(e.handle)||this._deleteTile(e)}extractHeader(e){const t=e.length-4,i=this.reinterpretU32AsFloat(e[t]),s=this.reinterpretU32AsFloat(e[t+1]),a=this.reinterpretU32AsFloat(e[t+2]),r=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:i,y:s,z:a},invPosScale:r}}_deleteTile(e){this._renderablesBeingCreated.has(e.handle)||this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(i=>{0===i.lifecycleState?t++:e++});const i=this.data?.textureAtlasMemory??0,s=this.data?.headerTextureMemory??0,a=this.data?.orderTextureMemory??0,r=this.data?.fadingTextureMemory??0,n=this.data?.sortBufferMemory??0;return new P(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,i,s,a,r,n)}get test(){}};e([c()],re.prototype,"layer",void 0),e([c({readOnly:!0})],re.prototype,"_clippingBox",null),e([c()],re.prototype,"elevationOffset",null),e([c({readOnly:!0})],re.prototype,"visibleAtCurrentScale",null),e([c()],re.prototype,"fullExtentInLocalViewSpatialReference",void 0),e([c()],re.prototype,"maximumGaussianCount",null),re=Q=e([p("esri.views.3d.layers.GaussianSplatLayerView3D")],re);const ne=re;export{ne as default};
2
+ import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as i,removeMaybe as s,destroyMaybe as a}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{watch as n,whenOnce as l,initial as o}from"../../../core/reactiveUtils.js";import{isUint32Array as h}from"../../../core/typedArrayUtil.js";import{unitFromRESTJSON as d,convertUnit as u}from"../../../core/units.js";import{property as c,subclass as p}from"../../../core/accessorSupport/decorators.js";import{fromValues as m}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as f}from"../../../geometry/ellipsoidUtils.js";import g from"../../../geometry/HeightModelInfo.js";import{create as _}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as y}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as w,isWebMercator as b,equals as v,isGeographic as S}from"../../../geometry/support/spatialReferenceUtils.js";import C from"../../../geometry/support/WKIDUnitConversion.js";import{validateEntity3D as M,makeCacheKey as T,getHeightModelInfoFromVCS as I}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as x}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as H}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as P}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as A}from"./LayerView3D.js";import{addLayerViewToWasm as F,getLyr3DWasm as R,removeLayerViewFromWasm as V}from"./Lyr3DWasm.js";import{LayerElevationProvider as j}from"./i3s/LayerElevationProvider.js";import{ElevationRange as E}from"../support/ElevationRange.js";import{projectToBoundingBox as G}from"../support/extentUtils.js";import{Obb as U}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as D,gaussiansPerPage as B,packedGaussianSizeInU32 as O,splatAtlasTextureWidth as z}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as L}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as k}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as q}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as W}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatDepthRenderer as $}from"../webgl-engine/lib/GaussianSplatDepthRenderer.js";import{GaussianSplatRenderer as N}from"../webgl-engine/lib/GaussianSplatRenderer.js";import{GaussianSplatShadows as X}from"../webgl-engine/lib/GaussianSplatShadows.js";import Z from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as K,isInEffectiveScaleRange as Y}from"../../support/layerViewUtils.js";import{TaskPriority as J}from"../../support/Scheduler.js";var Q;const ee=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D"),te=3,ie=te*te,se=255,ae=(()=>{const e=new Int16Array(se+1);e[0]=-255;for(let t=1;t<e.length;t++)e[t]=Math.round(16*Math.log(t/se));return e})();let re=class extends(A(Z)){static{Q=this}static{this.createRenderableBatchSize=64}static{this.uploadBatchPageCount=16}constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(D*Q.uploadBatchPageCount),this._tmpTilesWithChangedVisibility=new Array,this._renderablesBeingCreated=new Set,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._fadeDurationPerVisibilityChange=new Map,this._tmpSortedTileHandles=new Set,this._createRenderableAbortController=new AbortController,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(J.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=_();return G(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderer?.clippingBox??null}initialize(){const{view:e}=this;this.addHandles([n(()=>e.qualitySettings.fadeDuration,e=>{this.data&&(this.fadeHelper.onFadeDurationChanged(e),this.updateFadingTexture())})]),this.addResolvingPromise(this._initializeAsync(e))}async _initializeAsync(e){this._initializationController=new AbortController;const{signal:t}=this._initializationController;if(await l(()=>e?.defaultsFromMap.heightModelInfoReady,t),r(t),!this._canProjectWithoutEngine())throw K("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._wasmLayerId=await F(this,t),r(t),this._renderer=new N({view:e,layerView:this}),this.data=new L(this._renderer,(e,t)=>this._onSortComplete(e,t),()=>this._freeInvisibleTiles()),this._shadows=new X({view:e,layerView:this}),this.fadeHelper=new k(this),this._prepassDepthRenderer=new $({view:e,layerView:this});const i=new q(this);this._intersectionHandler=i,e.sceneIntersectionHelper.addIntersectionHandler(i),this._elevationProvider=new j({view:e,layerElevationSource:this,intersectionHandler:i}),e.elevationProvider.register(2,this._elevationProvider),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),n(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),o)]),this._suspendedHandle=n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o),this.addHandles([n(()=>this._clippingBox,e=>{this._renderer&&(this._renderer.clippingBox=e)},o),n(()=>this.maximumGaussianCount,e=>this._wasm?.setMaximumGaussianSplatCount(Math.min(e,this.data.textureAtlas.maximumSupportedVisibleGaussians)),o)]),this._initializationController=null}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}updateFadingTexture(){this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)}get _wasm(){return R(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return x(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new E(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return Y(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{entity3d:t}=e;if(!M(t))throw new Error("entity3D not valid");const i=t.desc.geometry.prims[t.validPrimitiveIndices[0]].atrbs[0],s=t.assets[i.assetId];if(!s)throw new Error("entity3D not valid");const a=s.count;if(0===a)return ee().warnOnce("encountered tile with zero Gaussians"),()=>({memUsageBytes:0,numGaussians:0});let r=null;if("U32"!==s.dataType||!h(s.data))throw new Error("unexpected GaussianSplat Entity3D asset.data format");r=s.data;const n=this.extractHeader(r),l=2.048,o=n.tileOrigin.x*l,d=n.tileOrigin.y*l,u=n.tileOrigin.z*l,c=t.desc,p=c.obb.quaternion,g=new U(c.obb.center,c.obb.halfSize,m(...p)),_=this.view.state.isGlobal,y=_?f(this.view.spatialReference).radius:0,w={handle:e.handle,bufferView:r,totalGaussians:a,packedHeader:n.packedHeader,tileOrigin:{x:o,y:d,z:u},invPosScale:n.invPosScale,obb:g,origin:{x:g.centerX,y:g.centerY,z:g.centerZ},isGlobal:_,ellipsoidRadius:y};let b;this._renderablesBeingCreated.add(e.handle);try{b=await this._frameTask.scheduleGenerator(e=>this._createRenderableTask(w,e),this._createRenderableAbortController.signal)}catch(v){throw this._renderablesBeingCreated.delete(e.handle),v}return this._renderablesBeingCreated.delete(e.handle),()=>b}*_createRenderableTask(e,t){const{handle:i,bufferView:s,totalGaussians:a,packedHeader:r,tileOrigin:n,invPosScale:l,obb:o,origin:h,isGlobal:d,ellipsoidRadius:u}=e,c=n.x,p=n.y,m=n.z,f=h.x,g=h.y,_=h.z,y=new Float32Array(3*a),w=new Uint32Array(a),b=new Uint32Array(a),v=new Array,S=Math.ceil(a/B);let C=1/0,M=-1/0,T=1/0,I=-1/0,x=0,H=-1,P=0,A=0;for(let E=0;E<a;E++){const e=E*O,i=s[e],a=s[e+1],r=s[e+2],n=s[e+3],o=16383&a,h=a>>>14&16383,u=a>>>28&15|(1023&r)<<4,v=n>>>24,S=ae[v],F=(r>>>10&255)+S,R=(r>>>18&255)+S,V=(r>>>26&63|(3&n)<<6)+S,j=F>0?F:0,G=R>0?R:0,U=V>0?V:0,D=j|G<<8|U<<16,B=Math.max(j,G,U),z=o*l+c,L=h*l+p,k=u*l+m;if(y[x]=z-f,y[x+1]=L-g,y[x+2]=k-_,d){const e=z*z+L*L+k*k;T=Math.min(T,e),I=Math.max(I,e)}else C=Math.min(C,k),M=Math.max(M,k);w[E]=i,b[E]=D,B>H&&(H=B),v>P&&(P=v),x+=3,A++,A===Q.createRenderableBatchSize&&(A=0,t.madeProgress()&&(t=yield))}A>0&&t.madeProgress()&&(t=yield),d&&(C=Math.sqrt(T)-u,M=Math.sqrt(I)-u);const F=this._extractGaussianSplatMbsRadiusSquared(H),{fullExtent:R}=this.layer;R?.hasZ&&R.zmax&&R.zmin&&(C=Math.max(C,R.zmin),M=Math.min(M,R.zmax));const V=new E(C,M),j=this.data.textureAtlas,G=this.data.headerTexture;try{for(let e=0;e<S;e+=Q.uploadBatchPageCount){const i=Math.min(S,e+Q.uploadBatchPageCount);for(let t=e;t<i;t++){let e=j.allocatePage();if(null===e&&(this._freeInvisibleTiles(),e=j.allocatePage()),null===e)throw new Error("ran out of gaussian splat memory");v.push(e)}for(let t=e;t<i;){const e=v[t];let n=t+1;for(;n<i&&v[n]===v[n-1]+1;)n++;const l=n-t,o=a-t*B,h=Math.min(o,l*B),d=t*D,u=h*O;this._pageBuffer.set(s.subarray(d,d+u));const c=e*B,p=c%z,m=Math.floor(c/z);j.update(p,m,this._pageBuffer,l),G.update(e,r,l),t=n}t.madeProgress()&&(t=yield)}}catch(L){throw j.freePages(v),L}const U=new W(i,o,v,y,w,b,a,F,P/se,V);return this._tileHandles.set(i,U),this._cacheTileMemory+=U.usedMemory,this._memCache.put(`${U.handle}`,U),{memUsageBytes:U.usedMemory,numGaussians:a}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*ie}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);const t=this.data?.textureAtlas;let i=!1;const s=this._tileHandles.get(e);if(s){0!==s.lifecycleState?(i=!0,this.fadeHelper.onTileDiscarded(s),this._usedTileMemory-=s.usedMemory,this._intersectionHandler.removeTile(s)):this._cacheTileMemory-=s.usedMemory,t&&s.pageIds.forEach(e=>t.freePage(e)),this.freeObject(s),this._tileHandles.delete(e)}i&&this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(e.length,t=>{for(const{obb:i}of e)if(!t(i))break})}setRenderableVisibility(e,t,i){const s=this._currentLyr3dVisibilityChange+1,a=this.fadeHelper.updateFadeDuration();this._fadeDurationPerVisibilityChange.set(s,a);let r=!1;for(let n=0;n<i;n++){const i=this._tileHandles.get(e[n]);if(!i)continue;const l=t[n]?this._prepareTileFadeIn(i,s,a):this._prepareTileFadeOut(i,s);r||=l}r?(this._currentLyr3dVisibilityChange=s,this.updateGaussians()):this._fadeDurationPerVisibilityChange.delete(s)}_prepareTileFadeIn(e,t,i){const s=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return 2===e.lifecycleState?(this.fadeHelper.fadeTile(e,0,i),!1):this._tileFadeInsAwaitingInitialSort.get(e.handle)!==t?(0===e.lifecycleState&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0):s}_prepareTileFadeOut(e,t){const i=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return i&&1===e.lifecycleState&&(this.moveTileToCache(e),e.lifecycleState=0),2!==e.lifecycleState?i:this._tileFadeOutsAwaitingInitialSort.get(e.handle)!==t?(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):i}_onSortComplete(e,t){const i=this._tmpTilesWithChangedVisibility;i.length=0;const s=this._tmpSortedTileHandles;s.clear();for(let r=0;r<e.length;r++){const t=e[r];s.add(t.handle)}this._triggerFadeIns(t,s,i);const a=this._triggerFadeOuts(t,i);s.clear(),i.length>0&&this.notifyTileObbsChanged(i),a&&this.updateGaussians(),this._cleanupVisibilityChangeFadeDurations(t)}_triggerFadeIns(e,t,i){for(const[s,a]of this._tileFadeInsAwaitingInitialSort){if(a>e||!t.has(s))continue;const r=this._tileHandles.get(s);if(!r){this._tileFadeInsAwaitingInitialSort.delete(s);continue}const n=this._getFadeDurationForPendingVisibilityChange(a),l=0===r.lifecycleState;2!==r.lifecycleState&&(r.lifecycleState=2,l&&this._popTileFromCache(r),i.push(r)),this.fadeHelper.fadeTile(r,0,n),this._tileFadeInsAwaitingInitialSort.delete(s)}}_triggerFadeOuts(e,t){let i=!1;for(const[s,a]of this._tileFadeOutsAwaitingInitialSort){if(a>e)continue;const r=this._tileHandles.get(s);if(r){const e=2===r.lifecycleState,s=this._getFadeDurationForPendingVisibilityChange(a);this.fadeHelper.fadeTile(r,1,s),e&&0===r.lifecycleState&&(t.push(r),i=!0)}this._tileFadeOutsAwaitingInitialSort.delete(s)}return i}_getFadeDurationForPendingVisibilityChange(e){return this._fadeDurationPerVisibilityChange.get(e)??this.fadeHelper.baseFadeDuration}_cleanupVisibilityChangeFadeDurations(e){if(0!==this._fadeDurationPerVisibilityChange.size)for(const t of this._fadeDurationPerVisibilityChange.keys())t<=e&&this._fadeDurationPerVisibilityChange.delete(t)}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(T(e.handle))}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(T(e.handle),e)}destroy(){this._initializationController=i(this._initializationController),this._createRenderableAbortController.abort(),V(this),this._suspendedHandle&&(this._suspendedHandle=s(this._suspendedHandle)),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(this._tileHandles.size,e=>{for(const{obb:t}of this._tileHandles.values())if(!e(t))break}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadows=a(this._shadows),this._prepassDepthRenderer=a(this._prepassDepthRenderer),this._renderer=a(this._renderer),this._memCache.destroy(),this.data=a(this.data)}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(w(this.view.renderSpatialReference)||b(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&v(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=I(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!S(t)&&t.wkid&&-1!==t.wkid&&(i=d(C.units[C[t.wkid]])),i&&(e=new g({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===y(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=u(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=H(e?.unit)/this._metersPerVCSUnit,i=e?.offset??0;this._wasm?.setLayerOffset(this,i*t)}else this._wasm?.setLayerOffset(this,x(e));else this._wasm?.setLayerOffset(this,0)}_slicePlaneEnabledChanged(e){this._renderer&&(this._renderer.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())0!==t.lifecycleState&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange("updating")}get maximumGaussianCount(){return this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*this.view.quality}set maximumGaussianCount(e){this._set("maximumGaussianCount",e)}_freeInvisibleTiles(){for(const e of this._tileHandles.values())0!==e.lifecycleState||this._renderablesBeingCreated.has(e.handle)||this._deleteTile(e)}extractHeader(e){const t=e.length-4,i=this.reinterpretU32AsFloat(e[t]),s=this.reinterpretU32AsFloat(e[t+1]),a=this.reinterpretU32AsFloat(e[t+2]),r=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:i,y:s,z:a},invPosScale:r}}_deleteTile(e){this._renderablesBeingCreated.has(e.handle)||this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(i=>{0===i.lifecycleState?t++:e++});const i=this.data?.textureAtlasMemory??0,s=this.data?.headerTextureMemory??0,a=this.data?.orderTextureMemory??0,r=this.data?.fadingTextureMemory??0,n=this.data?.sortBufferMemory??0;return new P(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,i,s,a,r,n)}get test(){}};e([c()],re.prototype,"layer",void 0),e([c({readOnly:!0})],re.prototype,"_clippingBox",null),e([c()],re.prototype,"elevationOffset",null),e([c({readOnly:!0})],re.prototype,"visibleAtCurrentScale",null),e([c()],re.prototype,"fullExtentInLocalViewSpatialReference",void 0),e([c()],re.prototype,"maximumGaussianCount",null),re=Q=e([p("esri.views.3d.layers.GaussianSplatLayerView3D")],re);const ne=re;export{ne as default};
@@ -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,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 n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}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 d,create as u}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 _,intersectsClippingArea as x}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"./extrudePolygon.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 R}from"../support/symbolColorUtils.js";import{debugFlags as V}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,n=t?.emissive,o=("color"===n?.source?n?.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:d,diffuse:d,externalColor:l,opacity:a?0:1,layerOpacity:this._getLayerOpacity(),drivenOpacity:i,hasSymbolColors:s,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:e.castShadows,emissiveStrengthFromSymbol:o,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);R(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,n){const o=this._getExtrusionSize(i)*this._context.renderCoordsHelper.unitInMeters/t(s),{objectId:a,target:l}=r,c=e(l);switch(c.z=(c.z??0)+o,r.type){case"edge":{const{start:t,end:s}=r,i=e(t),n=e(s);return i.z=(i.z??0)+o,n.z=(n.z??0)+o,[new j(a,c,1/0,i,n)]}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,n,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,d=new Array,g=b(),y=o(),C=u(),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=o();i(j,y);const S=s();r(S,j);const P=new Map,E=this._materials[0];if(this._context.clippingExtent&&(_(m.mapPositions,g),!x(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 R=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerViewUid:this._context.layerViewUid}),V=new ce(M.vertices,M.elevation,W(M.normals),M.sizes),B=X(E,M.indices,M.indices.length-M.bottomIndices.length,V,n,R),F=m.vertexCount,N=2*m.outlineSegmentCount,H=m.polygonIndexCount/3,q=new me(F,N,H);if(te(B,q,y),P.set(B,q),h.push(B),M.bottomIndices.length>0&&h.push(X(this._materials[1],M.bottomIndices,0,V,n,R)),d.push(V.heights),0===h.length)return null;const k=new Z({geometries:h,layerViewUid:this._context.layerViewUid,graphicUid:l,isElevationSource:!0});k.transformation=y;const J=L(this.symbolLayer,{opacity:this._getLayerOpacity()}),K=J?new A(this._materials[0],J,this._context.slicePlaneEnabled):null,Q=new z(this,k,null,(e,t,r,s,i)=>ee(e,t,r,s,i,d,P),a,K);return Q.alignedSampledElevation=m.sampledElevation,Q.needsElevationUpdates=I(a.mode),Q}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,n){const{attributeIndices:o,drawIndices:a}=Y(t),l=[["position",new N(s.positions,o,3,!0)],["normalCompressed",new N(s.normals,o,2,!0)]];let c=null;return e.parameters.hasSymbolColors&&(c=C(o.length),l.push(["symbolColor",new N(i,c,4,!0)])),null!=n&&(c??=C(o.length),M(l,n,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 n=e[i];let o=r.get(n);null==o&&(o=t.length,t.push(n),r.set(n,o)),s.push(o)}return{attributeIndices:t,drawIndices:s}}const $=u();function ee(e,t,r,s,i,l,c){const m=e.stageObject,p=m.geometries,d=p.length,u="absolute-height"!==t.mode;let g=0;const y=m.transformation,f=n(o(),y);for(let n=0,o=0;n<d;++n){const e=p[n],t=c.get(e);if(!t||!q(e))continue;const d=e.getMutableAttribute("position").data,b=l[o++],_=new B(e.mapPositions),x=d.length/3;let C=!1,v=0;{let e=0;for(let t=0;t<x;t++){$[0]=d[e],$[1]=d[e+1],$[2]=d[e+2],s(_,ie),u&&(v+=ie.sampledElevation),V.ENABLE_OPTIMIZATIONS?(a(re,d[e],d[e+1],d[e+2]),h(re,re,y),i.setAltitude(re,ie.z+b[e/3]),h(re,re,f)):(a(re,_.array[_.offset],_.array[_.offset+1],ie.z+b[e/3]),null!=r&&i.toRenderCoords(re,r,re),h(re,re,f)),d[e]=re[0],d[e+1]=re[1],d[e+2]=re[2];const t=ne/i.unitInMeters;(Math.abs($[0]-d[e])>=t||Math.abs($[1]-d[e+1])>=t||Math.abs($[2]-d[e+2])>=t)&&(C=!0),_.offset+=3,e+=3}}if(C){te(e,t,y),m.geometryVertexAttributeUpdated(p[n],"normalCompressed"),e.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(p[n],"position");const r=p[n+1],s=!c.has(r);r&&s&&(r.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(r,"position"))}g+=v/x}return g/d}function te(e,t,r){const s=e.getMutableAttribute("normalCompressed").data,i=e.readPrimitivePosition,{plateVertexCount:n,topFaceStart:o,topFaceCount:d}=t,u=o+d,g=oe,y=ae,f=le,b=se,_=re;a(_,0,0,0);const x=(e,t)=>{h(t,i(t,e),r)};for(let a=o;a<u;++a){const e=3*a;x(e,g[0]),x(e+1,g[1]),x(e+2,g[2]),l(y,g[1],g[0]),l(f,g[2],g[0]),c(b,y,f),m(_,_,b)}p(_,_);for(let a=0;a<n;++a){const e=_[0],t=_[1],r=_[2];k(s,a,-e,-t,-r),k(s,a+n,e,t,r)}}const re=u(),se=u(),ie=new E,ne=.01,oe=[u(),u(),u()],ae=u(),le=u();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){this.plateVertexCount=e,this.topFaceStart=t,this.topFaceCount=r}}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{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as r,intersectsClippingArea as i,empty as s,expandWithAABB as n,create as o}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as a,doubleSubArray as l}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as c}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as p}from"../../../../geometry/support/Indices.js";import{isDrivenOpacityFallbackAlwaysOpaque as u}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{elevationModeChangeUpdateType as h,needsElevationUpdates2D as d}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as m}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as _}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as g}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as y}from"./graphicUtils.js";import{parseCapType as f,computeSymbolLayerIndex as v}from"./lineUtils.js";import{geometryAsPolygon as x,createColorGeometry as b,PolygonCreationDataBase as C}from"./polygonUtils.js";import{initFastSymbolUpdatesState as S,updateFastSymbolUpdatesState as P,getAttributeValue as D,ConvertOptions as O}from"../support/FastSymbolUpdates.js";import{createMaterial as U,uvElevationAligner as w}from"../support/patternUtils.js";import{writeMapSpaceUVCoordsPerConnectedPart as j,writeMapSpaceUVCoordsDraped as I}from"../support/uvUtils.js";import{createGeometry as G}from"../../support/engineContent/line.js";import{loadTessellationUtils as A,preloadedPolygonToRenderInfoElevationAligned as E,preloadedPolygonToRenderInfoDraped as R}from"../../support/renderInfoUtils/polygon.js";import{Object3D as V}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as L}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as M}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as z}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as B}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as F}from"../../webgl-engine/materials/RibbonLineMaterial.js";const T=["polyline","polygon","extent"];class H extends g{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,u(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=S(this._context.renderer,this._vvConvertOptions),await A()}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){const e=this.symbolLayer.material?.emissive;return("color"===e?.source?e?.strength:void 0)??0}_createMaterials(){if(this._materials.length>0)return;const t=this._materialColor,r=this._getCombinedOpacityAndColor(t);this._materials[0]=U(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof B;const i=this.symbolLayer.outline;if(N(i)){const t=z(i.pattern),r=f(i.pattern?i.patternCap||"butt":"square");this._materials[1]=new F({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,polygonOffsetIndex:v(this._renderPriority,this._renderPriorityStep),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:r,screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&M(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,T,this.symbolLayer.type))return null;const r=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),i=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===i.mode),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,r):this._createAs3DShape(e.renderingInfo,t,r,i)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!P(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,r=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],r],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=h(H.elevationModeChangeTypes,r,i);if(1!==s)return s;const n=d(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>n)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_containsRenderableGeometry(e){return e.polygonIndexCount>0||null!=this._materials[1]&&("vertex-data"===e.outline.output?e.outline.outlines.length>0:e.outlineIndexCount>0)}_createAs3DShape(e,t,r,i){const s=x(t.geometry);if(!s)return null;const n=E(s,this._context.elevationProvider,this._context.renderCoordsHelper,i,{projectIfNearlyVertical:!0,outlineOutput:"vertex-data",owner:this._context.layer});if(null==n)return null;const o=new k(n,r,this._context.layerViewUid,t.uid),u=o.renderData.vertexCount;if(this._needsUV){o.uvMapSpace=c(4*u,!0),o.textureElementIndices=new Array(u),o.boundingRect=a(o.renderData.polygonIndices.length/3*9);const e=j(o.uvMapSpace,o.boundingRect,o.textureElementIndices,o.renderData.positions,o.renderData.polygonIndices,this._context.renderCoordsHelper);o.boundingRect=l(o.boundingRect,0,9*e),o.boundingRectIndices=p(e)}if(o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAs3DShapeFill(e,o),this._materials[1]&&this._createAs3DShapeOutline(o),this._logGeometryCreationWarnings(o.renderData,s.rings,"rings","FillSymbol3DLayer"),0===o.outGeometries.length)return null;const h=new V({geometries:o.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),m=new _(this,h,null,w,i);return m.alignedSampledElevation=o.renderData.sampledElevation,m.needsElevationUpdates=d(i.mode),m}_createAs3DShapeFill(e,t){const{mapPositions:s,positions:n,polygonIndices:o,polygonIndexCount:a}=t.renderData;if(0===a)return;if(null!=this._context.clippingExtent&&(r(s,W),!i(W,this._context.clippingExtent)))return;const l=this._fastUpdates?.visualVariables.color,c=b({material:this._materials[0],indices:o,mapPositions:s,attributeData:{position:n,color:l?null:t.color,colorFeature:l?D(l,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,boundingRect:this._needsUV?t.boundingRect:null,textureElementIndices:this._needsUV?t.textureElementIndices:null,boundingRectIndices:this._needsUV?t.boundingRectIndices:null,olidColor:t.olidColor}});t.outGeometries.push(c)}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const{outline:t}=e.renderData;if("vertex-data"!==t.output)return;const{outlines:s}=t;if(null!=s&&0!==s.length)for(const{mapPositions:n,position:o}of s){if(null!=this._context.clippingExtent&&(r(n,W),!i(W,this._context.clippingExtent)))continue;const t=G(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:n,attributeData:{position:o}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t,r){const i=x(t.geometry);if(null==i)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const n=R(i,{drapedSpatialReference:this._context.overlaySR,outlineOutput:"vertex-data",owner:this._context.layer});if(null==n)return null;const o=new q(n,r,this._context.layerViewUid,t.uid);return this._needsUV&&(o.uvMapSpace=c(4*o.renderData.vertexCount,!0),I(o.uvMapSpace,o.renderData.positions,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=s(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,i.rings,"rings","FillSymbol3DLayer"),new m(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const{positions:s,polygonIndices:o,polygonIndexCount:a}=t.renderData;if(0===a)return;const l=r(s,W);if(!i(l,this._context.clippingExtent))return;n(t.outBoundingBox,l);const c=this._fastUpdates?.visualVariables.color,p=b({material:this._materials[0],indices:o,attributeData:{position:s,color:c?null:t.color,colorFeature:c?D(c,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,olidColor:t.olidColor}});t.outGeometries.push(new L(p,t))}_createAsOverlayOutline(e){if(null==this._materials[1])return;const{outline:t}=e.renderData;if("vertex-data"!==t.output)return;const{outlines:s}=t;for(const{position:o}of s){if(r(o,W),!i(W,this._context.clippingExtent))continue;n(e.outBoundingBox,W);const t=G(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:o}},e.olidColor);e.outGeometries.push(new L(t,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return y(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,r)=>this._createAsOverlay(e,t,r),createAs3DShape:(e,t,r,i)=>this._createAs3DShape(e,t,r,i)}}get _vvConvertOptions(){return new O({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??t})}}const W=o();class k extends C{constructor(e,t,r,i){super(e,r,i),this.color=t}}class q extends C{constructor(e,t,r,i){super(e,r,i),this.color=t}}function N(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}export{H as Graphics3DPolygonFillSymbolLayer};
2
+ import{pt2px as e}from"../../../../core/screenUtils.js";import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as r,intersectsClippingArea as i,empty as s,expandWithAABB as n,create as o}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as a,doubleSubArray as l}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as c}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as p}from"../../../../geometry/support/Indices.js";import{isDrivenOpacityFallbackAlwaysOpaque as u}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{elevationModeChangeUpdateType as d,needsElevationUpdates2D as h}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as m}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as _}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as g}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as y}from"./graphicUtils.js";import{parseCapType as f,computeSymbolLayerIndex as v}from"./lineUtils.js";import{geometryAsPolygon as x,createColorGeometry as b,PolygonCreationDataBase as C}from"./polygonUtils.js";import{initFastSymbolUpdatesState as S,updateFastSymbolUpdatesState as P,getAttributeValue as D,ConvertOptions as O}from"../support/FastSymbolUpdates.js";import{createMaterial as U,uvElevationAligner as w}from"../support/patternUtils.js";import{writeMapSpaceUVCoordsPerConnectedPart as j,writeMapSpaceUVCoordsDraped as I}from"../support/uvUtils.js";import{createGeometry as G}from"../../support/engineContent/line.js";import{loadTessellationUtils as A,preloadedPolygonToRenderInfoElevationAligned as E,preloadedPolygonToRenderInfoDraped as R}from"../../support/renderInfoUtils/polygon.js";import{Object3D as V}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as L}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as M}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as z}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as B}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as F}from"../../webgl-engine/materials/RibbonLineMaterial.js";const T=["polyline","polygon","extent"];class H extends g{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,u(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=S(this._context.renderer,this._vvConvertOptions),await A()}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){const e=this.symbolLayer.material?.emissive;return("color"===e?.source?e?.strength:void 0)??0}_createMaterials(){if(this._materials.length>0)return;const{_materialColor:t,draped:r}=this,i=this._getCombinedOpacityAndColor(t);this._materials[0]=U(this.symbolLayer,{color:i,forceTransparentMode:this.needsDrivenTransparentPass,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:r,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof B;const s=this.symbolLayer.outline;if(N(s)){const t=z(s.pattern),r=f(s.pattern?s.patternCap||"butt":"square");this._materials[1]=new F({width:e(s.size),color:this._getOutlineColor(),polygonOffset:3,polygonOffsetIndex:v(this._renderPriority,this._renderPriorityStep),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:r,screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&M(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,T,this.symbolLayer.type))return null;const r=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),i=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===i.mode),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,r):this._createAs3DShape(e.renderingInfo,t,r,i)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!P(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,r=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],r],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=d(H.elevationModeChangeTypes,r,i);if(1!==s)return s;const n=h(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>n)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_containsRenderableGeometry(e){return e.polygonIndexCount>0||null!=this._materials[1]&&("vertex-data"===e.outline.output?e.outline.outlines.length>0:e.outlineIndexCount>0)}_createAs3DShape(e,t,r,i){const s=x(t.geometry);if(!s)return null;const n=E(s,this._context.elevationProvider,this._context.renderCoordsHelper,i,{projectIfNearlyVertical:!0,outlineOutput:"vertex-data",owner:this._context.layer});if(null==n)return null;const o=new k(n,r,this._context.layerViewUid,t.uid),u=o.renderData.vertexCount;if(this._needsUV){o.uvMapSpace=c(4*u,!0),o.textureElementIndices=new Array(u),o.boundingRect=a(o.renderData.polygonIndices.length/3*9);const e=j(o.uvMapSpace,o.boundingRect,o.textureElementIndices,o.renderData.positions,o.renderData.polygonIndices,this._context.renderCoordsHelper);o.boundingRect=l(o.boundingRect,0,9*e),o.boundingRectIndices=p(e)}if(o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAs3DShapeFill(e,o),this._materials[1]&&this._createAs3DShapeOutline(o),this._logGeometryCreationWarnings(o.renderData,s.rings,"rings","FillSymbol3DLayer"),0===o.outGeometries.length)return null;const d=new V({geometries:o.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),m=new _(this,d,null,w,i);return m.alignedSampledElevation=o.renderData.sampledElevation,m.needsElevationUpdates=h(i.mode),m}_createAs3DShapeFill(e,t){const{mapPositions:s,positions:n,polygonIndices:o,polygonIndexCount:a}=t.renderData;if(0===a)return;if(null!=this._context.clippingExtent&&(r(s,W),!i(W,this._context.clippingExtent)))return;const l=this._fastUpdates?.visualVariables.color,c=b({material:this._materials[0],indices:o,mapPositions:s,attributeData:{position:n,color:l?null:t.color,colorFeature:l?D(l,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,boundingRect:this._needsUV?t.boundingRect:null,textureElementIndices:this._needsUV?t.textureElementIndices:null,boundingRectIndices:this._needsUV?t.boundingRectIndices:null,olidColor:t.olidColor}});t.outGeometries.push(c)}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const{outline:t}=e.renderData;if("vertex-data"!==t.output)return;const{outlines:s}=t;if(null!=s&&0!==s.length)for(const{mapPositions:n,position:o}of s){if(null!=this._context.clippingExtent&&(r(n,W),!i(W,this._context.clippingExtent)))continue;const t=G(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:n,attributeData:{position:o}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t,r){const i=x(t.geometry);if(null==i)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const n=R(i,{drapedSpatialReference:this._context.overlaySR,outlineOutput:"vertex-data",owner:this._context.layer});if(null==n)return null;const o=new q(n,r,this._context.layerViewUid,t.uid);return this._needsUV&&(o.uvMapSpace=c(4*o.renderData.vertexCount,!0),I(o.uvMapSpace,o.renderData.positions,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=s(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,i.rings,"rings","FillSymbol3DLayer"),new m(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const{positions:s,polygonIndices:o,polygonIndexCount:a}=t.renderData;if(0===a)return;const l=r(s,W);if(!i(l,this._context.clippingExtent))return;n(t.outBoundingBox,l);const c=this._fastUpdates?.visualVariables.color,p=b({material:this._materials[0],indices:o,attributeData:{position:s,color:c?null:t.color,colorFeature:c?D(c,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,olidColor:t.olidColor}});t.outGeometries.push(new L(p,t))}_createAsOverlayOutline(e){if(null==this._materials[1])return;const{outline:t}=e.renderData;if("vertex-data"!==t.output)return;const{outlines:s}=t;for(const{position:o}of s){if(r(o,W),!i(W,this._context.clippingExtent))continue;n(e.outBoundingBox,W);const t=G(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:o}},e.olidColor);e.outGeometries.push(new L(t,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return y(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,r)=>this._createAsOverlay(e,t,r),createAs3DShape:(e,t,r,i)=>this._createAs3DShape(e,t,r,i)}}get _vvConvertOptions(){return new O({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??t})}}const W=o();class k extends C{constructor(e,t,r,i){super(e,r,i),this.color=t}}class q extends C{constructor(e,t,r,i){super(e,r,i),this.color=t}}function N(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}export{H as Graphics3DPolygonFillSymbolLayer};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{copy as t,normalize as o,set as e,subtract as n,cross as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as r}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as s}from"../../../../geometry/support/Indices.js";function u(e,n){if(!e)return null;const{worldUp:l,height:i,spherical:u,requireElevation:m,requireNormals:p,requireSizes:f}=n;if(m&&!("mapPositions"in e))return null;const{positions:a,polygonIndices:d,outline:g}=e,h="mapPositions"in e?e.mapPositions:a;if("tessellated-indices"!==g.output)return null;let v=0;for(let t=0;t<d.length;++t)v=Math.max(v,d[t]+1);const C=e.vertexCount,b=e.outlineSegmentCount,j=2*C+4*b,q=3*j,P=r(q),z=s(6*b+e.polygonIndexCount,j),S=s(e.polygonIndexCount,j);t(x,l);let w=i*l[0],A=i*l[1],D=i*l[2];const E=m?r(q):void 0,M=p?r(q):void 0,N=f?r(q):void 0,U=d.length/3,V=i>0?1:-1;let k=0,B=0,F=C;for(let t=0;t<C;++t){const t=a[k],e=a[k+1],n=a[k+2];u&&(x[0]=t,x[1]=e,x[2]=n,o(x,x),w=i*x[0],A=i*x[1],D=i*x[2]);const l=3*B;P[l]=t,P[l+1]=e,P[l+2]=n;const r=h[k],s=h[k+1],c=h[k+2];null!=E&&(E[l]=r,E[l+1]=s,E[l+2]=c),null!=M&&(M[l+0]=-V*x[0],M[l+1]=-V*x[1],M[l+2]=-V*x[2]),null!=N&&(N[B]=0);const m=3*F;P[m]=t+w,P[m+1]=e+A,P[m+2]=n+D,null!=E&&(E[m]=r,E[m+1]=s,E[m+2]=c),null!=N&&(N[F]=i),k+=3,++B,++F}let G=2*C,H=0;for(let t=0;t<g.outlineIndices.length;++t){const o=g.outlineIndices[t],e=o.length-1;e<=0||(c(P,E,N,M,o,e,C,G,z,H,i),G+=4*e,H+=2*e)}let J=0,K=0,L=3*H;const O=i<0?I:y,Q=i<0?y:I;for(let t=0;t<U;++t)S[K]=d[J+O[0]],S[K+1]=d[J+O[1]],S[K+2]=d[J+O[2]],z[L]=d[J+Q[0]]+C,z[L+1]=d[J+Q[1]]+C,z[L+2]=d[J+Q[2]]+C,K+=3,L+=3,J+=3;return{vertices:P,indices:z,bottomIndices:S,polygonVertexCount:v,elevation:E,normals:M,sizes:N}}function c(t,o,e,n,l,i,r,s,u,c,a){o??=[],e??=[],n??=[];let d=s,g=s+1,h=s+2*i,v=s+2*i+1,x=3*c;for(let y=0;y<i;++y){const i=l[y],s=l[y+1],c=i+r,I=s+r;let C=i,b=s,j=c,q=I;a<0&&(C=I,b=s,j=c,q=i),m(t,C,b,j,f),p(t,o,n,e,f,d,C),p(t,o,n,e,f,g,b),p(t,o,n,e,f,h,j),p(t,o,n,e,f,v,q),u[x]=d,u[x+1]=h,u[x+2]=v,u[x+3]=d,u[x+4]=v,u[x+5]=g,x+=6,d+=2,g+=2,h+=2,v+=2}}function m(t,i,r,s,u){i*=3,r*=3,s*=3,e(a,t[i++],t[i++],t[i++]),e(d,t[r++],t[r++],t[r++]),e(g,t[s++],t[s++],t[s++]),n(h,d,a),n(v,g,a),l(u,v,h),o(u,u)}function p(t,o,e,n,l,i,r){n[i]=n[r],r*=3,t[i*=3]=t[r],t[i+1]=t[r+1],t[i+2]=t[r+2],o[i]=o[r],o[i+1]=o[r+1],o[i+2]=o[r+2],e[i]=l[0],e[i+1]=l[1],e[i+2]=l[2]}const f=i(),a=i(),d=i(),g=i(),h=i(),v=i(),x=i(),y=[0,2,1],I=[0,1,2];export{u as extrudePolygon};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import{watch as t}from"../../../core/reactiveUtils.js";import{property as i,subclass as e}from"../../../core/accessorSupport/decorators.js";import{DefaultNavigationMode3D as r}from"./modes/DefaultNavigationMode3D.js";import s from"../../navigation/Navigation.js";let a=class extends s{constructor(o){super(o),this.mode=new r,this.addHandles([t(()=>this.mode,(o,t)=>{t?.detach(),o.attach(this.view)},{sync:!0,initial:!0})])}};o([i({constructOnly:!0})],a.prototype,"view",void 0),o([i()],a.prototype,"mode",void 0),a=o([e("esri.views.3d.navigation.Navigation3D")],a);export{a as Navigation3D};
2
+ import{__decorate as o}from"tslib";import{ignoreAbortErrors as t}from"../../../core/promiseUtils.js";import{watch as i}from"../../../core/reactiveUtils.js";import{property as e,subclass as r}from"../../../core/accessorSupport/decorators.js";import{DefaultNavigationMode3D as s}from"./modes/DefaultNavigationMode3D.js";import{groundNavigationAdvance as a}from"../state/utils/groundNavigationUtils.js";import n from"../../navigation/Navigation.js";let m=class extends n{constructor(o){super(o),this.mode=new s,this.addHandles([i(()=>this.mode,(o,t)=>{t?.detach(),o.attach(this.view)},{sync:!0,initial:!0})])}zoom(o){switch(this.mode.type){case"default":return t(this.view.goTo({zoomFactor:o?2:.5}));case"ground":return t(a(this.view,o?5:-5));default:this.mode}throw new Error(`Unknown navigation mode while calling navigation3D.zoom: ${this.mode}`)}};o([e({constructOnly:!0})],m.prototype,"view",void 0),o([e()],m.prototype,"mode",void 0),m=o([r("esri.views.3d.navigation.Navigation3D")],m);export{m as Navigation3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{createScreenPointArray as e}from"../../../../core/screenUtils.js";import{distance as t,normalize as n,cross as r,add as o,crossAndNormalize as i,subtract as a,dot as s,scaleAndAdd as c,scale as l,copy as u,length as m}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{create as f,fromPositionAndNormal as h,distance as g,projectPoint as P,projectVector as S}from"../../../../geometry/support/plane.js";import{create as j}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 I,searchAreaSize as y,sphereOrPlanePointFromScreenPoint as z,intersectPlaneFromScreenPoint as b}from"./navigationUtils.js";import{fromScreenAtEye as M}from"../../support/geometryUtils/ray.js";import{Intersector as x}from"../../webgl-engine/lib/Intersector.js";const k=1.5,T={xSpeedMultiplier:k,ySpeedMultiplier:k,maxElevation:1e4,relativeHorizonPadding:.1,minimumHorizonPadding:12},H=d(),A=d(),F=e(),N=d(),G=f(),O=d(),q=d(),Y=d(),R=d(),U=d(),C=d(),D=d(),E=d(),V=d(),L=d(),_=e(),W=j(),B=new w,J=d(),K=f(),Q=d();function X(e,t){return S(t,e.viewForward,H),o(A,e.eye,H),e.projectToScreen(A,F),F[1]}function Z(e,u,m){const d=e.eye;if(t(u.center,d)<u.radius)return n(U,d),r(C,U,e.viewRight),o(A,d,C),e.projectToScreen(A,_),_[1];const p=e.up;M(e,m,W);const f=u.radius;if(i(N,p,W.direction),h(d,N,G),g(G,u.center)>f)return null;P(G,u.center,O);const S=t(u.center,O),j=Math.sqrt(f**2-S**2);a(q,d,O),n(Y,q),i(R,N,Y);const w=s(q,Y),v=s(q,R),I=Math.sqrt(w**2+v**2),y=j**2/I**2,z=j/I**2*Math.sqrt(I**2-j**2),b=y*w,x=z*-v,k=y*v,T=z*w,H=b-x,F=k+T,B=k-T;o(D,O,c(D,l(D,Y,b+x),R,F)),o(E,O,c(E,l(E,Y,H),R,B)),a(V,D,d),n(V,V),a(L,E,d),n(L,L);return s(e.viewForward,V)>=s(e.viewForward,L)?e.projectToScreen(D,_):e.projectToScreen(E,_),_[1]}function $(e,t,n=!0){return n?e<t:e<=t}function ee(e,t,n=!0){return n?e>t:e>=t}function te(e,t,n){return t?e>n:e<n}function ne(e,t){const n=e.fullHeight/e.pixelRatio,r=Math.max(t,n-t);return Math.max(T.minimumHorizonPadding,T.relativeHorizonPadding*r)}function re(e,t){return[oe(e,t),ie(e,t)]}function oe(e,t){const n=e.fullHeight/e.pixelRatio;return Math.min(n,t+ne(e,t))}function ie(e,t){return Math.max(0,t-ne(e,t))}function ae(e,t,n){const r={translation:e,location:t};return n&&(r.normal=n),r}function se(e){const{view:t}=e;return"global"===t.viewingMode?ce(e):le(e)}function ce(e){const{view:r,originalScreenPoint:o,horizonY:i,horizonPadding:a,outTranslation:s,outGrabLocation:c,outGrabNormal:l,intersectionOptions:m,depthSearchSize:d}=e,f=r.state.camera,h=ae(s,c,l);B.radius=p(r.spatialReference).radius;const g=I(r,f,o,B.radius,1,m);if(null==g.scenePickPoint)return!1;const P=g.hasGeometryIntersection;u(J,g.scenePickPoint),u(h.location,J);const S=g.sphere;h.normal&&g.normal&&u(h.normal,g.normal);const j=me(o,i,a,P),w=P?t(J,f.eye):Number.POSITIVE_INFINITY;if(j.wasAdjusted){pe({view:r,screenAdjustment:j,intersector:de(r),fallbackCheck:(e,t,r)=>{const o=z(S,f,e,t);return o&&r&&n(r,t),o},output:h,intersectionOptions:m})}return he({view:r,screenPoint:j.adjustedScreenPoint,camera:f,initialDistance:w,depthSearchSize:d??y,output:h}),!0}function le(e){const{view:r,originalScreenPoint:o,horizonY:i,horizonPadding:a,outTranslation:s,outGrabLocation:l,outGrabNormal:m,intersectionOptions:d,depthSearchSize:p}=e,f=r.sceneIntersectionHelper,g=r.state.camera,P=de(r),S=ae(s,l,m);f.intersectIntersectorScreen(o,P,d);const j=P.results.min.getIntersectionPoint(J),w=j?t(J,g.eye):Number.POSITIVE_INFINITY;j&&(u(S.location,J),S.normal&&u(S.normal,P.results.min.normal)),r.renderCoordsHelper.worldUpAtPosition(g.eye,U),c(Q,g.eye,U,-g.relativeElevation),h(Q,U,K);const v=me(o,i,a,j);if(v.wasAdjusted){pe({view:r,screenAdjustment:v,intersector:P,fallbackCheck:(e,t,r)=>{const o=b(K,g,e,t);return o&&r&&n(r,U),o},output:S,intersectionOptions:d})}return he({view:r,screenPoint:v.adjustedScreenPoint,camera:g,initialDistance:w,depthSearchSize:p??y,output:S}),!0}function ue(e,t,n,r){return!r&&$(e,t)||r&&te(e,!1,n[0])?n[0]:!r&&ee(e,t,!1)?n[1]:null}function me(t,n,r,o){const i=ue(t[1],n,r,o);return{originalScreenPoint:t,adjustedScreenPoint:e(t[0],i??t[1]),horizonY:n,horizonPadding:r,wasAdjusted:null!==i}}function de(e){const t=new x(e.state.viewingMode);return t.options.selectionMode=!0,t.options.store=0,t.options.hud=!1,t.options.normalRequired=!0,t}function pe(e){const{view:t,screenAdjustment:n,fallbackCheck:r,intersector:o,output:i,intersectionOptions:a}=e,s=t.sceneIntersectionHelper;s.intersectIntersectorScreen(n.adjustedScreenPoint,o,{...a,requiresGroundFeedback:!0});let c=o.results.min.getIntersectionPoint(i.location);if(c)return void(i.normal&&u(i.normal,o.results.min.normal));const l=fe(n);s.intersectIntersectorScreen(l,o,{...a,requiresGroundFeedback:!0}),c=o.results.min.getIntersectionPoint(i.location),c?i.normal&&u(i.normal,o.results.min.normal):(c=r(n.adjustedScreenPoint,i.location,i.normal),c||r(l,i.location,i.normal))}function fe(t){const{originalScreenPoint:n,adjustedScreenPoint:r,horizonY:o,horizonPadding:i}=t,a=ee(r[1],o)?Math.min(i[1],n[1]):Math.max(i[0],n[1]);return e(r[0],a)}function he(e){const{view:t,screenPoint:r,camera:i,initialDistance:s,depthSearchSize:c,output:u}=e,d=c>0?t.stage.renderView.getMinimalDepthForArea(v(t),r[0],r[1],i,c):null;a(u.translation,u.location,i.eye);let p=Math.min(m(u.translation),s);d&&d<=p&&(p=d),n(u.translation,u.translation),l(u.translation,u.translation,p),o(u.location,u.translation,i.eye)}export{ne as computeHorizonPadding,re as computeHorizonPaddingLimits,se as findGroundNavigationGrabLocation,X as findPlaneHorizonY,Z as findSphereHorizonY,T as groundNavigationConstants,$ as isAboveHorizon,ee as isBelowHorizon,te as shouldClampScreenY};
2
+ import e from"../../../../core/Logger.js";import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{distance as n,normalize as r,cross as o,add as i,crossAndNormalize as a,subtract as s,dot as c,scaleAndAdd as l,scale as u,copy as m,length as d}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 f}from"../../../../geometry/ellipsoidUtils.js";import{create as g,fromPositionAndNormal as h,distance as w,projectPoint as y,projectVector as P}from"../../../../geometry/support/plane.js";import{create as j}from"../../../../geometry/support/ray.js";import{Sphere as S}from"../../../../geometry/support/sphere.js";import{fromRenderCamera as v}from"../../webgl.js";import{getVoxelWasm as I}from"../../layers/VoxelWasm.js";import{pickPointAndInitSphere as b,searchAreaSize as z,sphereOrPlanePointFromScreenPoint as M,intersectPlaneFromScreenPoint as x}from"./navigationUtils.js";import{OffsetCorrectionController as H}from"./OffsetCorrectionController.js";import{fromScreenAtEye as T}from"../../support/geometryUtils/ray.js";import k from"../../webgl/RenderCamera.js";import{Intersector as C}from"../../webgl-engine/lib/Intersector.js";const A=1.5,F={xSpeedMultiplier:A,ySpeedMultiplier:A,maxElevation:1e4,relativeHorizonPadding:.1,minimumHorizonPadding:12},O=2,G=.25,N=p(),R=p(),q=t(),U=p(),Y=g(),D=p(),E=p(),L=p(),V=p(),_=p(),W=p(),B=p(),J=p(),K=p(),Q=p(),X=t(),Z=j(),$=new S,ee=p(),te=g(),ne=p(),re=p();function oe(e,t){return P(t,e.viewForward,N),i(R,e.eye,N),e.projectToScreen(R,q),q[1]}function ie(e,t,m){const d=e.eye;if(n(t.center,d)<t.radius)return r(_,d),o(W,_,e.viewRight),i(R,d,W),e.projectToScreen(R,X),X[1];const p=e.up;T(e,m,Z);const f=t.radius;if(a(U,p,Z.direction),h(d,U,Y),w(Y,t.center)>f)return null;y(Y,t.center,D);const g=n(t.center,D),P=Math.sqrt(f**2-g**2);s(E,d,D),r(L,E),a(V,U,L);const j=c(E,L),S=c(E,V),v=Math.sqrt(j**2+S**2),I=P**2/v**2,b=P/v**2*Math.sqrt(v**2-P**2),z=I*j,M=b*-S,x=I*S,H=b*j,k=z-M,C=x+H,A=x-H;i(B,D,l(B,u(B,L,z+M),V,C)),i(J,D,l(J,u(J,L,k),V,A)),s(K,B,d),r(K,K),s(Q,J,d),r(Q,Q);return c(e.viewForward,K)>=c(e.viewForward,Q)?e.projectToScreen(B,X):e.projectToScreen(J,X),X[1]}function ae(e,t,n=!0){return n?e<t:e<=t}function se(e,t,n=!0){return n?e>t:e>=t}function ce(e,t,n){return t?e>n:e<n}function le(e,t){const n=e.fullHeight/e.pixelRatio,r=Math.max(t,n-t);return Math.max(F.minimumHorizonPadding,F.relativeHorizonPadding*r)}function ue(e,t){return[me(e,t),de(e,t)]}function me(e,t){const n=e.fullHeight/e.pixelRatio;return Math.min(n,t+le(e,t))}function de(e,t){return Math.max(0,t-le(e,t))}function pe(e,t,n){const r={translation:e,location:t};return n&&(r.normal=n),r}function fe(e){const{view:t}=e;return"global"===t.viewingMode?ge(e):he(e)}function ge(e){const{view:t,originalScreenPoint:o,horizonY:i,horizonPadding:a,outTranslation:s,outGrabLocation:c,outGrabNormal:l,intersectionOptions:u,depthSearchSize:d}=e,p=t.state.camera,g=pe(s,c,l);$.radius=f(t.spatialReference).radius;const h=b(t,p,o,$.radius,1,u);if(null==h.scenePickPoint)return!1;const w=h.hasGeometryIntersection;m(ee,h.scenePickPoint),m(g.location,ee);const y=h.sphere;g.normal&&h.normal&&m(g.normal,h.normal);const P=ye(o,i,a,w),j=w?n(ee,p.eye):Number.POSITIVE_INFINITY;if(P.wasAdjusted){je({view:t,screenAdjustment:P,intersector:Pe(t),fallbackCheck:(e,t,n)=>{const o=M(y,p,e,t);return o&&n&&r(n,t),o},output:g,intersectionOptions:u})}return ve({view:t,screenPoint:P.adjustedScreenPoint,camera:p,initialDistance:j,depthSearchSize:d??z,output:g}),!0}function he(e){const{view:t,originalScreenPoint:o,horizonY:i,horizonPadding:a,outTranslation:s,outGrabLocation:c,outGrabNormal:u,intersectionOptions:d,depthSearchSize:p}=e,f=t.sceneIntersectionHelper,g=t.state.camera,w=Pe(t),y=pe(s,c,u);f.intersectIntersectorScreen(o,w,d);const P=w.results.min.getIntersectionPoint(ee),j=P?n(ee,g.eye):Number.POSITIVE_INFINITY;P&&(m(y.location,ee),y.normal&&m(y.normal,w.results.min.normal)),t.renderCoordsHelper.worldUpAtPosition(g.eye,_),l(ne,g.eye,_,-g.relativeElevation),h(ne,_,te);const S=ye(o,i,a,P);if(S.wasAdjusted){je({view:t,screenAdjustment:S,intersector:w,fallbackCheck:(e,t,n)=>{const o=x(te,g,e,t);return o&&n&&r(n,_),o},output:y,intersectionOptions:d})}return ve({view:t,screenPoint:S.adjustedScreenPoint,camera:g,initialDistance:j,depthSearchSize:p??z,output:y}),!0}function we(e,t,n,r){return!r&&ae(e,t)||r&&ce(e,!1,n[0])?n[0]:!r&&se(e,t,!1)?n[1]:null}function ye(e,n,r,o){const i=we(e[1],n,r,o);return{originalScreenPoint:e,adjustedScreenPoint:t(e[0],i??e[1]),horizonY:n,horizonPadding:r,wasAdjusted:null!==i}}function Pe(e){const t=new C(e.state.viewingMode);return t.options.selectionMode=!0,t.options.store=0,t.options.hud=!1,t.options.normalRequired=!0,t}function je(e){const{view:t,screenAdjustment:n,fallbackCheck:r,intersector:o,output:i,intersectionOptions:a}=e,s=t.sceneIntersectionHelper;s.intersectIntersectorScreen(n.adjustedScreenPoint,o,{...a,requiresGroundFeedback:!0});let c=o.results.min.getIntersectionPoint(i.location);if(c)return void(i.normal&&m(i.normal,o.results.min.normal));const l=Se(n);s.intersectIntersectorScreen(l,o,{...a,requiresGroundFeedback:!0}),c=o.results.min.getIntersectionPoint(i.location),c?i.normal&&m(i.normal,o.results.min.normal):(c=r(n.adjustedScreenPoint,i.location,i.normal),c||r(l,i.location,i.normal))}function Se(e){const{originalScreenPoint:n,adjustedScreenPoint:r,horizonY:o,horizonPadding:i}=e,a=se(r[1],o)?Math.min(i[1],n[1]):Math.max(i[0],n[1]);return t(r[0],a)}function ve(e){const{view:t,screenPoint:n,camera:o,initialDistance:a,depthSearchSize:c,output:l}=e,m=c>0?t.stage.renderView.getMinimalDepthForArea(I(t),n[0],n[1],o,c):null;s(l.translation,l.location,o.eye);let p=Math.min(d(l.translation),a);m&&m<=p&&(p=m),r(l.translation,l.translation),u(l.translation,l.translation,p),i(l.location,l.translation,o.eye)}async function Ie(t,r){if("ground"!==t.navigation.mode.type)return void e.getLogger("esri").warn("Can only advance while in ground navigation mode!");const{camera:o}=t.state;t.renderCoordsHelper.worldUpAtPosition(o.eye,_);const c=t.sceneIntersectionHelper,l=Pe(t),p=a(N,_,o.viewRight);m(Z.origin,o.eye),u(Z.direction,p,r);const f=c.intersectRay(Z,l,ee),g=(new k).copyFrom(o),h=s(re,o.center,o.eye);if(!f||n(ee,o.eye)>r)g.eye=i(N,Z.origin,Z.direction);else{s(N,ee,o.eye);const e=d(N);if(e>O){const t=Math.min(G,(e-O)/e);g.eye=i(N,o.eye,u(N,N,t))}}g.center=i(N,g.eye,h);return new H(t).immediatelyCorrectGroundElevation(g,100),t.goTo(v(t,g),{duration:500,liftOffDisabled:!0})}export{le as computeHorizonPadding,ue as computeHorizonPaddingLimits,fe as findGroundNavigationGrabLocation,oe as findPlaneHorizonY,ie as findSphereHorizonY,Ie as groundNavigationAdvance,F as groundNavigationConstants,ae as isAboveHorizon,se as isBelowHorizon,ce as shouldClampScreenY};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{minExpectedGaussianCount as t}from"./GaussianSplatAtlasPages.js";import{TextureBackedBufferLayout as r}from"../../webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js";import{TextureBuffer as u}from"../../webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js";const s=new r([{name:"gaussianSplatOrder",type:"u32"}]);class f{constructor(e){this._textureBuffer=null,this._rctx=e}get usedMemory(){return this._textureBuffer?.usedMemory??0}ensureCapacity(r){if(r<=0)return;const f=this._textureBuffer;if(null!=f&&f.itemCount>=r&&f.texture.hasWebGLTextureObject)return;const i=Math.max(Math.ceil(r*e),t);f?.dispose(),this._textureBuffer=new u(this._rctx,s,i)}setData(e,t){this.ensureCapacity(t),this._textureBuffer.setSubData(e.buffer,0,e.byteOffset,t)}clear(){this._textureBuffer?.dispose(),this._textureBuffer=null}destroy(){this.clear()}get texture(){return this._textureBuffer?.texture??null}}export{f as GaussianSplatOrderTexture};
2
+ import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{minExpectedGaussianCount as t}from"./GaussianSplatAtlasPages.js";import{TextureBackedBufferLayout as r}from"../../webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js";import{TextureBuffer as u}from"../../webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js";const s=new r([{name:"gaussianSplatOrder",type:"u32"}]);class a{constructor(e){this._textureBuffer=null,this._rctx=e}get usedMemory(){return this._textureBuffer?.usedMemory??0}ensureCapacity(r){if(r<=0)return;const a=this._textureBuffer;if(null!=a&&a.itemCount>=r&&a.texture.hasWebGLTextureObject)return;const f=Math.max(Math.ceil(r*e),t);a?.dispose(),this._textureBuffer=new u(this._rctx,s,f)}setData(e,t){this.ensureCapacity(t);const r=this._textureBuffer,{width:u}=r.texture.descriptor,s=u*Math.max(1,Math.floor(1048576/Uint32Array.BYTES_PER_ELEMENT/u));for(let a=0;a<t;a+=s)r.setSubData(e.buffer,a,e.byteOffset+a*Uint32Array.BYTES_PER_ELEMENT,Math.min(s,t-a))}clear(){this._textureBuffer?.dispose(),this._textureBuffer=null}destroy(){this.clear()}get texture(){return this._textureBuffer?.texture??null}}export{a as GaussianSplatOrderTexture};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{smoothstep as t,lerp as s}from"../../../../../core/mathUtils.js";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{signal as o}from"../../../../../core/signal.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{add as h,normalize as m,length as p,dot as l,scale as u,lerp as c}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as d}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{heightLimit as f}from"../../../environment/weather.js";import{betaRayleigh as P,betaCombined as v}from"../atmosphere/atmosphereUtils.js";import{F as b}from"../../../../../chunks/Fog.glsl.js";import{FogTechnique as w}from"./FogTechnique.js";import{BlurEmission as y}from"../glow/BlurEmission.js";import{EmissiveTechniqueConfiguration as F}from"../../shaders/EmissiveTechniqueConfiguration.js";import{floatBlendReductionFactor as B}from"../../shaders/floatBlendScale.glsl.js";import{ColorAttachment1 as j,SizedPixelFormat as C,ColorAttachment0 as E,DepthStencilAttachment as q}from"../../../../webgl/enums.js";const x=.9*f,T=1.1*f;let A=class extends y{constructor(){super(...arguments),this._configuration=new F,this._newParameters=new M,this._oldParameters=new M,this._fadedParameters=new M,this._parameters=this._newParameters,this._passParameters=new b}initialize(){this.addHandles([a(()=>this.view.environment.atmosphereEnabled,()=>this._updateEnabled(),i),a(()=>this.view.environment.weather,()=>this._updateEnabled(),i),a(()=>this._updateFogParameters(),()=>{},i),a(()=>this._fadeFactor,e=>this._fade(e),i)])}_updateEnabled(){this.view.environment.atmosphereEnabled&&this.view.environment.weather?this._enable():this._disable()}get _fadeFactor(){return this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1}_fade(e){const{_newParameters:t,_oldParameters:s}=this;e>=1?(this._parameters=t,this._oldParameters.copy(this._newParameters)):e<=0?this._parameters=s:(this._fadedParameters.lerp(s,t,e),this._parameters=this._fadedParameters)}_updateFogParameters(){const{weather:e,weatherAvailable:t}=this.view.environment,s="foggy"===e.type||"snowy"===e.type||"rainy"===e.type;this._newParameters.strength.value=t?e.scattering:0,this._newParameters.amount.value=s?1:0,"foggy"!==e.type&&"snowy"!==e.type||(this._newParameters.fogBrightness=G),"rainy"===e.type&&(this._newParameters.fogBrightness=z),this._fadeFactor>=1&&this._oldParameters.copy(this._newParameters),this.requestRender(2)}get strength(){return this._parameters.strength.value*this._heightFade}get amount(){return this._parameters.amount.value*this._heightFade}get _heightFade(){const e=p(this.bindParameters.camera.eye);return 1-t(x,T,Math.abs(e-this._ellipsoid.radius))}precompile(){this._update(),this._passParameters.amount>0&&(super.precompile(),this.techniques.precompile(w,this._configuration))}get _needsEmissionBlur(){return this._configuration.hasEmissive}render(){const e=this.input,t=this._getTechnique();if(!t)return e;this._passParameters.emission=e.obtainAttachment(j),this._passParameters.inputScale=this._passParameters.emission?.attachment.descriptor.internalFormat===C.RGBA8?B:1;const s=this.renderingContext;this._passParameters.emission&&(this._renderEmissionMipMap(),this._configuration.useFloatBlend?(e.acquireColor(j,8,"emissive"),s.clearBuffer(1,d)):(this._passParameters.color=e.obtainAttachment(E),e.acquireColor(E,5),e.acquireColor(j,8,"emissive")));const a=e.getAttachment(q);return e.attachDepth(null),s.bindFramebuffer(e.fbo),s.bindTechnique(t,this.bindParameters,this._passParameters),s.screen.draw(),this._passParameters.color=r(this._passParameters.color),this._passParameters.emission=r(this._passParameters.emission),this._passParameters.mipmapTexture=r(this._passParameters.mipmapTexture),e.attachDepth(a),this.fboCache.debugCallback?.("fog-color",e.fbo),e}_getTechnique(){return this.renders?this.techniques.get(w,this._configuration):null}get renders(){return this._update(),this._passParameters.amount>0}_update(){const e=this.bindParameters.camera;m(R,e.eye);const t=Math.max(0,l(R,this.bindParameters.lighting.mainLight.direction)),s=this._parameters.fogBrightness;u(this._passParameters.fogColor,k,s),u(S,k,.1*s),c(this._passParameters.fogColor,S,this._passParameters.fogColor,t);const r=p(e.eye);this._passParameters.atmosphereC=r**2-this._atmosphereRadius**2,this._passParameters.amount=this.amount,this._passParameters.strength=this.strength,this._configuration.hasEmissive=this.bindParameters.hasEmission,this._configuration.useFloatBlend=this.bindParameters.useFloatBlend.value}get test(){return{parameters:this._passParameters}}};A=e([n("esri.views.3d.webgl-engine.effects.fog.Fog")],A);class M{constructor(){this.fogBrightness=0,this.strength=o(0),this.amount=o(0)}copy(e){this.fogBrightness=e.fogBrightness,this.strength.value=e.strength.value,this.amount.value=e.amount.value}lerp(e,t,r){this.fogBrightness=s(e.fogBrightness,t.fogBrightness,r),this.strength.value=s(e.strength.value,t.strength.value,r),this.amount.value=s(e.amount.value,t.amount.value,r)}}const R=g(),S=g(),U=_(3e-4,3e-4,3e-4),k=g();h(k,v,P),h(k,k,U),m(k,k);const D=k.reduce((e,t)=>e+t,0)/3,z=.5/D,G=1.5/D;export{A as Fog,M as FogParameters};
2
+ import{__decorate as e}from"tslib";import{smoothstep as t,lerp as s}from"../../../../../core/mathUtils.js";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{signal as o}from"../../../../../core/signal.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{add as h,normalize as m,length as p,dot as l,scale as u,lerp as c}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as d}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{heightLimit as f}from"../../../environment/weather.js";import{betaRayleigh as P,betaCombined as v}from"../atmosphere/atmosphereUtils.js";import{F as b}from"../../../../../chunks/Fog.glsl.js";import{FogTechnique as w}from"./FogTechnique.js";import{BlurEmission as y}from"../glow/BlurEmission.js";import{EmissiveTechniqueConfiguration as F}from"../../shaders/EmissiveTechniqueConfiguration.js";import{floatBlendReductionFactor as B}from"../../shaders/floatBlendScale.glsl.js";import{ColorAttachment1 as j,SizedPixelFormat as C,ColorAttachment0 as E,DepthStencilAttachment as q}from"../../../../webgl/enums.js";const x=.9*f,T=1.1*f;let A=class extends y{constructor(){super(...arguments),this._configuration=new F,this._newParameters=new M,this._oldParameters=new M,this._fadedParameters=new M,this._parameters=this._newParameters,this._passParameters=new b}initialize(){this.addHandles([a(()=>this.view.environment.atmosphereEnabled,()=>this._updateEnabled(),i),a(()=>this.view.environment.weather,()=>this._updateEnabled(),i),a(()=>this._updateFogParameters(),()=>{},i),a(()=>this._fadeFactor,e=>this._fade(e),i)])}_updateEnabled(){this.view.environment.atmosphereEnabled&&this.view.environment.weather?this._enable():this._disable()}get _fadeFactor(){return this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1}_fade(e){const{_newParameters:t,_oldParameters:s}=this;e>=1?(this._parameters=t,this._oldParameters.copy(this._newParameters)):e<=0?this._parameters=s:(this._fadedParameters.lerp(s,t,e),this._parameters=this._fadedParameters)}_updateFogParameters(){const{weather:e,weatherAvailable:t}=this.view.environment,s="foggy"===e.type||"snowy"===e.type||"rainy"===e.type;this._newParameters.strength.value=t?e.scattering:0,this._newParameters.amount.value=s?1:0,"foggy"!==e.type&&"snowy"!==e.type||(this._newParameters.fogBrightness=G),"rainy"===e.type&&(this._newParameters.fogBrightness=z),this._fadeFactor>=1&&this._oldParameters.copy(this._newParameters),this.requestRender(2)}get strength(){return this._parameters.strength.value*this._heightFade}get amount(){return this._parameters.amount.value*this._heightFade}get _heightFade(){const e=p(this.bindParameters.camera.eye);return 1-t(x,T,Math.abs(e-this._ellipsoid.radius))}precompile(){this._update(),this._passParameters.amount>0&&(super.precompile(),this.techniques.precompile(w,this._configuration))}get _needsEmissionBlur(){return this._configuration.hasEmissive}render(){const e=this.input,t=this._getTechnique();if(!t)return e;this._passParameters.emission=e.obtainAttachment(j),this._passParameters.inputScale=this._passParameters.emission?.attachment.descriptor.internalFormat===C.RGBA8?B:1;const s=this.renderingContext;this._passParameters.emission&&(this._renderEmissionMipMap(),this._configuration.useFloatBlend?(e.acquireColor(j,8,"emissive"),s.clearBuffer(1,d)):(this._passParameters.color=e.obtainAttachment(E),e.acquireColor(E,5),e.acquireColor(j,8,"emissive")));const a=e.getAttachment(q);return e.attachDepth(null),s.bindFramebuffer(e.fbo),s.bindTechnique(t,this.bindParameters,this._passParameters),s.screen.draw(),this._passParameters.color=r(this._passParameters.color),this._passParameters.emission=r(this._passParameters.emission),this._passParameters.mipmapTexture=r(this._passParameters.mipmapTexture),e.attachDepth(a),this.fboCache.debugCallback?.("fog-color",e.fbo),e}_getTechnique(){return this.renders?this.techniques.get(w,this._configuration):null}get renders(){return this._update(),this._passParameters.amount>0}_update(){const e=this.bindParameters.camera;m(R,e.eye);const t=Math.max(0,l(R,this.bindParameters.lighting.mainLight.direction)),s=this._parameters.fogBrightness;u(this._passParameters.fogColor,k,s),u(S,k,.1*s),c(this._passParameters.fogColor,S,this._passParameters.fogColor,t);const r=p(e.eye);this._passParameters.atmosphereC=r**2-this._atmosphereRadius**2,this._passParameters.amount=this.amount,this._passParameters.strength=this._passParameters.scattering=this.strength,this._configuration.hasEmissive=this.bindParameters.hasEmission,this._configuration.useFloatBlend=this.bindParameters.useFloatBlend.value}get test(){return{parameters:this._passParameters}}};A=e([n("esri.views.3d.webgl-engine.effects.fog.Fog")],A);class M{constructor(){this.fogBrightness=0,this.strength=o(0),this.amount=o(0)}copy(e){this.fogBrightness=e.fogBrightness,this.strength.value=e.strength.value,this.amount.value=e.amount.value}lerp(e,t,r){this.fogBrightness=s(e.fogBrightness,t.fogBrightness,r),this.strength.value=s(e.strength.value,t.strength.value,r),this.amount.value=s(e.amount.value,t.amount.value,r)}}const R=g(),S=g(),U=_(3e-4,3e-4,3e-4),k=g();h(k,v,P),h(k,k,U),m(k,k);const D=k.reduce((e,t)=>e+t,0)/3,z=.5/D,G=1.5/D;export{A as Fog,M as FogParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{releaseMaybe as i}from"../../../../core/maybe.js";import{signal as t}from"../../../../core/signal.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import e from"../../webgl/RenderCamera.js";import{isColor as h}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as n}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as r}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as o}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as a}from"../lighting/SceneLighting.js";class l{constructor(i,t){this.width=i,this.height=t}}const g=5e5;class c{constructor(i){this.shadowMap=i,this.output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this._emissions=t(0),this.transparentWithoutDepthEmissionDimmingPass=!1,this.useFloatBlend=t(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.frameRendererTarget=0,this.overlayStretch=1,this.viewshedEnabled=!1,this.laserlinesEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this.renderingShadowAnalysisMap=!1,this._camera=t(new e),this._inverseViewport=s(),this._oldLighting=new a,this._newLighting=new a,this._fadedLighting=new a,this._lighting=this._newLighting,this.screenSpaceReflections=new o,this.reprojection=new r,this.highlights=new Array,this.highlightMixOrigin=s(),this.highlightMixTexture=null,this.globalIlluminationEnabled=!1,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new n,this.hasShadowHighlights=!1}destroy(){this._camera=this.contentCamera=null,this.mainDepth=this.overlay=this.ssao=this.shadowHighlight=null,this.depth=i(this.depth),this.shadowMap?.dispose()}get emissions(){return this._emissions.value}set emissions(i){this._emissions.value=i}get hasEmission(){switch(this.output){case 0:return this.hasOpaqueEmission;case 1:case 2:return this.hasTransparentEmission;default:return!1}}get hasOpaqueEmission(){return 1===this.emissions||3===this.emissions}get hasTransparentEmission(){return 2===this.emissions||3===this.emissions}get hasEmissions(){return 0!==this.emissions}get camera(){return this._camera.value}set camera(i){this._camera.value=i,this._inverseViewport[0]=1/i.fullViewport[2],this._inverseViewport[1]=1/i.fullViewport[3]}get enableOITOffset(){return this.camera.relativeElevation<g}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(i,t,s,e){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=t,this._newLighting.globalFactor=s,this._newLighting.set(i),this._oldLighting.updateLegacy(),1===e&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return h(this.output)&&this.screenSpaceReflections.enabled&&null!=this.reprojection.lastFrameColor}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(i){i&&(i.name="geometry depth"),this._depth=i}get occluder(){return 10===this.slot||11===this.slot?this.slot:null}}export{c as BindParameters,l as ViewportSize};
2
+ import{releaseMaybe as i}from"../../../../core/maybe.js";import{signal as t}from"../../../../core/signal.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import e from"../../webgl/RenderCamera.js";import{isColor as h}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as n}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as r}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as a}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as o}from"../lighting/SceneLighting.js";class l{constructor(i,t){this.width=i,this.height=t}}const g=5e5;class c{constructor(i){this.shadowMap=i,this.output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this._emissions=t(0),this.transparentWithoutDepthEmissionDimmingPass=!1,this.useFloatBlend=t(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.frameRendererTarget=0,this.overlayStretch=1,this.viewshedEnabled=!1,this.laserlinesEnabled=!1,this.shadowAnalysisEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this.renderingShadowAnalysisMap=!1,this._camera=t(new e),this._inverseViewport=s(),this._oldLighting=new o,this._newLighting=new o,this._fadedLighting=new o,this._lighting=this._newLighting,this.screenSpaceReflections=new a,this.reprojection=new r,this.highlights=new Array,this.highlightMixOrigin=s(),this.highlightMixTexture=null,this.globalIlluminationEnabled=!1,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new n,this.hasShadowHighlights=!1}destroy(){this._camera=this.contentCamera=null,this.mainDepth=this.overlay=this.ssao=this.shadowHighlight=null,this.depth=i(this.depth),this.shadowMap?.dispose()}get emissions(){return this._emissions.value}set emissions(i){this._emissions.value=i}get hasEmission(){switch(this.output){case 0:return this.hasOpaqueEmission;case 1:case 2:return this.hasTransparentEmission;default:return!1}}get hasOpaqueEmission(){return 1===this.emissions||3===this.emissions}get hasTransparentEmission(){return 2===this.emissions||3===this.emissions}get hasEmissions(){return 0!==this.emissions}get camera(){return this._camera.value}set camera(i){this._camera.value=i,this._inverseViewport[0]=1/i.fullViewport[2],this._inverseViewport[1]=1/i.fullViewport[3]}get enableOITOffset(){return this.camera.relativeElevation<g}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(i,t,s,e){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=t,this._newLighting.globalFactor=s,this._newLighting.set(i),this._oldLighting.updateLegacy(),1===e&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return h(this.output)&&this.screenSpaceReflections.enabled&&null!=this.reprojection.lastFrameColor}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(i){i&&(i.name="geometry depth"),this._depth=i}get occluder(){return 10===this.slot||11===this.slot?this.slot:null}}export{c as BindParameters,l as ViewportSize};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as s}from"tslib";import{releaseMaybe as e}from"../../../../core/maybe.js";import{watch as t,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{length as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{RenderNodeOutput as m}from"../../webgl.js";import{BlurEmission as n}from"../effects/glow/BlurEmission.js";import{E as p,a as c}from"../../../../chunks/EmissionComposite.glsl.js";import{EmissionCompositeTechnique as h}from"./EmissionCompositeTechnique.js";import{ColorAttachment1 as u,ColorAttachment0 as l}from"../../../webgl/enums.js";let d=class extends n{constructor(){super(...arguments),this.produces=m.COMPOSITE,this.consumes={required:[m.COMPOSITE]},this._configuration=new p,this._passParameters=new c}initialize(){this.addHandles([t(()=>0!==this.bindParameters.emissions,s=>this.produces=s?m.COMPOSITE:"disabled",r)])}precompile(){0!==this.bindParameters.emissions&&(this._configuration.applyBlur=!this.view.stage.renderView.fog?.renders&&this._hasBlur,super.precompile(),this._configuration.useFloatBlend=this.bindParameters.useFloatBlend.value,this.techniques.precompile(h,this._configuration))}get _needsEmissionBlur(){return this._configuration.applyBlur}render(){const s=this.input,t=s.getAttachment(u);if(!t?.attachment)return s;const r=a(this.bindParameters.camera.eye);this._passParameters.atmosphereC=r**2-this._atmosphereRadius**2,this._passParameters.color=s.getAttachment(l)?.attachment,this._passParameters.emission=t,this._configuration.applyBlur&&this._renderEmissionMipMap();const i=this.renderingContext,o=this.techniques.get(h,this._configuration),m=this.acquireOutputFramebuffer();return i.clear(16384),i.bindTechnique(o,this.bindParameters,this._passParameters),i.screen.draw(),this._passParameters.mipmapTexture=e(this._passParameters.mipmapTexture),m.moveAttachments(s),m}};s([i()],d.prototype,"produces",void 0),s([i()],d.prototype,"consumes",void 0),d=s([o("esri.views.3d.webgl-engine.lib.EmissionComposite")],d);export{d as EmissionComposite};
2
+ import{__decorate as e}from"tslib";import{releaseMaybe as s}from"../../../../core/maybe.js";import{watch as t,syncAndInitial as i}from"../../../../core/reactiveUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{length as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{RenderNodeOutput as n}from"../../webgl.js";import{BlurEmission as m}from"../effects/glow/BlurEmission.js";import{E as p,a as c}from"../../../../chunks/EmissionComposite.glsl.js";import{EmissionCompositeTechnique as h}from"./EmissionCompositeTechnique.js";import{ColorAttachment1 as u,ColorAttachment0 as l}from"../../../webgl/enums.js";let d=class extends m{constructor(){super(...arguments),this.produces=n.COMPOSITE,this.consumes={required:[n.COMPOSITE]},this._configuration=new p,this._passParameters=new c}initialize(){this.addHandles([t(()=>0!==this.bindParameters.emissions,e=>this.produces=e?n.COMPOSITE:"disabled",i)])}precompile(){0!==this.bindParameters.emissions&&(this._configuration.applyBlur=!this.view.stage.renderView.fog?.renders&&this._hasBlur,super.precompile(),this._configuration.useFloatBlend=this.bindParameters.useFloatBlend.value,this.techniques.precompile(h,this._configuration))}get _needsEmissionBlur(){return this._configuration.applyBlur}render(){const e=this.input,t=e.getAttachment(u);if(!t?.attachment)return e;const i=a(this.bindParameters.camera.eye);this._passParameters.atmosphereC=i**2-this._atmosphereRadius**2,this._passParameters.color=e.getAttachment(l)?.attachment,this._passParameters.emission=t,this._passParameters.scattering=this._configuration.applyBlur&&this.view.environment.weatherAvailable?this.view.stage.renderView.fog?.strength??this.view.environment.weather.scattering:0,this._configuration.applyBlur&&this._renderEmissionMipMap();const r=this.renderingContext,o=this.techniques.get(h,this._configuration),n=this.acquireOutputFramebuffer();return r.clear(16384),r.bindTechnique(o,this.bindParameters,this._passParameters),r.screen.draw(),this._passParameters.mipmapTexture=s(this._passParameters.mipmapTexture),n.moveAttachments(e),n}};e([r()],d.prototype,"produces",void 0),e([r()],d.prototype,"consumes",void 0),d=e([o("esri.views.3d.webgl-engine.lib.EmissionComposite")],d);export{d as EmissionComposite};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as i,subclass as t}from"../../../../core/accessorSupport/decorators.js";import{InternalRenderCategory as r}from"../../webgl.js";import s from"../../webgl/RenderNode.js";import{prepareGaussianSplatPerspectiveParameters as a,canRenderGaussianSplats as n}from"./GaussianSplatRenderUtils.js";import{GaussianSplatDepthTechnique as o}from"../shaders/GaussianSplatDepthTechnique.js";import{GaussianSplatPassParameters as l}from"../shaders/GaussianSplatPassParameters.js";import{GaussianSplatTechniqueConfiguration as d}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{PrimitiveType as h}from"../../../webgl/enums.js";let p=class extends s{constructor(e){super(e),this.consumes={required:[r.GAUSSIAN_SPLAT_DEPTH]},this.produces=r.GAUSSIAN_SPLAT_DEPTH,this.layerView=null,this._passParameters=new l,this._configuration=new d(e.view.state.isGlobal)}precompile(){this._canRender&&(this._updateConfiguration(),this.techniques.precompile(o,this._configuration))}render(){const e=this.bindRenderTarget();if(this.layerView.fadeHelper.updateForFrame(this.view.stage.renderView.renderer.renderContext.time),!this._canRender)return e;this._updateConfiguration(),a(this._passParameters,this.layerView,this.bindParameters.camera);const i=this.techniques.get(o,this._configuration);return this.renderingContext.bindTechnique(i,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(h.TRIANGLE_STRIP,0,4,this.layerView.data.visibleGaussians),e}get _canRender(){return n(this.layerView.data)}_updateConfiguration(){this._configuration.preciseDepth=this.bindParameters.laserlinesEnabled,this._configuration.fadingEnabled=this.layerView.fadeHelper.fadingEnabled,this._configuration.clippingEnabled=null!=this.layerView.clippingBox,this._configuration.hasSlicePlane=this.layerView.slicePlaneEnabled&&null!=this.bindParameters.slicePlane,this._configuration.writeNormals=4===this.bindParameters.output}};e([i()],p.prototype,"consumes",void 0),e([i()],p.prototype,"produces",void 0),e([i({constructOnly:!0})],p.prototype,"layerView",void 0),p=e([t("esri.views.3d.webgl-engine.lib.GaussianSplatDepthRenderer")],p);export{p as GaussianSplatDepthRenderer};
2
+ import{__decorate as e}from"tslib";import{property as i,subclass as t}from"../../../../core/accessorSupport/decorators.js";import{InternalRenderCategory as r}from"../../webgl.js";import s from"../../webgl/RenderNode.js";import{prepareGaussianSplatPerspectiveParameters as a,canRenderGaussianSplats as n,requiresPreciseDepth as o}from"./GaussianSplatRenderUtils.js";import{GaussianSplatDepthTechnique as l}from"../shaders/GaussianSplatDepthTechnique.js";import{GaussianSplatPassParameters as d}from"../shaders/GaussianSplatPassParameters.js";import{GaussianSplatTechniqueConfiguration as h}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{PrimitiveType as p}from"../../../webgl/enums.js";let u=class extends s{constructor(e){super(e),this.consumes={required:[r.GAUSSIAN_SPLAT_DEPTH]},this.produces=r.GAUSSIAN_SPLAT_DEPTH,this.layerView=null,this._passParameters=new d,this._configuration=new h(e.view.state.isGlobal)}precompile(){this._canRender&&(this._updateConfiguration(),this.techniques.precompile(l,this._configuration))}render(){const e=this.bindRenderTarget();if(this.layerView.fadeHelper.updateForFrame(this.view.stage.renderView.renderer.renderContext.time),!this._canRender)return e;this._updateConfiguration(),a(this._passParameters,this.layerView,this.bindParameters.camera);const i=this.techniques.get(l,this._configuration);return this.renderingContext.bindTechnique(i,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(p.TRIANGLE_STRIP,0,4,this.layerView.data.visibleGaussians),e}get _canRender(){return n(this.layerView.data)}_updateConfiguration(){this._configuration.preciseDepth=o(this.bindParameters),this._configuration.fadingEnabled=this.layerView.fadeHelper.fadingEnabled,this._configuration.clippingEnabled=null!=this.layerView.clippingBox,this._configuration.hasSlicePlane=this.layerView.slicePlaneEnabled&&null!=this.bindParameters.slicePlane,this._configuration.writeNormals=4===this.bindParameters.output}};e([i()],u.prototype,"consumes",void 0),e([i()],u.prototype,"produces",void 0),e([i({constructOnly:!0})],u.prototype,"layerView",void 0),u=e([t("esri.views.3d.webgl-engine.lib.GaussianSplatDepthRenderer")],u);export{u as GaussianSplatDepthRenderer};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{property as i,subclass as t}from"../../../../core/accessorSupport/decorators.js";import{InternalRenderCategory as r}from"../../webgl.js";import s from"../../webgl/RenderNode.js";import{prepareGaussianSplatPerspectiveParameters as a,canRenderGaussianSplats as n,requiresPreciseDepth as o}from"./GaussianSplatRenderUtils.js";import{GaussianSplatDepthTechnique as l}from"../shaders/GaussianSplatDepthTechnique.js";import{GaussianSplatPassParameters as d}from"../shaders/GaussianSplatPassParameters.js";import{GaussianSplatTechniqueConfiguration as p}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{PrimitiveType as h}from"../../../webgl/enums.js";let u=class extends s{constructor(e){super(e),this.consumes={required:[r.GAUSSIAN_SPLAT_DEPTH]},this.produces=r.GAUSSIAN_SPLAT_DEPTH,this.layerView=null,this._passParameters=new d,this._configuration=new p(e.view.state.isGlobal)}precompile(){this._canRender&&(this._updateConfiguration(),this.techniques.precompile(l,this._configuration))}render(){const e=this.bindRenderTarget();if(this.layerView.fadeHelper.updateForFrame(this.view.stage.renderView.renderer.renderContext.time),!this._canRender)return e;this._updateConfiguration(),a(this._passParameters,this.layerView,this.bindParameters.camera);const i=this.techniques.get(l,this._configuration);return this.renderingContext.bindTechnique(i,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(h.TRIANGLE_STRIP,0,4,this.layerView.data.visibleGaussians),e}get _canRender(){return n(this.layerView.data)}_updateConfiguration(){this._configuration.preciseDepth=o(this.bindParameters),this._configuration.fadingEnabled=this.layerView.fadeHelper.fadingEnabled,this._configuration.clippingEnabled=null!=this.layerView.clippingBox,this._configuration.hasSlicePlane=this.layerView.slicePlaneEnabled&&null!=this.bindParameters.slicePlane,this._configuration.writeNormals=4===this.bindParameters.output}};e([i()],u.prototype,"consumes",void 0),e([i()],u.prototype,"produces",void 0),e([i({constructOnly:!0})],u.prototype,"layerView",void 0),u=e([t("esri.views.3d.webgl-engine.lib.GaussianSplatPrepassDepthRenderer")],u);export{u as GaussianSplatDepthRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as t}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as e,scale as a,floor as i,subtract as r,set as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{positiveInfinity as o}from"../../../../geometry/support/aaBoundingBox.js";function n(t){return t.visibleGaussians>0&&null!=t.orderTexture.texture&&null!=t.textureAtlas.texture&&null!=t.headerTexture.texture}function s(a,i,r){u(a,i,r,r.eye),a.splatFading=i.data.fadingTexture.texture;const{fullHeight:l,fullWidth:o}=r,n=Math.tan(.5*r.fovY),s=n/l*o;t(a.tanFov,s,n),a.focalLength=l/(2*n),e(a.origin,r.eye)}function u(t,e,n,s){const u=e.data;t.splatOrder=u.orderTexture.texture,t.splatAtlas=u.textureAtlas.texture,t.splatHeader=u.headerTexture.texture;const{fullHeight:c,fullWidth:x}=n,p=e.view.qualitySettings.gaussianSplat.minimumPixelRadius;t.minSplatRadius=p*Math.sqrt(x*c)/Math.sqrt(2073600),a(t.tileCameraPosition,s,1/m),i(t.tileCameraPosition,t.tileCameraPosition),a(t.cameraDelta,t.tileCameraPosition,m),r(t.cameraDelta,s,t.cameraDelta),t.slicePlaneLocalOrigin=s;const d=e.clippingBox||o,[g,f,h,v,C,P]=d,[M,T,y]=s;l(t.clipMinCameraRelative,g-M,f-T,h-y),l(t.clipMaxCameraRelative,v-M,C-T,P-y)}const m=2.048;export{n as canRenderGaussianSplats,m as gaussianSplatTileSize,s as prepareGaussianSplatPerspectiveParameters,u as prepareGaussianSplatRenderParameters};
2
+ import{set as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as t,scale as a,floor as i,subtract as r,set as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{positiveInfinity as n}from"../../../../geometry/support/aaBoundingBox.js";function s(e){return e.visibleGaussians>0&&null!=e.orderTexture.texture&&null!=e.textureAtlas.texture&&null!=e.headerTexture.texture}function o(e){return e.laserlinesEnabled||e.viewshedEnabled||e.shadowAnalysisEnabled}function u(e){return e.viewshedEnabled||e.shadowMap.ready}function d(a,i,r){m(a,i,r,r.eye),a.splatFading=i.data.fadingTexture.texture;const{fullHeight:l,fullWidth:n}=r,s=Math.tan(.5*r.fovY),o=s/l*n;e(a.tanFov,o,s),a.focalLength=l/(2*s),t(a.origin,r.eye)}function m(e,t,s,o){const u=t.data;e.splatOrder=u.orderTexture.texture,e.splatAtlas=u.textureAtlas.texture,e.splatHeader=u.headerTexture.texture;const{fullHeight:d,fullWidth:m}=s,x=t.view.qualitySettings.gaussianSplat.minimumPixelRadius;e.minSplatRadius=x*Math.sqrt(m*d)/Math.sqrt(2073600),a(e.tileCameraPosition,o,1/c),i(e.tileCameraPosition,e.tileCameraPosition),a(e.cameraDelta,e.tileCameraPosition,c),r(e.cameraDelta,o,e.cameraDelta),e.slicePlaneLocalOrigin=o;const p=t.clippingBox||n,[h,f,g,v,b,y]=p,[C,M,P]=o;l(e.clipMinCameraRelative,h-C,f-M,g-P),l(e.clipMaxCameraRelative,v-C,b-M,y-P)}const c=2.048;export{s as canRenderGaussianSplats,c as gaussianSplatTileSize,d as prepareGaussianSplatPerspectiveParameters,m as prepareGaussianSplatRenderParameters,u as requiresPreciseColorDepth,o as requiresPreciseDepth};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{watch as i}from"../../../../core/reactiveUtils.js";import{property as t,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{copy as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o,set as n,positiveInfinity as h,equals as l}from"../../../../geometry/support/aaBoundingBox.js";import{InternalRenderCategory as u}from"../../webgl.js";import{addWraparound as c}from"../../layers/i3s/I3SUtil.js";import p from"../../webgl/RenderNode.js";import{canRenderGaussianSplats as m,prepareGaussianSplatPerspectiveParameters as d}from"./GaussianSplatRenderUtils.js";import{G as _}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as g}from"../shaders/GaussianSplatCompositionTechnique.js";import{GaussianSplatCompositionTechniqueConfiguration as f}from"../shaders/GaussianSplatCompositionTechniqueConfiguration.js";import{G as C}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as b}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatPassParameters as P}from"../shaders/GaussianSplatPassParameters.js";import{GaussianSplatTechnique as S}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as q}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{ColorAttachment1 as v,DepthStencilAttachment as w,PrimitiveType as R}from"../../../webgl/enums.js";let x=class extends p{constructor(e){super(e),this.consumes={required:[u.GAUSSIAN_SPLAT]},this.produces=u.GAUSSIAN_SPLAT,this._slicePlaneEnabled=!1,this.layerView=null,this._passParameters=new P,this._compositionPassParameters=new _,this._depthCompositionPassParameters=new C,this._compositionConfiguration=new f,this._clipBox=o(),this._previousSortRequestCameraDirection=a(),this._cameraSortDirty=!1,this._tileCullingRevision=0,this._sortRequestDirectionEpsilon=.01,this._configuration=new q(e.view.state.isGlobal),n(this._clipBox,h)}async initialize(){this.addHandles([i(()=>this.view.state.camera,()=>this._onCameraChange()),i(()=>2===this.view.state.mode,e=>{e&&this._cameraSortDirty&&this._requestCameraSort(this.view.state.camera.ray.direction),this.requestRender(1)})])}precompile(){this._canRender&&(this._updateConfigurations(),this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=this.bindParameters.hasOpaqueEmission,this.techniques.precompile(S,this._configuration),this.techniques.precompile(g,this._compositionConfiguration),this.techniques.precompile(b))}render(){const e=this.input;if(this._updateConfigurations(),this._fadeHelper.updateForFrame(this.view.stage.renderView.renderer.renderContext.time),!this._canRender)return e;const i=e.getAttachment(v);this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=null!=i;const{fullWidth:t,fullHeight:s}=this.bindParameters.camera;this._prepareParameters();const r=this.renderingContext,a=this.fboCache,o=a.acquire(t,s,"gaussian color output"),n=e.getAttachment(w);o.attachDepth(n);const h=this.techniques.get(S,this._configuration);this._renderGaussianColorAndDepth(o,h);const l=a.acquire(t,s,this.produces);this._depthCompositionPassParameters.splatDepth=o.getTexture(v),l.attachDepth(e.getAttachment(w)),r.bindFramebuffer(l.fbo);const u=this.techniques.get(b);r.bindTechnique(u,this.bindParameters,this._depthCompositionPassParameters),r.screen.draw(),this._compositionPassParameters.color=e.getTexture(),this._compositionPassParameters.splatColor=o.getTexture(),i?(l.acquireColor(v,8,"emissive"),this._compositionPassParameters.emission=e.getTexture(v)):this._compositionPassParameters.emission=null,r.bindFramebuffer(l.fbo);const c=this.techniques.get(g,this._compositionConfiguration);return r.bindTechnique(c,this.bindParameters,this._compositionPassParameters),r.screen.draw(),o.release(),l}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this.requestRender(1))}set clippingBox(e){const i=e||h;this._hasSameClipBox(i)||(n(this._clipBox,i),this._tileCullingRevision=c(this._tileCullingRevision,1),this._data.requestSort(),this.requestRender(1))}get clippingBox(){return this._clippingEnabled?this._clipBox:null}get tileCullingRevision(){return this._tileCullingRevision}get _clippingEnabled(){return!l(this._clipBox,h,(e,i)=>e===i)}get _isIdle(){return 2===this.view.state.mode}get _data(){return this.layerView.data}get _canRender(){return m(this._data)}get _fadeHelper(){return this.layerView.fadeHelper}_updateConfigurations(){this._configuration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._configuration.fadingEnabled=this._fadeHelper.fadingEnabled,this._configuration.receiveShadows=this.bindParameters.shadowMap.ready,this._configuration.hasShadowHighlights=this._configuration.receiveShadows&&this.bindParameters.hasShadowHighlights,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this._slicePlaneEnabled&&null!=this.bindParameters.slicePlane}_onCameraChange(){this._tileCullingRevision=c(this._tileCullingRevision,1);const e=this.view.state.camera.ray.direction;this._cameraSortDirty=!0,(this._isIdle||this._shouldRequestSort(e))&&this._requestCameraSort(e)}_shouldRequestSort(e){return Math.abs(e[0]-this._previousSortRequestCameraDirection[0])>this._sortRequestDirectionEpsilon||Math.abs(e[1]-this._previousSortRequestCameraDirection[1])>this._sortRequestDirectionEpsilon||Math.abs(e[2]-this._previousSortRequestCameraDirection[2])>this._sortRequestDirectionEpsilon}_requestCameraSort(e){this._data.requestSort(),r(this._previousSortRequestCameraDirection,e),this._cameraSortDirty=!1}_prepareParameters(){d(this._passParameters,this.layerView,this.camera)}_hasSameClipBox(e){return l(this._clipBox,e,(e,i)=>e===i)}_renderGaussianColorAndDepth(e,i){const t=this.renderingContext;e.acquireColor(v,5,"gaussian depth output"),t.bindFramebuffer(e.fbo),t.setClearColor(0,0,0,0),t.clear(16384),this.renderingContext.bindTechnique(i,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(R.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}};e([t()],x.prototype,"consumes",void 0),e([t()],x.prototype,"produces",void 0),e([t({constructOnly:!0})],x.prototype,"layerView",void 0),x=e([s("esri.views.3d.webgl-engine.lib.GaussianSplatRenderer")],x);export{x as GaussianSplatRenderer};
2
+ import{__decorate as e}from"tslib";import{watch as i}from"../../../../core/reactiveUtils.js";import{property as t,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{copy as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o,set as n,positiveInfinity as h,equals as l}from"../../../../geometry/support/aaBoundingBox.js";import{InternalRenderCategory as u}from"../../webgl.js";import{addWraparound as c}from"../../layers/i3s/I3SUtil.js";import p from"../../webgl/RenderNode.js";import{canRenderGaussianSplats as m,requiresPreciseColorDepth as d,prepareGaussianSplatPerspectiveParameters as _}from"./GaussianSplatRenderUtils.js";import{G as g}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as f}from"../shaders/GaussianSplatCompositionTechnique.js";import{GaussianSplatCompositionTechniqueConfiguration as C}from"../shaders/GaussianSplatCompositionTechniqueConfiguration.js";import{G as b}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as P}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatPassParameters as S}from"../shaders/GaussianSplatPassParameters.js";import{GaussianSplatTechnique as q}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as v}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{ColorAttachment1 as w,DepthStencilAttachment as R,PrimitiveType as x}from"../../../webgl/enums.js";let y=class extends p{constructor(e){super(e),this.consumes={required:[u.GAUSSIAN_SPLAT]},this.produces=u.GAUSSIAN_SPLAT,this._slicePlaneEnabled=!1,this.layerView=null,this._passParameters=new S,this._compositionPassParameters=new g,this._depthCompositionPassParameters=new b,this._compositionConfiguration=new C,this._clipBox=o(),this._previousSortRequestCameraDirection=a(),this._cameraSortDirty=!1,this._tileCullingRevision=0,this._sortRequestDirectionEpsilon=.01,this._configuration=new v(e.view.state.isGlobal),n(this._clipBox,h)}async initialize(){this.addHandles([i(()=>this.view.state.camera,()=>this._onCameraChange()),i(()=>2===this.view.state.mode,e=>{e&&this._cameraSortDirty&&this._requestCameraSort(this.view.state.camera.ray.direction),this.requestRender(1)})])}precompile(){this._canRender&&(this._updateConfigurations(),this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=this.bindParameters.hasOpaqueEmission,this.techniques.precompile(q,this._configuration),this.techniques.precompile(f,this._compositionConfiguration),this.techniques.precompile(P))}render(){const e=this.input;if(this._updateConfigurations(),this._fadeHelper.updateForFrame(this.view.stage.renderView.renderer.renderContext.time),!this._canRender)return e;const i=e.getAttachment(w);this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=null!=i;const{fullWidth:t,fullHeight:s}=this.bindParameters.camera;this._prepareParameters();const r=this.renderingContext,a=this.fboCache,o=a.acquire(t,s,"gaussian color output"),n=e.getAttachment(R);o.attachDepth(n);const h=this.techniques.get(q,this._configuration);this._renderGaussianColorAndDepth(o,h);const l=a.acquire(t,s,this.produces);this._depthCompositionPassParameters.splatDepth=o.getTexture(w),l.attachDepth(e.getAttachment(R)),r.bindFramebuffer(l.fbo);const u=this.techniques.get(P);r.bindTechnique(u,this.bindParameters,this._depthCompositionPassParameters),r.screen.draw(),this._compositionPassParameters.color=e.getTexture(),this._compositionPassParameters.splatColor=o.getTexture(),i?(l.acquireColor(w,8,"emissive"),this._compositionPassParameters.emission=e.getTexture(w)):this._compositionPassParameters.emission=null,r.bindFramebuffer(l.fbo);const c=this.techniques.get(f,this._compositionConfiguration);return r.bindTechnique(c,this.bindParameters,this._compositionPassParameters),r.screen.draw(),o.release(),l}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this.requestRender(1))}set clippingBox(e){const i=e||h;this._hasSameClipBox(i)||(n(this._clipBox,i),this._tileCullingRevision=c(this._tileCullingRevision,1),this._data.requestSort(),this.requestRender(1))}get clippingBox(){return this._clippingEnabled?this._clipBox:null}get tileCullingRevision(){return this._tileCullingRevision}get _clippingEnabled(){return!l(this._clipBox,h,(e,i)=>e===i)}get _isIdle(){return 2===this.view.state.mode}get _data(){return this.layerView.data}get _canRender(){return m(this._data)}get _fadeHelper(){return this.layerView.fadeHelper}_updateConfigurations(){this._configuration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._configuration.fadingEnabled=this._fadeHelper.fadingEnabled,this._configuration.receiveShadows=this.bindParameters.shadowMap.ready,this._configuration.preciseDepth=d(this.bindParameters),this._configuration.hasShadowHighlights=this._configuration.receiveShadows&&this.bindParameters.hasShadowHighlights,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this._slicePlaneEnabled&&null!=this.bindParameters.slicePlane}_onCameraChange(){this._tileCullingRevision=c(this._tileCullingRevision,1);const e=this.view.state.camera.ray.direction;this._cameraSortDirty=!0,(this._isIdle||this._shouldRequestSort(e))&&this._requestCameraSort(e)}_shouldRequestSort(e){return Math.abs(e[0]-this._previousSortRequestCameraDirection[0])>this._sortRequestDirectionEpsilon||Math.abs(e[1]-this._previousSortRequestCameraDirection[1])>this._sortRequestDirectionEpsilon||Math.abs(e[2]-this._previousSortRequestCameraDirection[2])>this._sortRequestDirectionEpsilon}_requestCameraSort(e){this._data.requestSort(),r(this._previousSortRequestCameraDirection,e),this._cameraSortDirty=!1}_prepareParameters(){_(this._passParameters,this.layerView,this.camera)}_hasSameClipBox(e){return l(this._clipBox,e,(e,i)=>e===i)}_renderGaussianColorAndDepth(e,i){const t=this.renderingContext;e.acquireColor(w,5,"gaussian depth output"),t.bindFramebuffer(e.fbo),t.setClearColor(0,0,0,0),t.clear(16384),this.renderingContext.bindTechnique(i,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(x.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}};e([t()],y.prototype,"consumes",void 0),e([t()],y.prototype,"produces",void 0),e([t({constructOnly:!0})],y.prototype,"layerView",void 0),y=e([s("esri.views.3d.webgl-engine.lib.GaussianSplatRenderer")],y);export{y as GaussianSplatRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as i,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{set as t}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{InternalRenderCategory as r}from"../../webgl.js";import n from"../../webgl/RenderNode.js";import{canRenderGaussianSplats as o,prepareGaussianSplatRenderParameters as h}from"./GaussianSplatRenderUtils.js";import{gaussianSplatDepthPolicy as p}from"../shaders/GaussianSplatDepthPolicy.js";import{G as l}from"../../../../chunks/GaussianSplatShadow.glsl.js";import{GaussianSplatShadowTechnique as d}from"../shaders/GaussianSplatShadowTechnique.js";import{GaussianSplatTechniqueConfiguration as u}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{PrimitiveType as c}from"../../../webgl/enums.js";let m=class extends n{constructor(e){super(e),this.consumes={required:[r.SHADOWMAP]},this.produces=r.SHADOWMAP,this.layerView=null,this._passParameters=new l,this._cameraPosition=a(),this._configuration=new u(e.view.state.isGlobal)}precompile(){this._canRender&&(this._updateConfiguration(),this.techniques.precompile(d,this._configuration))}render(){const e=this.bindRenderTarget();return this._canRender&&this._render(),e}queryDepthRange(e){return this.layerView.suspended?null:this._data.queryVisibleTileDepthRange(e,this.layerView.clippingBox)}get _data(){return this.layerView.data}get _clippingEnabled(){return null!=this.layerView.clippingBox}get _canRender(){return!this.layerView.suspended&&o(this._data)}_render(){const e=this.techniques.get(d,this._configuration);this._prepareShadowParameters(this.bindParameters.camera),this.renderingContext.bindTechnique(e,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(c.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}_updateConfiguration(){this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this.layerView.slicePlaneEnabled&&null!=this.bindParameters.slicePlane,this._configuration.output=this.bindParameters.output}_prepareShadowParameters(e){const i=8===this.bindParameters.output?p.viewshed:this.bindParameters.renderingShadowAnalysisMap?p.accumulated:p.direct;this._passParameters.alphaCutoff=i.alphaCutoff,this._passParameters.depthBias=i.depthBias,this._updateShadowCameraPosition(e),h(this._passParameters,this.layerView,e,this._cameraPosition)}_updateShadowCameraPosition(e){const i=e.viewInverseTransposeMatrix;t(this._cameraPosition,i[3],i[7],i[11])}};e([i()],m.prototype,"consumes",void 0),e([i()],m.prototype,"produces",void 0),e([i({constructOnly:!0})],m.prototype,"layerView",void 0),m=e([s("esri.views.3d.webgl-engine.lib.GaussianSplatShadows")],m);export{m as GaussianSplatShadows};
2
+ import{__decorate as e}from"tslib";import{property as i,subclass as t}from"../../../../core/accessorSupport/decorators.js";import{invert as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{InternalRenderCategory as n}from"../../webgl.js";import o from"../../webgl/RenderNode.js";import{canRenderGaussianSplats as h,prepareGaussianSplatRenderParameters as p}from"./GaussianSplatRenderUtils.js";import{gaussianSplatDepthPolicy as l}from"../shaders/GaussianSplatDepthPolicy.js";import{G as d}from"../../../../chunks/GaussianSplatShadow.glsl.js";import{GaussianSplatShadowTechnique as u}from"../shaders/GaussianSplatShadowTechnique.js";import{GaussianSplatTechniqueConfiguration as c}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{PrimitiveType as m}from"../../../webgl/enums.js";let g=class extends o{constructor(e){super(e),this.consumes={required:[n.SHADOWMAP]},this.produces=n.SHADOWMAP,this.layerView=null,this._passParameters=new d,this._cameraPosition=r(),this._configuration=new c(e.view.state.isGlobal)}precompile(){this._canRender&&(this._updateConfiguration(),this.techniques.precompile(u,this._configuration))}render(){const e=this.bindRenderTarget();return this._canRender&&this._render(),e}queryDepthRange(e){return this.layerView.suspended?null:this._data.queryVisibleTileDepthRange(e,this.layerView.clippingBox)}get _data(){return this.layerView.data}get _clippingEnabled(){return null!=this.layerView.clippingBox}get _canRender(){return!this.layerView.suspended&&h(this._data)}_render(){this._updateConfiguration();const e=this.techniques.get(u,this._configuration);this._prepareShadowParameters(this.bindParameters.camera),this.renderingContext.bindTechnique(e,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(m.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}_updateConfiguration(){this._configuration.preciseDepth=!0,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this.layerView.slicePlaneEnabled&&null!=this.bindParameters.slicePlane,this._configuration.output=8===this.bindParameters.output?8:5}_prepareShadowParameters(e){s(this._passParameters.inverseProjectionMatrix,e.projectionMatrix);const i=8===this.bindParameters.output?l.viewshed:this.bindParameters.renderingShadowAnalysisMap?l.accumulated:l.direct;this._passParameters.alphaCutoff=i.alphaCutoff,this._passParameters.depthBias=i.depthBias,this._updateShadowCameraPosition(e),p(this._passParameters,this.layerView,e,this._cameraPosition)}_updateShadowCameraPosition(e){const i=e.viewInverseTransposeMatrix;a(this._cameraPosition,i[3],i[7],i[11])}};e([i()],g.prototype,"consumes",void 0),e([i()],g.prototype,"produces",void 0),e([i({constructOnly:!0})],g.prototype,"layerView",void 0),g=e([t("esri.views.3d.webgl-engine.lib.GaussianSplatShadows")],g);export{g as GaussianSplatShadows};