@arcgis/core 4.33.0-next.20250312 → 4.33.0-next.20250313

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 (102) hide show
  1. package/Basemap.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/025f8b72d7d8b5cccb0f.js +1 -0
  4. package/assets/esri/core/workers/chunks/{3ee2cf2db08164cde43c.js → 08bfceab05b5ea02bb4e.js} +73 -74
  5. package/assets/esri/core/workers/chunks/0e5c77d043ed4641556f.js +1 -0
  6. package/assets/esri/core/workers/chunks/10fc47b441ae49ef4db8.js +1 -0
  7. package/assets/esri/core/workers/chunks/{4263eee3247aaf4e64bf.js → 147e412de9972da16a1d.js} +1 -1
  8. package/assets/esri/core/workers/chunks/4908b36ef448bfe1f448.js +1 -0
  9. package/assets/esri/core/workers/chunks/6388fdacb434a266b039.js +314 -0
  10. package/assets/esri/core/workers/chunks/{2c227d97d00b3849f441.js → d459c790a3b89ac53d2d.js} +1 -1
  11. package/assets/esri/core/workers/chunks/fe6e7ac83cd2293d576e.js +1 -0
  12. package/chunks/ComponentShader.glsl.js +7 -8
  13. package/chunks/HighlightApply.glsl.js +27 -132
  14. package/chunks/{SingleHighlightBlur.glsl.js → HighlightBlur.glsl.js} +4 -4
  15. package/chunks/HighlightDownsample.glsl.js +8 -8
  16. package/chunks/HighlightToSingle.glsl.js +2 -2
  17. package/chunks/ShadowHighlight.glsl.js +5 -6
  18. package/chunks/Terrain.glsl.js +15 -16
  19. package/core/has.js +1 -1
  20. package/layers/support/layerUtils.js +1 -1
  21. package/package.json +1 -1
  22. package/support/revision.js +1 -1
  23. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  24. package/views/2d/engine/webgl/Painter.js +1 -1
  25. package/views/2d/engine/webgl/WorldExtentClipRenderer.js +1 -1
  26. package/views/2d/engine/webgl/effects/FeatureEffect.js +1 -1
  27. package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
  28. package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
  29. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  30. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  31. package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
  32. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  33. package/views/3d/environment/CloudsRenderer.js +1 -1
  34. package/views/3d/environment/EnvironmentManager.js +1 -1
  35. package/views/3d/environment/Fog.js +1 -1
  36. package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayer.js +1 -1
  37. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  38. package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
  39. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  40. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  41. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  42. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  43. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
  44. package/views/3d/layers/graphics/pipeline/featureData/processingUtils.js +1 -1
  45. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  46. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  47. package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
  48. package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
  49. package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
  50. package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
  51. package/views/3d/layers/graphics/pipeline/utils.js +1 -1
  52. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  53. package/views/3d/support/flowUtils.js +5 -0
  54. package/views/3d/terrain/OverlayRenderTargets.js +1 -1
  55. package/views/3d/terrain/OverlayRenderer.js +1 -1
  56. package/views/3d/terrain/TileRenderer.js +1 -1
  57. package/views/3d/webgl/ManagedFBO.js +1 -1
  58. package/views/3d/webgl/formats.js +1 -1
  59. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  60. package/views/3d/webgl-engine/core/shaderLibrary/HighlightCellGridScreenSpacePass.glsl.js +2 -2
  61. package/views/3d/webgl-engine/core/shaderLibrary/HighlightReadBitmap.glsl.js +3 -3
  62. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +7 -8
  63. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +18 -18
  64. package/views/3d/webgl-engine/core/shaderModules/UintTexture2DBindUniform.js +5 -0
  65. package/views/3d/webgl-engine/core/shaderModules/UintTexture2DDrawUniform.js +5 -0
  66. package/views/3d/webgl-engine/core/shaderModules/UintTexture2DPassUniform.js +5 -0
  67. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  68. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  69. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  70. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  71. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  72. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  73. package/views/3d/webgl-engine/effects/highlight/HighlightBlurTechnique.js +5 -0
  74. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  75. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  76. package/views/3d/webgl-engine/effects/transparency/OITBlendTechnique.js +1 -1
  77. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  78. package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
  79. package/views/3d/webgl-engine/lib/Program.js +1 -1
  80. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  81. package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +1 -1
  82. package/views/3d/webgl-engine/shaders/{SingleHighlightBlur.glsl.js → HighlightBlur.glsl.js} +1 -1
  83. package/views/3d/webgl-engine/shaders/HighlightDownsample.glsl.js +1 -1
  84. package/views/3d/webgl-engine/shaders/HighlightToSingle.glsl.js +1 -1
  85. package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
  86. package/views/support/imageReprojection.js +1 -1
  87. package/views/webgl/FramebufferObject.js +1 -1
  88. package/views/webgl/RenderingContext.js +1 -1
  89. package/views/webgl/ShaderBuilder.js +1 -1
  90. package/views/webgl/ShaderTranspiler.js +1 -1
  91. package/views/webgl/ValidatedTextureDescriptor.js +1 -1
  92. package/views/webgl/enums.js +1 -1
  93. package/assets/esri/core/workers/chunks/15fe629cd4da1bb2169f.js +0 -1
  94. package/assets/esri/core/workers/chunks/8196ff250c0de00104f7.js +0 -1
  95. package/assets/esri/core/workers/chunks/be883ebdbaf11647b718.js +0 -1
  96. package/assets/esri/core/workers/chunks/d0ad20548eb4786b7750.js +0 -314
  97. package/assets/esri/core/workers/chunks/d374d2a1487faee3672d.js +0 -1
  98. package/assets/esri/core/workers/chunks/dbdca19978fbee8dc106.js +0 -1
  99. package/chunks/SingleHighlightApply.glsl.js +0 -32
  100. package/views/3d/webgl-engine/effects/highlight/SingleHighlightApplyTechnique.js +0 -5
  101. package/views/3d/webgl-engine/effects/highlight/SingleHighlightBlurTechnique.js +0 -5
  102. package/views/3d/webgl-engine/shaders/SingleHighlightApply.glsl.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Evented.js";import"../../../core/has.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{watch as n,when as r,sync as o,syncAndInitial as s}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{h as l,c,m as g}from"../../../chunks/vec32.js";import{create as d,fromValues as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isLoadedOrLoadFor as p}from"../../../geometry/projection.js";import u from"../../../geometry/SpatialReference.js";import{projectPointToVector as _}from"../../../geometry/projection/projectPointToVector.js";import{getGCSForPlanet as v}from"../../../geometry/support/planetGCSUtils.js";import{isEarth as f}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as w}from"../../ViewingMode.js";import{EnvironmentRenderer as b}from"./EnvironmentRenderer.js";import{positionToTimezoneInfo as y}from"../support/earthUtils.js";import{ColorAndIntensity as P,computeColorAndIntensity as j,computeVirtualLightDirection as T,computeShadowsEnabled as L}from"../support/sunUtils.js";import{Update as E}from"../webgl-engine/lib/Update.js";import{MainLight as S,AmbientLight as G,FillLight as U}from"../webgl-engine/lighting/Lightsources.js";let H=class extends t.EventedAccessor{constructor(){super(),this._tmpLightParameters=new P,this._defaultLightParameters=new P,this._tmpDate=new Date,this._tmpTz={hours:0,minutes:0,seconds:0},this._viewHandlesKey="viewHandles",this._trackingEnabled=!1,this._mainLight=new S,this._ambientLight=new G,this._moonLight=new U,this._disableProjectionEngineAutoLoad=!1,this._disableWeather=!1,this._renderer=null,this._referencePositionGeographic=null,this._resetReferencePosition()}destroy(){this.disconnectView()}get _view(){return this._renderer?.view}get updating(){return!!this._renderer?.updating||!this._canProjectCameraPosition}get weatherEnabled(){return this._view?.environment.atmosphereEnabled&&!this._disableWeather&&this._view?.state?.viewingMode===w.Global&&f(this._view.spatialReference)}get _weatherAvailable(){return this.weatherEnabled&&this._renderer?.weatherAvailable}get referencePositionGeographic(){return this._referencePositionGeographic}get _canProjectCameraPosition(){const e=this._view?.stateManager?.camera?.position?.spatialReference??u.WGS84,t=v(e);return this._disableProjectionEngineAutoLoad||p(e,t)}connectView(e){if(this._renderer)return;this._renderer=new b({view:e});const t=()=>this._updateRenderParameters(),i=()=>this._cameraHandler();this.addHandles([n((()=>e.environment.lighting),(e=>this._updateLightingHandler(e)),o),n((()=>"virtual"!==e.environment.lighting.type?e.environment.lighting.date:null),(e=>this._lightingDateHandler(e)),o),n((()=>e.environment.lighting.directShadowsEnabled),t,o),n((()=>e.qualitySettings.ambientOcclusion),t,o),n((()=>e.qualitySettings.reflections),t,o),n((()=>e.spatialReference),(()=>this._resetReferencePosition(!0)),o),n((()=>[e.environment.weather.type,this.weatherEnabled]),(()=>this._updateLighting(null,E.FadeWithWeather)),o),n((()=>e.environment),(e=>e.setComputeWeatherAvailable((()=>this._weatherAvailable))),s),n((()=>e.viewingMode),(()=>this._resetReferencePosition(!0)),s),n((()=>"virtual"!==e.environment.lighting.type&&e.environment.lighting.cameraTrackingEnabled),(e=>this._updateCameraTracking(e)),s),n((()=>e.state.camera),i,s),r((()=>this._canProjectCameraPosition),i,o)],this._viewHandlesKey),this._updateRenderParameters(),this._updateLighting(),this._cameraHandler(),this.notifyChange("updating")}disconnectView(){this.removeHandles(this._viewHandlesKey),this._resetReferencePosition(),this._renderer=i(this._renderer)}_updateLightingHandler(e){this._updateCameraTracking("virtual"!==e.type&&e.cameraTrackingEnabled),this._lightingDateHandler("virtual"!==e.type?e.date:null),this._updateRenderParameters()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{const e=this._view.environment.lighting;"virtual"!==e?.type&&(e.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){const t=this._view.environment.lighting;if("virtual"!==t?.type){if(e){if(!t.positionTimezoneInfo.autoUpdated&&(this._preupdateTracking(e),null!=this._referencePositionGeographic)){const e=y(this._referencePositionGeographic,this._tmpTz);null!=e&&(t.autoUpdate(null,e),this._trackingEnabled&&(t.positionTimezoneInfo.autoUpdated=!0))}this._updateLighting(e)}}else this._updateLighting()}_preupdateTracking(e){!this._trackingEnabled&&"virtual"!==this._view.environment.lighting.type&&this._view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){const t=this._view;if(!t.ready)return;const i=t.stateManager.camera;if(!i)return;const{position:n}=i,r=n.spatialReference??u.WGS84,o=v(r),s=this._referencePositionGeographic??d();if(!_(n,s,o))return this._referencePositionGeographic=null,void this._updateLighting();this._referencePositionGeographic=s,this.notifyChange("referencePositionGeographic"),this._autoUpdateTimezone(s,e)||this._updateLighting(e)}_updateLighting(e,t=E.Immediate){const i=this._view,{lighting:n}=i.environment,r="virtual"===n.type,o=this._referencePositionGeographic,s=null!=o?this._tmpLightParameters:this._defaultLightParameters;if(o){e??=r?null:n.date;const t=this._weatherAvailable?i.environment.weather.type:"disabled";j(e,o,i.state.viewingMode,t,i.state.camera,s)}else r&&T(i.state.camera,i.state.viewingMode,s.direct.directionToLightSource);const a=this._mainLight,h=s.direct;l(a.intensity,h.color,h.intensity*Math.PI),c(a.direction,h.directionToLightSource),a.specularStrength=s.specularStrength,a.environmentStrength=s.environmentStrength;const d=this._ambientLight;l(d.intensity,s.ambient.color,s.ambient.intensity);const m=this._moonLight;g(m.intensity,C,R,s.globalFactor);const p=(1-.5*s.globalFactor)*(1-.4*s.noonFactor*(1-s.globalFactor));l(m.intensity,m.intensity,p),c(m.direction,h.directionToLightSource),this._view._stage?.renderer.updateLighting([a,d,m],s.noonFactor,s.globalFactor,this._weatherAvailable?t:E.Immediate),this._updateRenderParameters()}_autoUpdateTimezone(e,t=null){if("virtual"===this._view.environment.lighting.type||!this._view.environment.lighting.cameraTrackingEnabled||null==e)return!1;const i=this._tmpDate;i.setTime((t||this._view.environment.lighting.date).getTime());const n=y(e,this._tmpTz);if(null==n)return!1;let r=this._view.environment.lighting.positionTimezoneInfo;if(r.autoUpdated){if(r.hours===n.hours&&r.minutes===n.minutes&&r.seconds===n.seconds)return!1}else r=n;const o=i.getUTCHours()-(n.hours-r.hours),s=i.getUTCMinutes()-(n.minutes-r.minutes),a=i.getUTCSeconds()-(n.seconds-r.seconds);return i.setUTCHours(o),i.setUTCMinutes(s),i.setUTCSeconds(a),!t&&this._view.environment.lighting.autoUpdate(i,n)}_updateRenderParameters(){const e=this._view._stage;if(!e)return;const t=null==this._referencePositionGeographic||L(this._referencePositionGeographic[2],this._view.state.viewingMode);e.renderer.setParameters({shadowMap:this._view.environment.lighting.directShadowsEnabled&&t,environment:this._view.environment,weatherVisible:this._weatherAvailable,qualitySettings:this._view.qualitySettings})}_resetReferencePosition(e=!1){this._referencePositionGeographic=null,e&&this._cameraHandler()}get test(){}};e([a({type:Boolean,readOnly:!0})],H.prototype,"updating",null),e([a()],H.prototype,"_disableProjectionEngineAutoLoad",void 0),e([a()],H.prototype,"_disableWeather",void 0),e([a()],H.prototype,"weatherEnabled",null),e([a()],H.prototype,"_weatherAvailable",null),e([a()],H.prototype,"referencePositionGeographic",null),e([a()],H.prototype,"_renderer",void 0),e([a()],H.prototype,"_referencePositionGeographic",void 0),e([a()],H.prototype,"_canProjectCameraPosition",null),H=e([h("esri.views.3d.environment.EnvironmentManager")],H);const C=m(.22,.22,.33),R=m(.22,.22,.22);export{H as EnvironmentManager};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Evented.js";import"../../../core/has.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{watch as n,when as r,sync as o,syncAndInitial as s}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{h as l,c,m as g}from"../../../chunks/vec32.js";import{create as m,fromValues as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isLoadedOrLoadFor as d}from"../../../geometry/projection.js";import u from"../../../geometry/SpatialReference.js";import{projectPointToVector as _}from"../../../geometry/projection/projectPointToVector.js";import{getGCSForPlanet as v}from"../../../geometry/support/planetGCSUtils.js";import{isEarth as f}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as w}from"../../ViewingMode.js";import{EnvironmentRenderer as y}from"./EnvironmentRenderer.js";import{positionToTimezoneInfo as b}from"../support/earthUtils.js";import{ColorAndIntensity as P,computeColorAndIntensity as T,computeVirtualLightDirection as j,computeShadowsEnabled as L}from"../support/sunUtils.js";import{Update as S}from"../webgl-engine/lib/Update.js";import{MainLight as G,AmbientLight as U,FillLight as E}from"../webgl-engine/lighting/Lightsources.js";let H=class extends t.EventedAccessor{constructor(){super(),this._tmpLightParameters=new P,this._defaultLightParameters=new P,this._tmpDate=new Date,this._tmpTz={hours:0,minutes:0,seconds:0},this._viewHandlesKey="viewHandles",this._trackingEnabled=!1,this._mainLight=new G,this._ambientLight=new U,this._moonLight=new E,this._disableWeather=!1,this._renderer=null,this._referencePositionGeographic=null,this._resetReferencePosition()}destroy(){this.disconnectView()}get _view(){return this._renderer?.view}get updating(){return!!this._renderer?.updating||!this._canProjectCameraPosition}get weatherEnabled(){return this._view?.environment.atmosphereEnabled&&!this._disableWeather&&this._view?.state?.viewingMode===w.Global&&f(this._view.spatialReference)}get _weatherAvailable(){return this.weatherEnabled&&this._renderer?.weatherAvailable}get referencePositionGeographic(){return this._referencePositionGeographic}get _canProjectCameraPosition(){const e=this._view?.stateManager?.camera?.position?.spatialReference??u.WGS84,t=v(e);return d(e,t)}connectView(e){if(this._renderer)return;this._renderer=new y({view:e});const t=()=>this._updateRenderParameters(),i=()=>this._cameraHandler();this.addHandles([n((()=>e.environment.lighting),(e=>this._updateLightingHandler(e)),o),n((()=>"virtual"!==e.environment.lighting.type?e.environment.lighting.date:null),(e=>this._lightingDateHandler(e)),o),n((()=>e.environment.lighting.directShadowsEnabled),t,o),n((()=>e.qualitySettings.ambientOcclusion),t,o),n((()=>e.qualitySettings.reflections),t,o),n((()=>e.spatialReference),(()=>this._resetReferencePosition(!0)),o),n((()=>[e.environment.weather.type,this.weatherEnabled]),(()=>this._updateLighting(null,S.FadeWithWeather)),o),n((()=>e.environment),(e=>e.setComputeWeatherAvailable((()=>this._weatherAvailable))),s),n((()=>e.viewingMode),(()=>this._resetReferencePosition(!0)),s),n((()=>"virtual"!==e.environment.lighting.type&&e.environment.lighting.cameraTrackingEnabled),(e=>this._updateCameraTracking(e)),s),n((()=>e.state.camera),i,s),r((()=>this._canProjectCameraPosition),i,o)],this._viewHandlesKey),this._updateRenderParameters(),this._updateLighting(),this._cameraHandler(),this.notifyChange("updating")}disconnectView(){this.removeHandles(this._viewHandlesKey),this._resetReferencePosition(),this._renderer=i(this._renderer)}_updateLightingHandler(e){this._updateCameraTracking("virtual"!==e.type&&e.cameraTrackingEnabled),this._lightingDateHandler("virtual"!==e.type?e.date:null),this._updateRenderParameters()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{const e=this._view.environment.lighting;"virtual"!==e?.type&&(e.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){const t=this._view.environment.lighting;if("virtual"!==t?.type){if(e){if(!t.positionTimezoneInfo.autoUpdated&&(this._preupdateTracking(e),null!=this._referencePositionGeographic)){const e=b(this._referencePositionGeographic,this._tmpTz);null!=e&&(t.autoUpdate(null,e),this._trackingEnabled&&(t.positionTimezoneInfo.autoUpdated=!0))}this._updateLighting(e)}}else this._updateLighting()}_preupdateTracking(e){!this._trackingEnabled&&"virtual"!==this._view.environment.lighting.type&&this._view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){const t=this._view;if(!t.ready)return;const i=t.stateManager.camera;if(!i)return;const{position:n}=i,r=n.spatialReference??u.WGS84,o=v(r),s=this._referencePositionGeographic??m();if(!_(n,s,o))return this._referencePositionGeographic=null,void this._updateLighting();this._referencePositionGeographic=s,this.notifyChange("referencePositionGeographic"),this._autoUpdateTimezone(s,e)||this._updateLighting(e)}_updateLighting(e,t=S.Immediate){const i=this._view,{lighting:n}=i.environment,r="virtual"===n.type,o=this._referencePositionGeographic,s=null!=o?this._tmpLightParameters:this._defaultLightParameters;if(o){e??=r?null:n.date;const t=this._weatherAvailable?i.environment.weather.type:"disabled";T(e,o,i.state.viewingMode,t,i.state.camera,s)}else r&&j(i.state.camera,i.state.viewingMode,s.direct.directionToLightSource);const a=this._mainLight,h=s.direct;l(a.intensity,h.color,h.intensity*Math.PI),c(a.direction,h.directionToLightSource),a.specularStrength=s.specularStrength,a.environmentStrength=s.environmentStrength;const m=this._ambientLight;l(m.intensity,s.ambient.color,s.ambient.intensity);const p=this._moonLight;g(p.intensity,C,R,s.globalFactor);const d=(1-.5*s.globalFactor)*(1-.4*s.noonFactor*(1-s.globalFactor));l(p.intensity,p.intensity,d),c(p.direction,h.directionToLightSource),this._view._stage?.renderer.updateLighting([a,m,p],s.noonFactor,s.globalFactor,this._weatherAvailable?t:S.Immediate),this._updateRenderParameters()}_autoUpdateTimezone(e,t=null){if("virtual"===this._view.environment.lighting.type||!this._view.environment.lighting.cameraTrackingEnabled||null==e)return!1;const i=this._tmpDate;i.setTime((t||this._view.environment.lighting.date).getTime());const n=b(e,this._tmpTz);if(null==n)return!1;let r=this._view.environment.lighting.positionTimezoneInfo;if(r.autoUpdated){if(r.hours===n.hours&&r.minutes===n.minutes&&r.seconds===n.seconds)return!1}else r=n;const o=i.getUTCHours()-(n.hours-r.hours),s=i.getUTCMinutes()-(n.minutes-r.minutes),a=i.getUTCSeconds()-(n.seconds-r.seconds);return i.setUTCHours(o),i.setUTCMinutes(s),i.setUTCSeconds(a),!t&&this._view.environment.lighting.autoUpdate(i,n)}_updateRenderParameters(){const e=this._view._stage;if(!e)return;const t=null==this._referencePositionGeographic||L(this._referencePositionGeographic[2],this._view.state.viewingMode);e.renderer.setParameters({shadowMap:this._view.environment.lighting.directShadowsEnabled&&t,environment:this._view.environment,weatherVisible:this._weatherAvailable,qualitySettings:this._view.qualitySettings})}_resetReferencePosition(e=!1){this._referencePositionGeographic=null,e&&this._cameraHandler()}get test(){}};e([a({type:Boolean,readOnly:!0})],H.prototype,"updating",null),e([a()],H.prototype,"_disableWeather",void 0),e([a()],H.prototype,"weatherEnabled",null),e([a()],H.prototype,"_weatherAvailable",null),e([a()],H.prototype,"referencePositionGeographic",null),e([a()],H.prototype,"_renderer",void 0),e([a()],H.prototype,"_referencePositionGeographic",void 0),e([a()],H.prototype,"_canProjectCameraPosition",null),H=e([h("esri.views.3d.environment.EnvironmentManager")],H);const C=p(.22,.22,.33),R=p(.22,.22,.22);export{H as EnvironmentManager};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{lerp as t,smoothstep as s}from"../../../core/mathUtils.js";import{watch as r,syncAndInitial as a}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{c as o,n,f as h,h as m,m as p,l as c}from"../../../chunks/vec32.js";import{create as d,fromValues as l}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as g}from"../webgl.js";import{F as u}from"../../../chunks/Fog.glsl.js";import{FogTechnique as f}from"./FogTechnique.js";import{heightLimit as w}from"./weather.js";import{TransparentEnvironment as P}from"../webgl-engine/effects/TransparentEnvironment.js";import{RenderRequestType as y}from"../webgl-engine/lib/basicInterfaces.js";const b=.95,v=1;let j=class extends P{constructor(e){super(e),this.requireGeometryDepth=!0,this._newParameters=new F,this._oldParameters=new F,this._fadedParameters=new F,this._parameters=this._newParameters,this._passParameters=new u;const t=_(e.view.spatialReference);this._planetRadius=t.radius,this._atmosphereRadius=t.radius+t.atmosphereHeight,e.view._stage?.renderView.techniques.precompile(f)}toogle(){this.view.environment.atmosphereEnabled&&this.view.environment.weather?this._enable():this._disable()}initialize(){this.addHandles([r((()=>this.view.environment.atmosphereEnabled),(()=>this.toogle()),a),r((()=>this.view.environment.weather),(()=>this.toogle()),a),r((()=>this._updateFogParameters()),(()=>{}),a)]),this.addHandles(r((()=>this._fadeFactor),(e=>this._fade(e)),a))}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.copyFrom(this._newParameters)):e<=0?this._parameters=s:(this._fadedParameters.lerp(s,t,e),this._parameters=this._fadedParameters)}_updateFogParameters(){const e=this.view.environment.weather,s="foggy"===e.type||"snowy"===e.type||"rainy"===e.type;this._newParameters.strength="foggy"===e.type?t(3e-5,.005,e.fogStrength**3):"snowy"===e.type||"rainy"===e.type?t(4e-6,2e-4,(e.precipitation??0)**3):0,this._newParameters.amount=s?1:0,"foggy"!==e.type&&"snowy"!==e.type||o(this._newParameters.color,q),"rainy"===e.type&&o(this._newParameters.color,R),this._fadeFactor>=1&&this._oldParameters.copyFrom(this._newParameters),this.requestRender(y.UPDATE)}render(e){const t=e.find((({name:e})=>e===g.TRANSPARENT_ENVIRONMENT));if(0===this._parameters.amount)return t;if(this._update(),this._passParameters.amount<=0)return t;const s=this.techniques.get(f);if(!s.compiled)return this.requestRender(y.UPDATE),t;const r=this.renderingContext,a=t.getAttachment(r.gl.DEPTH_STENCIL_ATTACHMENT);return t.attachDepth(null),r.bindFramebuffer(t.fbo),r.bindTechnique(s,this.bindParameters,this._passParameters),r.screen.draw(),t.attachDepth(a),t}_update(){const e=this.bindParameters.camera;n(T,e.eye);const t=Math.max(0,h(T,this.bindParameters.lighting.mainLight.direction)),r=this._parameters.color;m(E,r,.1),p(this._passParameters.color,E,r,t);const a=c(e.eye);this._passParameters.atmosphereC=a**2-this._atmosphereRadius**2,this._passParameters.amount=(1-s(b*w,v*w,Math.abs(a-this._planetRadius)))*this._parameters.amount,this._passParameters.strength=this._parameters.strength}};j=e([i("esri.views.3d.environment.Fog")],j);class F{constructor(){this.color=d(),this.strength=0,this.amount=0}copyFrom(e){this.amount=e.amount,this.strength=e.strength,o(this.color,e.color)}lerp(e,s,r){this.amount=t(e.amount,s.amount,r),this.strength=t(e.strength,s.strength,r),p(this.color,e.color,s.color,r)}}const T=d(),E=d(),R=l(.5,.5,.5),q=l(1.5,1.5,1.5);export{j as Fog,F as FogParameters};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{lerp as t,smoothstep as s}from"../../../core/mathUtils.js";import{watch as r,syncAndInitial as a}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{c as o,n,f as m,h,m as p,l as c}from"../../../chunks/vec32.js";import{create as d,fromValues as l}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as g}from"../webgl.js";import{F as u}from"../../../chunks/Fog.glsl.js";import{FogTechnique as f}from"./FogTechnique.js";import{heightLimit as w}from"./weather.js";import{TransparentEnvironment as P}from"../webgl-engine/effects/TransparentEnvironment.js";import{RenderRequestType as y}from"../webgl-engine/lib/basicInterfaces.js";import{DepthStencilAttachment as b}from"../../webgl/enums.js";const v=.95,j=1;let F=class extends P{constructor(e){super(e),this.requireGeometryDepth=!0,this._newParameters=new R,this._oldParameters=new R,this._fadedParameters=new R,this._parameters=this._newParameters,this._passParameters=new u;const t=_(e.view.spatialReference);this._planetRadius=t.radius,this._atmosphereRadius=t.radius+t.atmosphereHeight,e.view._stage?.renderView.techniques.precompile(f)}toogle(){this.view.environment.atmosphereEnabled&&this.view.environment.weather?this._enable():this._disable()}initialize(){this.addHandles([r((()=>this.view.environment.atmosphereEnabled),(()=>this.toogle()),a),r((()=>this.view.environment.weather),(()=>this.toogle()),a),r((()=>this._updateFogParameters()),(()=>{}),a)]),this.addHandles(r((()=>this._fadeFactor),(e=>this._fade(e)),a))}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.copyFrom(this._newParameters)):e<=0?this._parameters=s:(this._fadedParameters.lerp(s,t,e),this._parameters=this._fadedParameters)}_updateFogParameters(){const e=this.view.environment.weather,s="foggy"===e.type||"snowy"===e.type||"rainy"===e.type;this._newParameters.strength="foggy"===e.type?t(3e-5,.005,e.fogStrength**3):"snowy"===e.type||"rainy"===e.type?t(4e-6,2e-4,(e.precipitation??0)**3):0,this._newParameters.amount=s?1:0,"foggy"!==e.type&&"snowy"!==e.type||o(this._newParameters.color,x),"rainy"===e.type&&o(this._newParameters.color,q),this._fadeFactor>=1&&this._oldParameters.copyFrom(this._newParameters),this.requestRender(y.UPDATE)}render(e){const t=e.find((({name:e})=>e===g.TRANSPARENT_ENVIRONMENT));if(0===this._parameters.amount)return t;if(this._update(),this._passParameters.amount<=0)return t;const s=this.techniques.get(f);if(!s.compiled)return this.requestRender(y.UPDATE),t;const r=this.renderingContext,a=t.getAttachment(b);return t.attachDepth(null),r.bindFramebuffer(t.fbo),r.bindTechnique(s,this.bindParameters,this._passParameters),r.screen.draw(),t.attachDepth(a),t}_update(){const e=this.bindParameters.camera;n(E,e.eye);const t=Math.max(0,m(E,this.bindParameters.lighting.mainLight.direction)),r=this._parameters.color;h(T,r,.1),p(this._passParameters.color,T,r,t);const a=c(e.eye);this._passParameters.atmosphereC=a**2-this._atmosphereRadius**2,this._passParameters.amount=(1-s(v*w,j*w,Math.abs(a-this._planetRadius)))*this._parameters.amount,this._passParameters.strength=this._parameters.strength}};F=e([i("esri.views.3d.environment.Fog")],F);class R{constructor(){this.color=d(),this.strength=0,this.amount=0}copyFrom(e){this.amount=e.amount,this.strength=e.strength,o(this.color,e.color)}lerp(e,s,r){this.amount=t(e.amount,s.amount,r),this.strength=t(e.strength,s.strength,r),p(this.color,e.color,s.color,r)}}const E=d(),T=d(),q=l(.5,.5,.5),x=l(1.5,1.5,1.5);export{F as Fog,R as FogParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{i as e}from"../../../../chunks/vec32.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as i,empty as r,expandWithRect as s,center as o,set as d,toRect as n}from"../../../../geometry/support/aaBoundingBox.js";import{create as a}from"../../../../geometry/support/aaBoundingRect.js";import{demResolutionForBoundingBox as h}from"./graphicUtils.js";import{Object3DState as c}from"../../webgl-engine/lib/basicInterfaces.js";import{DirtyOperation as g,DirtyState as m}from"../../webgl-engine/lib/ModelDirtyTypes.js";class l{constructor(e,t,i,r){this.graphics3DSymbolLayer=e,this.renderGeometries=t,this.boundingBox=i,this._drapeSourceRenderer=r,this.type="draped",this.stage=null,this._visible=!1,this._addedToStage=!1,this.isElevationSource=!1}initialize(e){this.stage=e.stage}setVisibility(e){if(null!=this.stage&&this._visible!==e){if(this._visible=e,e&&!this._addedToStage)return this._addedToStage=!0,void this._drapeSourceRenderer.addGeometries(this.renderGeometries,g.ADD);if(e||this._addedToStage){for(const e of this.renderGeometries)e.visible=this._visible;this._drapeSourceRenderer.modifyGeometries(this.renderGeometries,m.VISIBILITY)}}}destroy(){this.stage&&this._addedToStage&&this._drapeSourceRenderer.removeGeometries(this.renderGeometries,g.REMOVE),this._addedToStage=!1,this._visible=!1,this.stage=null}getCenterObjectSpace(i=t()){return e(i,0,0,0)}getBoundingBoxObjectSpace(e=i()){return r(e)}addObjectState(e){e.stateType===c.Highlight&&(this.renderGeometries.forEach((t=>{const i=t.geometry.allocateIdAndHighlight(e.highlightName);e.addRenderGeometry(t,i,this)})),this._addedToStage&&this._drapeSourceRenderer.modifyGeometries(this.renderGeometries,m.HIGHLIGHT))}removeObjectState(e){this.renderGeometries.forEach((t=>e.removeByObject(t)))}updateHighlights(e){}removeRenderGeometryObjectState(e,t){t.channel===c.Highlight&&(e.geometry.removeHighlight(t),this._addedToStage&&this._drapeSourceRenderer.modifyGeometries([e],m.HIGHLIGHT))}computeAttachmentOrigin(e){for(const t of this.renderGeometries)t.geometry.computeAttachmentOrigin(f)&&(e.draped.origin[0]+=f[0],e.draped.origin[1]+=f[1],e.draped.num++)}async getProjectedBoundingBox(e,t,i,d,n){r(n);for(let r=0;r<this.renderGeometries.length;r++){const t=this.renderGeometries[r];this._getRenderGeometryProjectedBoundingRect(t,e,u,i),s(n,u)}if(t){let e;o(n,f);const i=h(n,t.service.spatialReference,t);try{e=await t.service.queryElevation(f[0],f[1],d,i,"ground")}catch(a){}null!=e&&(n[2]=Math.min(n[2],e),n[5]=Math.max(n[5],e))}return n}_getRenderGeometryProjectedBoundingRect(e,t,i,r){if(this.boundingBox)d(p,this.boundingBox);else{const t=e.boundingSphere,i=t[3];p[0]=t[0]-i,p[1]=t[1]-i,p[2]=t[2]-i,p[3]=t[0]+i,p[4]=t[1]+i,p[5]=t[2]+i}return t(p,0,2),this.calculateRelativeScreenBounds&&r.push({location:o(p),screenSpaceBoundingRect:this.calculateRelativeScreenBounds()}),n(p,i)}}const u=a(),p=i(),f=t();export{l as Graphics3DDrapedGraphicLayer};
5
+ import{i as e}from"../../../../chunks/vec32.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as i,empty as r,expandWithRect as s,center as o,set as d,toRect as n}from"../../../../geometry/support/aaBoundingBox.js";import{create as a}from"../../../../geometry/support/aaBoundingRect.js";import{demResolutionForBoundingBox as h}from"./graphicUtils.js";import{Object3DState as c}from"../../webgl-engine/lib/basicInterfaces.js";import{DirtyOperation as g,DirtyState as m}from"../../webgl-engine/lib/ModelDirtyTypes.js";class l{constructor(e,t,i,r){this.graphics3DSymbolLayer=e,this.renderGeometries=t,this.boundingBox=i,this._drapeSourceRenderer=r,this.type="draped",this.stage=null,this._visible=!1,this._addedToStage=!1,this.isElevationSource=!1}initialize(e){this.stage=e.stage}get usedMemory(){return this.graphics3DSymbolLayer.usedMemory}setVisibility(e){if(null!=this.stage&&this._visible!==e){if(this._visible=e,e&&!this._addedToStage)return this._addedToStage=!0,void this._drapeSourceRenderer.addGeometries(this.renderGeometries,g.ADD);if(e||this._addedToStage){for(const e of this.renderGeometries)e.visible=this._visible;this._drapeSourceRenderer.modifyGeometries(this.renderGeometries,m.VISIBILITY)}}}destroy(){this.stage&&this._addedToStage&&this._drapeSourceRenderer.removeGeometries(this.renderGeometries,g.REMOVE),this._addedToStage=!1,this._visible=!1,this.stage=null}getCenterObjectSpace(i=t()){return e(i,0,0,0)}getBoundingBoxObjectSpace(e=i()){return r(e)}addObjectState(e){e.stateType===c.Highlight&&(this.renderGeometries.forEach((t=>{const i=t.geometry.allocateIdAndHighlight(e.highlightName);e.addRenderGeometry(t,i,this)})),this._addedToStage&&this._drapeSourceRenderer.modifyGeometries(this.renderGeometries,m.HIGHLIGHT))}removeObjectState(e){this.renderGeometries.forEach((t=>e.removeByObject(t)))}updateHighlights(e){}removeRenderGeometryObjectState(e,t){t.channel===c.Highlight&&(e.geometry.removeHighlight(t),this._addedToStage&&this._drapeSourceRenderer.modifyGeometries([e],m.HIGHLIGHT))}computeAttachmentOrigin(e){for(const t of this.renderGeometries)t.geometry.computeAttachmentOrigin(y)&&(e.draped.origin[0]+=y[0],e.draped.origin[1]+=y[1],e.draped.num++)}async getProjectedBoundingBox(e,t,i,d,n){r(n);for(let r=0;r<this.renderGeometries.length;r++){const t=this.renderGeometries[r];this._getRenderGeometryProjectedBoundingRect(t,e,u,i),s(n,u)}if(t){let e;o(n,y);const i=h(n,t.service.spatialReference,t);try{e=await t.service.queryElevation(y[0],y[1],d,i,"ground")}catch(a){}null!=e&&(n[2]=Math.min(n[2],e),n[5]=Math.max(n[5],e))}return n}_getRenderGeometryProjectedBoundingRect(e,t,i,r){if(this.boundingBox)d(p,this.boundingBox);else{const t=e.boundingSphere,i=t[3];p[0]=t[0]-i,p[1]=t[1]-i,p[2]=t[2]-i,p[3]=t[0]+i,p[4]=t[1]+i,p[5]=t[2]+i}return t(p,0,2),this.calculateRelativeScreenBounds&&r.push({location:o(p),screenSpaceBoundingRect:this.calculateRelativeScreenBounds()}),n(p,i)}}const u=a(),p=i(),y=t();export{l as Graphics3DDrapedGraphicLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{emptyArray as e}from"../../../../core/arrayUtils.js";import{forEach as t}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{estimateAttributesMemory as i}from"../../../../core/memoryEstimations.js";import r from"../../../../core/ObjectPool.js";import{scale as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{h as o}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import n from"../../../../geometry/Polygon.js";import{projectBoundingRect as h}from"../../../../geometry/projection/projectBoundingRect.js";import{set as c,zero as p,empty as y,expandWithAABB as m,allFinite as u,toRect as d}from"../../../../geometry/support/aaBoundingBox.js";import{create as b,allFinite as g}from"../../../../geometry/support/aaBoundingRect.js";import{equals as f}from"../../../../geometry/support/spatialReferenceUtils.js";import{computeAABR as _}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromGeometry as L}from"../../../../layers/graphics/featureConversionUtils.js";import{VisibilityFlag as E,VisibilityGroup as G}from"./enums.js";import{createFeature as j}from"./featureExpressionInfoUtils.js";const x=new r(Array,(e=>c(e,p)),null,10,5),v=b();class A{get labelLayers(){return this._labelLayers||e}get extent(){return this._extent}get isElevationSource(){return this.layers.some((e=>e?.isElevationSource))}constructor(e,t,i,r,s){this.graphic=e,this.graphics3DSymbol=t,this.layers=i,this._visibleFlags=E.ALL_LABEL,this.deconflictionPriority=0,++t.referenced,this._featureExpressionFeature=s?j(s,e,r):null}initialize(e){this._layer=e,this._forEachSymbolLayerGraphic((t=>{t.initialize(e),t.setVisibility(this.isVisible())}))}destroy(){this._forEachSymbolLayerGraphic((e=>e.destroy())),this._calloutLayer=null,--this.graphics3DSymbol.referenced,this.graphics3DSymbol=null}get destroyed(){return null==this.layers}clearLabelGraphics(){this._forEachLabelGraphic((e=>e.destroy())),this._labelLayers=null}addLabelGraphic(e,t){this._labelLayers||(this._labelLayers=new Array),this._labelLayers.push(e),e.initialize(t),e.setVisibility(this.isVisible(G.LABEL))}setCalloutGraphic(e){this._calloutLayer=e,this._layer&&(e.initialize(this._layer),e.setVisibility(this.isVisible()))}get calloutLayer(){return this._calloutLayer}get isDraped(){let e=!1;return this._forEachSymbolLayerGraphic((t=>{"draped"===t.type&&(e=!0)})),e}isVisible(e=G.GRAPHIC,t){const i=t?this._visibleFlags|t|G.LABEL*t:this._visibleFlags;return e===G.GRAPHIC?(i&E.ALL_GRAPHIC)===E.ALL_GRAPHIC:(i&E.ALL_LABEL)===E.ALL_LABEL}setVisibilityFlag(e,t,i){const r=this.isVisible(e);i?this._visibleFlags|=e*t:this._visibleFlags&=~(e*t);const s=this.isVisible(e);if(r===s)return!1;if(e===G.LABEL)this._forEachLabelGraphic((e=>e.setVisibility(s)));else{this._forEachSymbolLayerGraphic((e=>e.setVisibility(s)));const e=this.isVisible(G.LABEL);this._forEachLabelGraphic((t=>t.setVisibility(e)))}return!0}getVisibilityFlag(e,t){return!!(this._visibleFlags&e*t)}computeExtent(e){if(!this._extent){const t=this.graphic.geometry;if(null==t)return!1;this._extent=b(),_(t,this._extent);const i=t.spatialReference;if(!f(i,e)&&!h(this._extent,i,this._extent,e))return this._extent=null,!1}return!0}getAsOptimizedGeometry(e,t){return this._optimizedGeometry||(this._optimizedGeometry=this._convertGraphicToOptimizedGeometry(this.graphic,e,t)),this._optimizedGeometry}_convertGraphicToOptimizedGeometry(e,t,i){let r=e.geometry;return"mesh"!==r.type&&"extent"!==r.type||(r=n.fromExtent("mesh"===r.type?r.extent:r)),L(r,t,i)}get usedMemory(){let e=i(this.graphic.attributes);return this._forEachSymbolLayerGraphic((t=>e+=t.graphics3DSymbolLayer.usedMemory)),e}computeAttachmentOrigin(){const e={render:{origin:l(),num:0},draped:{origin:a(),num:0}};for(const t of this.layers)null!=t&&t.computeAttachmentOrigin(e);return e.render.num>1&&o(e.render.origin,e.render.origin,1/e.render.num),e.draped.num>1&&s(e.draped.origin,e.draped.origin,1/e.draped.num),e}async getProjectedBoundingBox(e,i,r,s,a){return a||(a={boundingBox:null,requiresDrapedElevation:!1,screenSpaceObjects:[]}),a.boundingBox?y(a.boundingBox):a.boundingBox=y(),a.requiresDrapedElevation=!1,await t(this.layers,(async t=>{if(null==t)return;const o="draped"===t.type?i:e,l=x.acquire(),n=await t.getProjectedBoundingBox(o,r,a.screenSpaceObjects,s,l);isFinite(n[2])&&isFinite(n[5])||(a.requiresDrapedElevation=!0),n&&m(a.boundingBox,l),x.release(l)})),u(a.boundingBox)||g(d(a.boundingBox,v))?a:null}needsElevationUpdates(){for(const e of this.layers)if(null!=e&&("object3d"===e.type||"lod-instance"===e.type)&&e.needsElevationUpdates)return!0;return this._labelLayers?.some((e=>e?.needsElevationUpdates??!1))??!1}alignWithElevation(e,t,i){this._forEachRenderedGraphic((r=>{"object3d"!==r.type&&"lod-instance"!==r.type||r.alignWithElevation(e,t,this._featureExpressionFeature,i)}))}alignWithAbsoluteElevation(e,t,i){this._forEachRenderedGraphic((r=>{"object3d"===r.type&&r.alignWithAbsoluteElevation(e,t,i)}))}addObjectStateSet(e){this._forEachSymbolLayerGraphic((t=>t.addObjectState(e)))}removeObjectState(e){this._forEachSymbolLayerGraphic((t=>t.removeObjectState(e)))}updateHighlights(e){this._forEachSymbolLayerGraphic((t=>t.updateHighlights(e)))}_forEachGraphicList(e,t){e?.forEach((e=>e&&t(e)))}_forEachSymbolLayerGraphic(e){this._forEachGraphicList(this.layers,e),this._calloutLayer&&e(this._calloutLayer)}_forEachLabelGraphic(e){this._forEachGraphicList(this.labelLayers,e)}_forEachRenderedGraphic(e){this._forEachSymbolLayerGraphic(e),this._forEachLabelGraphic(e)}get test(){}}export{A as Graphics3DGraphic};
5
+ import{emptyArray as e}from"../../../../core/arrayUtils.js";import{forEach as t}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{estimateAttributesMemory as i}from"../../../../core/memoryEstimations.js";import r from"../../../../core/ObjectPool.js";import{scale as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{h as o}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import n from"../../../../geometry/Polygon.js";import{projectBoundingRect as h}from"../../../../geometry/projection/projectBoundingRect.js";import{set as c,zero as p,empty as y,expandWithAABB as m,allFinite as u,toRect as d}from"../../../../geometry/support/aaBoundingBox.js";import{create as b,allFinite as g}from"../../../../geometry/support/aaBoundingRect.js";import{equals as f}from"../../../../geometry/support/spatialReferenceUtils.js";import{computeAABR as _}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromGeometry as L}from"../../../../layers/graphics/featureConversionUtils.js";import{VisibilityFlag as E,VisibilityGroup as G}from"./enums.js";import{createFeature as j}from"./featureExpressionInfoUtils.js";const x=new r(Array,(e=>c(e,p)),null,10,5),v=b();class A{get labelLayers(){return this._labelLayers||e}get extent(){return this._extent}get isElevationSource(){return this.layers.some((e=>e?.isElevationSource))}constructor(e,t,i,r,s){this.graphic=e,this.graphics3DSymbol=t,this.layers=i,this._visibleFlags=E.ALL_LABEL,this.deconflictionPriority=0,++t.referenced,this._featureExpressionFeature=s?j(s,e,r):null}initialize(e){this._layer=e,this._forEachSymbolLayerGraphic((t=>{t.initialize(e),t.setVisibility(this.isVisible())}))}destroy(){this._forEachSymbolLayerGraphic((e=>e.destroy())),this._calloutLayer=null,--this.graphics3DSymbol.referenced,this.graphics3DSymbol=null}get destroyed(){return null==this.layers}clearLabelGraphics(){this._forEachLabelGraphic((e=>e.destroy())),this._labelLayers=null}addLabelGraphic(e,t){this._labelLayers||(this._labelLayers=new Array),this._labelLayers.push(e),e.initialize(t),e.setVisibility(this.isVisible(G.LABEL))}setCalloutGraphic(e){this._calloutLayer=e,this._layer&&(e.initialize(this._layer),e.setVisibility(this.isVisible()))}get calloutLayer(){return this._calloutLayer}get isDraped(){let e=!1;return this._forEachSymbolLayerGraphic((t=>{"draped"===t.type&&(e=!0)})),e}isVisible(e=G.GRAPHIC,t){const i=t?this._visibleFlags|t|G.LABEL*t:this._visibleFlags;return e===G.GRAPHIC?(i&E.ALL_GRAPHIC)===E.ALL_GRAPHIC:(i&E.ALL_LABEL)===E.ALL_LABEL}setVisibilityFlag(e,t,i){const r=this.isVisible(e);i?this._visibleFlags|=e*t:this._visibleFlags&=~(e*t);const s=this.isVisible(e);if(r===s)return!1;if(e===G.LABEL)this._forEachLabelGraphic((e=>e.setVisibility(s)));else{this._forEachSymbolLayerGraphic((e=>e.setVisibility(s)));const e=this.isVisible(G.LABEL);this._forEachLabelGraphic((t=>t.setVisibility(e)))}return!0}getVisibilityFlag(e,t){return!!(this._visibleFlags&e*t)}computeExtent(e){if(!this._extent){const t=this.graphic.geometry;if(null==t)return!1;this._extent=b(),_(t,this._extent);const i=t.spatialReference;if(!f(i,e)&&!h(this._extent,i,this._extent,e))return this._extent=null,!1}return!0}getAsOptimizedGeometry(e,t){return this._optimizedGeometry||(this._optimizedGeometry=this._convertGraphicToOptimizedGeometry(this.graphic,e,t)),this._optimizedGeometry}_convertGraphicToOptimizedGeometry(e,t,i){let r=e.geometry;return"mesh"!==r.type&&"extent"!==r.type||(r=n.fromExtent("mesh"===r.type?r.extent:r)),L(r,t,i)}get usedMemory(){let e=i(this.graphic.attributes);return this._forEachSymbolLayerGraphic((t=>e+=t.usedMemory)),e}computeAttachmentOrigin(){const e={render:{origin:l(),num:0},draped:{origin:a(),num:0}};for(const t of this.layers)null!=t&&t.computeAttachmentOrigin(e);return e.render.num>1&&o(e.render.origin,e.render.origin,1/e.render.num),e.draped.num>1&&s(e.draped.origin,e.draped.origin,1/e.draped.num),e}async getProjectedBoundingBox(e,i,r,s,a){return a||(a={boundingBox:null,requiresDrapedElevation:!1,screenSpaceObjects:[]}),a.boundingBox?y(a.boundingBox):a.boundingBox=y(),a.requiresDrapedElevation=!1,await t(this.layers,(async t=>{if(null==t)return;const o="draped"===t.type?i:e,l=x.acquire(),n=await t.getProjectedBoundingBox(o,r,a.screenSpaceObjects,s,l);isFinite(n[2])&&isFinite(n[5])||(a.requiresDrapedElevation=!0),n&&m(a.boundingBox,l),x.release(l)})),u(a.boundingBox)||g(d(a.boundingBox,v))?a:null}needsElevationUpdates(){for(const e of this.layers)if(null!=e&&("object3d"===e.type||"lod-instance"===e.type)&&e.needsElevationUpdates)return!0;return this._labelLayers?.some((e=>e?.needsElevationUpdates??!1))??!1}alignWithElevation(e,t,i){this._forEachRenderedGraphic((r=>{"object3d"!==r.type&&"lod-instance"!==r.type||r.alignWithElevation(e,t,this._featureExpressionFeature,i)}))}alignWithAbsoluteElevation(e,t,i){this._forEachRenderedGraphic((r=>{"object3d"===r.type&&r.alignWithAbsoluteElevation(e,t,i)}))}addObjectStateSet(e){this._forEachSymbolLayerGraphic((t=>t.addObjectState(e)))}removeObjectState(e){this._forEachSymbolLayerGraphic((t=>t.removeObjectState(e)))}updateHighlights(e){this._forEachSymbolLayerGraphic((t=>t.updateHighlights(e)))}_forEachGraphicList(e,t){e?.forEach((e=>e&&t(e)))}_forEachSymbolLayerGraphic(e){this._forEachGraphicList(this.layers,e),this._calloutLayer&&e(this._calloutLayer)}_forEachLabelGraphic(e){this._forEachGraphicList(this.labelLayers,e)}_forEachRenderedGraphic(e){this._forEachSymbolLayerGraphic(e),this._forEachLabelGraphic(e)}get test(){}}export{A as Graphics3DGraphic};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{t as e,i}from"../../../../chunks/vec32.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as s,expandWithVec3 as a,create as h,isPoint as o,center as r,offset as l}from"../../../../geometry/support/aaBoundingBox.js";import{evaluateElevationInfoAtPoint as g}from"./elevationAlignmentUtils.js";import{setContextFeature as c}from"./featureExpressionInfoUtils.js";import{demResolutionForBoundingBox as d}from"./graphicUtils.js";import{Object3DState as m}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3DHighlightStateID as p}from"../../webgl-engine/lib/Object3DStateID.js";class u{constructor(t,e,i,n,s){this.graphics3DSymbolLayer=t,this.instanceIndex=e,this.elevationAligner=i,this.elevationContext=n,this._highlightOrderMap=s,this.type="lod-instance",this._highlights=new Set,this.alignedSampledElevation=0,this.isElevationSource=!1,this.needsElevationUpdates=!1,this._highlightName=null}initialize(){}setVisibility(t){const{instanceData:e}=this;t!==e.getVisible(this.instanceIndex)&&e.setVisible(this.instanceIndex,t)}destroy(){null!=this.instanceIndex&&(this.instanceData.removeInstance(this.instanceIndex),this.graphics3DSymbolLayer.notifyDestroyGraphicLayer(this))}alignWithElevation(t,e,i){if(this.elevationAligner){c(this.elevationContext.featureExpressionInfoContext,i);const n=(i,n)=>g(i,t,this.elevationContext,e,n),s=this.elevationAligner(this,this.elevationContext,t.spatialReference,n,e);null!=s&&(this.alignedSampledElevation=s)}}getCenterObjectSpace(t=n()){return this.instanceData.getCombinedLocalTransform(this.instanceIndex,_),e(t,this._lodRenderer.baseBoundingSphere.center,_)}getBoundingBoxObjectSpace(t=h()){this.instanceData.getCombinedLocalTransform(this.instanceIndex,_);const n=this._lodRenderer.baseBoundingBox;s(t);for(let s=0;s<8;++s)i(b,1&s?n[3]:n[0],2&s?n[4]:n[1],4&s?n[5]:n[2]),e(b,b,_),a(t,b);return t}computeAttachmentOrigin(t){this.instanceData.getGlobalTransform(this.instanceIndex,_),t.render.origin[0]+=_[12],t.render.origin[1]+=_[13],t.render.origin[2]+=_[14],t.render.num++}async getProjectedBoundingBox(t,i,n,a,h){const g=this.getBoundingBoxObjectSpace(h),c=x,m=o(g)?1:c.length;this.instanceData.getGlobalTransform(this.instanceIndex,_);for(let s=0;s<m;s++){const t=c[s];b[0]=g[t[0]],b[1]=g[t[1]],b[2]=g[t[2]],e(b,b,_),f[3*s]=b[0],f[3*s+1]=b[1],f[3*s+2]=b[2]}if(!t(f,0,m))return null;s(g);let p=null;this.calculateRelativeScreenBounds&&(p=this.calculateRelativeScreenBounds());for(let e=0;e<3*m;e+=3){for(let t=0;t<3;t++)g[t]=Math.min(g[t],f[e+t]),g[t+3]=Math.max(g[t+3],f[e+t]);p&&n.push({location:f.slice(e,e+3),screenSpaceBoundingRect:p})}if(i&&(r(g,v),"absolute-height"!==this.elevationContext.mode)){let t;const e=d(g,i.service.spatialReference,i);try{t=await i.service.queryElevation(v[0],v[1],a,e,"ground")}catch(u){}null!=t&&l(g,0,0,-this.alignedSampledElevation+t)}return g}addObjectState(t){t.stateType===m.Highlight&&this.addObjectHighlightState(t)}addObjectHighlightState(t){const e=new p(t.highlightName);this._addHighlightId(e),t.addExternal((t=>{this._removeHighlightId(t)}),e)}removeObjectState(t){this._highlights.forEach((e=>t.remove(e)))}updateHighlights(t){this._highlightOrderMap=t,this._updateHighlightOptions()}_calculateHighlightOptions(){let t=-1,e=null;return this._highlights.forEach((({highlightName:i})=>{const n=this._highlightOrderMap.get(i);void 0!==n&&n>t&&(t=n,e=i)})),e}_addHighlightId(t){this._highlights.add(t),this._updateHighlightOptions()}_removeHighlightId(t){this._highlights.delete(t),this._updateHighlightOptions()}_updateHighlightOptions(){const t=this._calculateHighlightOptions();t!==this._highlightName&&(this._highlightName=t,this.instanceData.setHighlight(this.instanceIndex,t))}get _lodRenderer(){return this.graphics3DSymbolLayer.lodRenderer}get instanceData(){return this._lodRenderer.instanceData}}const f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],b=n(),v=n(),x=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]],_=t();export{u as Graphics3DLodInstanceGraphicLayer};
5
+ import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{t as e,i}from"../../../../chunks/vec32.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as s,expandWithVec3 as a,create as h,isPoint as r,center as o,offset as l}from"../../../../geometry/support/aaBoundingBox.js";import{evaluateElevationInfoAtPoint as g}from"./elevationAlignmentUtils.js";import{setContextFeature as c}from"./featureExpressionInfoUtils.js";import{demResolutionForBoundingBox as d}from"./graphicUtils.js";import{Object3DState as m}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3DHighlightStateID as p}from"../../webgl-engine/lib/Object3DStateID.js";class u{constructor(t,e,i,n,s){this.graphics3DSymbolLayer=t,this.instanceIndex=e,this.elevationAligner=i,this.elevationContext=n,this._highlightOrderMap=s,this.type="lod-instance",this._highlights=new Set,this.alignedSampledElevation=0,this.isElevationSource=!1,this.needsElevationUpdates=!1,this._highlightName=null}initialize(){}setVisibility(t){const{instanceData:e}=this;t!==e.getVisible(this.instanceIndex)&&e.setVisible(this.instanceIndex,t)}destroy(){null!=this.instanceIndex&&(this.instanceData.removeInstance(this.instanceIndex),this.graphics3DSymbolLayer.notifyDestroyGraphicLayer(this))}get usedMemory(){return this.graphics3DSymbolLayer.usedMemory}alignWithElevation(t,e,i){if(this.elevationAligner){c(this.elevationContext.featureExpressionInfoContext,i);const n=(i,n)=>g(i,t,this.elevationContext,e,n),s=this.elevationAligner(this,this.elevationContext,t.spatialReference,n,e);null!=s&&(this.alignedSampledElevation=s)}}getCenterObjectSpace(t=n()){return this.instanceData.getCombinedLocalTransform(this.instanceIndex,_),e(t,this._lodRenderer.baseBoundingSphere.center,_)}getBoundingBoxObjectSpace(t=h()){this.instanceData.getCombinedLocalTransform(this.instanceIndex,_);const n=this._lodRenderer.baseBoundingBox;s(t);for(let s=0;s<8;++s)i(b,1&s?n[3]:n[0],2&s?n[4]:n[1],4&s?n[5]:n[2]),e(b,b,_),a(t,b);return t}computeAttachmentOrigin(t){this.instanceData.getGlobalTransform(this.instanceIndex,_),t.render.origin[0]+=_[12],t.render.origin[1]+=_[13],t.render.origin[2]+=_[14],t.render.num++}async getProjectedBoundingBox(t,i,n,a,h){const g=this.getBoundingBoxObjectSpace(h),c=x,m=r(g)?1:c.length;this.instanceData.getGlobalTransform(this.instanceIndex,_);for(let s=0;s<m;s++){const t=c[s];b[0]=g[t[0]],b[1]=g[t[1]],b[2]=g[t[2]],e(b,b,_),f[3*s]=b[0],f[3*s+1]=b[1],f[3*s+2]=b[2]}if(!t(f,0,m))return null;s(g);let p=null;this.calculateRelativeScreenBounds&&(p=this.calculateRelativeScreenBounds());for(let e=0;e<3*m;e+=3){for(let t=0;t<3;t++)g[t]=Math.min(g[t],f[e+t]),g[t+3]=Math.max(g[t+3],f[e+t]);p&&n.push({location:f.slice(e,e+3),screenSpaceBoundingRect:p})}if(i&&(o(g,v),"absolute-height"!==this.elevationContext.mode)){let t;const e=d(g,i.service.spatialReference,i);try{t=await i.service.queryElevation(v[0],v[1],a,e,"ground")}catch(u){}null!=t&&l(g,0,0,-this.alignedSampledElevation+t)}return g}addObjectState(t){t.stateType===m.Highlight&&this.addObjectHighlightState(t)}addObjectHighlightState(t){const e=new p(t.highlightName);this._addHighlightId(e),t.addExternal((t=>{this._removeHighlightId(t)}),e)}removeObjectState(t){this._highlights.forEach((e=>t.remove(e)))}updateHighlights(t){this._highlightOrderMap=t,this._updateHighlightOptions()}_calculateHighlightOptions(){let t=-1,e=null;return this._highlights.forEach((({highlightName:i})=>{const n=this._highlightOrderMap.get(i);void 0!==n&&n>t&&(t=n,e=i)})),e}_addHighlightId(t){this._highlights.add(t),this._updateHighlightOptions()}_removeHighlightId(t){this._highlights.delete(t),this._updateHighlightOptions()}_updateHighlightOptions(){const t=this._calculateHighlightOptions();t!==this._highlightName&&(this._highlightName=t,this.instanceData.setHighlight(this.instanceIndex,t))}get _lodRenderer(){return this.graphics3DSymbolLayer.lodRenderer}get instanceData(){return this._lodRenderer.instanceData}}const f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],b=n(),v=n(),x=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]],_=t();export{u as Graphics3DLodInstanceGraphicLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{c as e,t,g as i}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as a,setMax as n,create as r,isPoint as o,empty as l,center as c,offset as g}from"../../../../geometry/support/aaBoundingBox.js";import{a as h}from"../../../../chunks/sphere.js";import{evaluateElevationInfoAtPoint as d}from"./elevationAlignmentUtils.js";import{setContextFeature as u}from"./featureExpressionInfoUtils.js";import{demResolutionForBoundingBox as b}from"./graphicUtils.js";import{Object3DState as m}from"../../webgl-engine/lib/basicInterfaces.js";import{Transparency as O}from"../../webgl-engine/lib/edgeRendering/interfaces.js";class j{constructor(e,t,i){this.baseMaterial=e,this.edgeMaterial=t,this.hasSlicePlane=i}}class p{get isElevationSource(){return!!this.stageObject.lastValidElevationBB}constructor(e,t,i,s,a,n,r,o=null){this.graphics3DSymbolLayer=e,this.stageObject=t,this._uniqueGeometries=i,this._uniqueMaterials=s,this._sharedResource=a,this.elevationAligner=n,this.elevationContext=r,this._edgeState=o,this.type="object3d",this._stageLayer=null,this._visible=!1,this._addedToStage=!1,this.alignedSampledElevation=0,this.needsElevationUpdates=!1,this.useObjectOriginAsAttachmentOrigin=!1}initialize(e){this._stageLayer=e;const t=e.stage;t.addMany(this._uniqueMaterials),t.addMany(this._uniqueGeometries),t.add(this.stageObject)}destroy(){if(!this._stageLayer)return;const e=this._stageLayer.stage;e.removeMany(this._uniqueMaterials),e.removeMany(this._uniqueGeometries),e.remove(this.stageObject),this._addedToStage&&(this._stageLayer.remove(this.stageObject),this._addedToStage=!1),e.renderer.edgeView?.removeObject(this.stageObject),this.stageObject.dispose(),this._sharedResource?.release(),this._visible=!1,this._stageLayer=null}layerOpacityChanged(e,t){const{stageObject:i,_edgeState:s,_stageLayer:a}=this;if(null==s)return;const n=v(s.baseMaterial);s.edgeMaterial.objectTransparency!==n&&(s.edgeMaterial.objectTransparency=n,this.resetEdgeObject(t)),a.stage.renderer.withEdgeView((t=>t.updateAllComponentOpacities(i,[e])))}updateHighlights(e){}slicePlaneEnabledChanged(e,t){const{stageObject:i,_edgeState:s,_stageLayer:a}=this;null!=s&&a.stage.renderer.withEdgeView((a=>{a.updateAllComponentMaterials(i,s.edgeMaterial,e,!t),s.hasSlicePlane=e}))}setVisibility(e){const{_edgeState:t,stageObject:i,_stageLayer:s}=this;null!=s&&this.visible!==e&&(this._visible=e,i.visible=e,e&&!this._addedToStage&&(s.add(i),this._addedToStage=!0),null!=t&&s.stage.renderer.withEdgeView((s=>{s.hasObject(i)?s.updateObjectVisibility(i,e):e&&this._addOrUpdateEdgeObject(t,s,!1)})))}get visible(){return this._visible}alignWithElevation(e,t,i,s){if(null==this.elevationAligner)return;null!=i&&u(this.elevationContext.featureExpressionInfoContext,i);const a=(i,s)=>d(i,e,this.elevationContext,t,s);this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,e.spatialReference,a,t),this.resetEdgeObject(s)}alignWithAbsoluteElevation(e,t,i){const s=(t,i)=>{i.sampledElevation=e,i.verticalDistanceToGround=0,i.z=e};this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,null,s,t),this.resetEdgeObject(i)}getCenterObjectSpace(t=s()){return e(t,h(this.stageObject.boundingVolumeObjectSpace.bounds))}getBoundingBoxObjectSpace(e=r()){const t=this.stageObject.boundingVolumeObjectSpace;return a(e,t.min),n(e,t.max),e}computeAttachmentOrigin(e){const s=this.stageObject.effectiveTransformation;if(this.useObjectOriginAsAttachmentOrigin)e.render.origin[0]+=s[12],e.render.origin[1]+=s[13],e.render.origin[2]+=s[14],e.render.num++;else for(const a of this.stageObject.geometries)a.computeAttachmentOrigin(y)&&(t(y,y,s),i(e.render.origin,e.render.origin,y),e.render.num++)}async getProjectedBoundingBox(e,i,s,a,n){const r=this.getBoundingBoxObjectSpace(n),h=S,d=o(r)?1:h.length;for(let o=0;o<d;o++){const e=h[o];f[0]=r[e[0]],f[1]=r[e[1]],f[2]=r[e[2]],t(f,f,this.stageObject.transformation),_[3*o]=f[0],_[3*o+1]=f[1],_[3*o+2]=f[2]}if(!e(_,0,d))return null;l(r);let u=null;this.calculateRelativeScreenBounds&&(u=this.calculateRelativeScreenBounds());for(let t=0;t<3*d;t+=3){for(let e=0;e<3;e++)r[e]=Math.min(r[e],_[t+e]),r[e+3]=Math.max(r[e+3],_[t+e]);u&&s.push({location:_.slice(t,t+3),screenSpaceBoundingRect:u})}if(i?.service&&"absolute-height"!==this.elevationContext.mode){c(r,y);const e="relative-to-scene"===this.elevationContext.mode?"scene":"ground";let t=0;if(i.useViewElevation)t=i.service.getElevation(y[0],y[1],e)??0;else try{const s=b(r,i.service.spatialReference,i);t=await i.service.queryElevation(y[0],y[1],a,s,e)??0}catch(m){}g(r,0,0,-this.alignedSampledElevation+t)}return r}addObjectState(e){e.stateType===m.Highlight&&e.addObject(this.stageObject,this.stageObject.highlight(e.highlightName)),e.stateType===m.MaskOccludee&&e.addObject(this.stageObject,this.stageObject.maskOccludee())}removeObjectState(e){e.removeByObject(this.stageObject)}resetEdgeObject(e){const{_edgeState:t,stageObject:i,_stageLayer:s,_visible:a}=this;null!=t&&s.stage.renderer.withEdgeView((s=>{a?this._addOrUpdateEdgeObject(t,s,e):s.removeObject(i)}))}_addOrUpdateEdgeObject(e,t,i){const s=v(e.baseMaterial);e.edgeMaterial.objectTransparency=s,t.addOrUpdateObject3D(this.stageObject,e.edgeMaterial,e.hasSlicePlane,!i).then((()=>this._stageLayer?.sync()))}}function v(e){return e.transparent?O.TRANSPARENT:O.OPAQUE}const _=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],f=s(),y=s(),S=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];export{p as Graphics3DObject3DGraphicLayer,j as Object3DEdgeState};
5
+ import{c as e,t,g as i}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as a,setMax as n,create as r,isPoint as o,empty as l,center as c,offset as g}from"../../../../geometry/support/aaBoundingBox.js";import{a as h}from"../../../../chunks/sphere.js";import{evaluateElevationInfoAtPoint as d}from"./elevationAlignmentUtils.js";import{setContextFeature as u}from"./featureExpressionInfoUtils.js";import{demResolutionForBoundingBox as b}from"./graphicUtils.js";import{Object3DState as m}from"../../webgl-engine/lib/basicInterfaces.js";import{Transparency as O}from"../../webgl-engine/lib/edgeRendering/interfaces.js";class j{constructor(e,t,i){this.baseMaterial=e,this.edgeMaterial=t,this.hasSlicePlane=i}}class p{get isElevationSource(){return!!this.stageObject.lastValidElevationBB}constructor(e,t,i,s,a,n,r,o=null,l=0){this.graphics3DSymbolLayer=e,this.stageObject=t,this._uniqueGeometries=i,this._uniqueMaterials=s,this._sharedResource=a,this.elevationAligner=n,this.elevationContext=r,this._edgeState=o,this._usedMemory=l,this.type="object3d",this._stageLayer=null,this._visible=!1,this._addedToStage=!1,this.alignedSampledElevation=0,this.needsElevationUpdates=!1,this.useObjectOriginAsAttachmentOrigin=!1}initialize(e){this._stageLayer=e;const t=e.stage;t.addMany(this._uniqueMaterials),t.addMany(this._uniqueGeometries),t.add(this.stageObject)}destroy(){if(!this._stageLayer)return;const e=this._stageLayer.stage;e.removeMany(this._uniqueMaterials),e.removeMany(this._uniqueGeometries),e.remove(this.stageObject),this._addedToStage&&(this._stageLayer.remove(this.stageObject),this._addedToStage=!1),e.renderer.edgeView?.removeObject(this.stageObject),this.stageObject.dispose(),this._sharedResource?.release(),this._visible=!1,this._stageLayer=null}get usedMemory(){return this.graphics3DSymbolLayer.usedMemory+this._usedMemory}layerOpacityChanged(e,t){const{stageObject:i,_edgeState:s,_stageLayer:a}=this;if(null==s)return;const n=v(s.baseMaterial);s.edgeMaterial.objectTransparency!==n&&(s.edgeMaterial.objectTransparency=n,this.resetEdgeObject(t)),a.stage.renderer.withEdgeView((t=>t.updateAllComponentOpacities(i,[e])))}updateHighlights(e){}slicePlaneEnabledChanged(e,t){const{stageObject:i,_edgeState:s,_stageLayer:a}=this;null!=s&&a.stage.renderer.withEdgeView((a=>{a.updateAllComponentMaterials(i,s.edgeMaterial,e,!t),s.hasSlicePlane=e}))}setVisibility(e){const{_edgeState:t,stageObject:i,_stageLayer:s}=this;null!=s&&this.visible!==e&&(this._visible=e,i.visible=e,e&&!this._addedToStage&&(s.add(i),this._addedToStage=!0),null!=t&&s.stage.renderer.withEdgeView((s=>{s.hasObject(i)?s.updateObjectVisibility(i,e):e&&this._addOrUpdateEdgeObject(t,s,!1)})))}get visible(){return this._visible}alignWithElevation(e,t,i,s){if(null==this.elevationAligner)return;null!=i&&u(this.elevationContext.featureExpressionInfoContext,i);const a=(i,s)=>d(i,e,this.elevationContext,t,s);this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,e.spatialReference,a,t),this.resetEdgeObject(s)}alignWithAbsoluteElevation(e,t,i){const s=(t,i)=>{i.sampledElevation=e,i.verticalDistanceToGround=0,i.z=e};this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,null,s,t),this.resetEdgeObject(i)}getCenterObjectSpace(t=s()){return e(t,h(this.stageObject.boundingVolumeObjectSpace.bounds))}getBoundingBoxObjectSpace(e=r()){const t=this.stageObject.boundingVolumeObjectSpace;return a(e,t.min),n(e,t.max),e}computeAttachmentOrigin(e){const s=this.stageObject.effectiveTransformation;if(this.useObjectOriginAsAttachmentOrigin)e.render.origin[0]+=s[12],e.render.origin[1]+=s[13],e.render.origin[2]+=s[14],e.render.num++;else for(const a of this.stageObject.geometries)a.computeAttachmentOrigin(f)&&(t(f,f,s),i(e.render.origin,e.render.origin,f),e.render.num++)}async getProjectedBoundingBox(e,i,s,a,n){const r=this.getBoundingBoxObjectSpace(n),h=S,d=o(r)?1:h.length;for(let o=0;o<d;o++){const e=h[o];_[0]=r[e[0]],_[1]=r[e[1]],_[2]=r[e[2]],t(_,_,this.stageObject.transformation),y[3*o]=_[0],y[3*o+1]=_[1],y[3*o+2]=_[2]}if(!e(y,0,d))return null;l(r);let u=null;this.calculateRelativeScreenBounds&&(u=this.calculateRelativeScreenBounds());for(let t=0;t<3*d;t+=3){for(let e=0;e<3;e++)r[e]=Math.min(r[e],y[t+e]),r[e+3]=Math.max(r[e+3],y[t+e]);u&&s.push({location:y.slice(t,t+3),screenSpaceBoundingRect:u})}if(i?.service&&"absolute-height"!==this.elevationContext.mode){c(r,f);const e="relative-to-scene"===this.elevationContext.mode?"scene":"ground";let t=0;if(i.useViewElevation)t=i.service.getElevation(f[0],f[1],e)??0;else try{const s=b(r,i.service.spatialReference,i);t=await i.service.queryElevation(f[0],f[1],a,s,e)??0}catch(m){}g(r,0,0,-this.alignedSampledElevation+t)}return r}addObjectState(e){e.stateType===m.Highlight&&e.addObject(this.stageObject,this.stageObject.highlight(e.highlightName)),e.stateType===m.MaskOccludee&&e.addObject(this.stageObject,this.stageObject.maskOccludee())}removeObjectState(e){e.removeByObject(this.stageObject)}resetEdgeObject(e){const{_edgeState:t,stageObject:i,_stageLayer:s,_visible:a}=this;null!=t&&s.stage.renderer.withEdgeView((s=>{a?this._addOrUpdateEdgeObject(t,s,e):s.removeObject(i)}))}_addOrUpdateEdgeObject(e,t,i){const s=v(e.baseMaterial);e.edgeMaterial.objectTransparency=s,t.addOrUpdateObject3D(this.stageObject,e.edgeMaterial,e.hasSlicePlane,!i).then((()=>this._stageLayer?.sync()))}}function v(e){return e.transparent?O.TRANSPARENT:O.OPAQUE}const y=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],_=s(),f=s(),S=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];export{p as Graphics3DObject3DGraphicLayer,j as Object3DEdgeState};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Error.js";import{translate as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as i,create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as a,scale as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as n,fromArray as l,clone as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{F as h,i as m}from"../../../../chunks/vec32.js";import{clone as p,ZEROS as f,fromArray as d,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as y}from"../../../../geometry/projection/projectBuffer.js";import{create as g,fromSubBuffer as _,intersectsClippingArea as v}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as x,doubleArrayFrom as w}from"../../../../geometry/support/DoubleArray.js";import{needsElevationUpdates3D as P,evaluateElevationAlignmentAtPoint as j,SampleElevationInfo as S}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{pathNumRoundJoinSubdivisions as D,pathNumRoundCapExtrusionSubdivisions as L}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as A}from"./Graphics3DSymbolLayer.js";import{isValidSize as V}from"./graphicUtils.js";import{ApplyRendererDiffResult as R}from"./interfaces.js";import{ConvertOptions as U,initFastSymbolUpdatesState as k,updateFastSymbolUpdatesState as E,getAttributeValue as z}from"../support/FastSymbolUpdates.js";import{SamplePosition as O}from"../../support/ElevationProvider.js";import{NormalType as I}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{CullFaceOptions as G}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as B}from"../../webgl-engine/lib/Object3D.js";import{Path as F}from"../../webgl-engine/lib/Path.js";import{PathBuilder as M}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as q,TriangulationCapBuilder as H,NoCapBuilder as N}from"../../webgl-engine/lib/PathCapBuilder.js";import{SimpleExtruder as W,MiterExtruder as T}from"../../webgl-engine/lib/PathExtruder.js";import{UpVectorAlignment as Z,PathGeometry as J,isPathGeometry as K}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as Q,StaticPathGeometry as X}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as Y}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as $,circleProfiles as ee}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as te}from"../../webgl-engine/lib/PathVertex.js";import{VertexAttribute as re}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as ie}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as se}from"../../webgl-engine/materials/PathMaterial.js";const ae=["polyline"];class oe extends A{get usedMemory(){return this._usedMemory+super.usedMemory}constructor(e,t,r,i){super(e,t,r,i,me(t)),this._intrinsicSize=n(1,1),this._upVectorAlignment=Z.Path,this._stencilWidth=.1,this._usedMemory=0,this.ensureDrapedStatus(!1)}async doLoad(){const e=null!=this.symbolLayer.width?this.symbolLayer.width:this.symbolLayer.height,r=null!=this.symbolLayer.height?this.symbolLayer.height:e;this._vvConvertOptions=new U({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[e,1,r],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:[e,1,r]});const i=this._context.renderer?.visualVariables;this._fastUpdates=i?.length?k(this._context.renderer,this._vvConvertOptions):null;const s=this.symbolLayer.anchor||"center";this._upVectorAlignment="heading"===this.symbolLayer.profileRotation?Z.World:Z.Path;const n=this.symbolLayer.profile||"circle";switch(n){default:case"circle":this._profile=ee[s];break;case"quad":this._profile=$[s]}switch(this.symbolLayer.join){case"round":this._extruder=new T(0,D);break;case"bevel":this._extruder=new T(0,1);break;case"miter":this._extruder=new T(.8*Math.PI,1);break;default:this._extruder=new W}const c=this.symbolLayer.cap||"butt";switch(c){case"none":this._startCap=new N,this._endCap=new N;break;case"butt":default:this._startCap=new H(this._profile,0),this._endCap=new H(this._profile,0,!0);break;case"square":this._startCap=new H(this._profile,-.5),this._endCap=new H(this._profile,.5,!0);break;case"round":{const e="quad"===n;this._startCap=new q({profile:this._profile,flip:!1,breakNormals:e,subdivisions:L}),this._endCap=new q({profile:this._profile,flip:!0,breakNormals:e,subdivisions:L});break}}const m=this.symbolLayer?.material?.emissiveFactor,u=m?h(p(m)):f,b=this.symbolLayer?.material?.color,y=this._getCombinedOpacityAndColor(b),g=d(y),_={diffuse:g,ambient:g,emissiveFactor:u,opacity:y[3],drivenOpacity:this.needsDrivenTransparentPass,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(a(this._intrinsicSize,e,r),!V(this._intrinsicSize[0])||!V(this._intrinsicSize[1])))throw new t("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");let v;this._fastUpdates?.visualVariables.size||o(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates?v=new se({..._,...this._fastUpdates.materialParameters,size:l(this._intrinsicSize)},this._context):(_.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,_.normalType=I.Compressed,v=new ie(_,this._context)),v.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,cullFace:v.transparent||"none"===c?G.None:G.Back}),this._materials[0]=v,this._context.stage.add(v)}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,ae,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this._createAs3DShape(e,r)}layerOpacityChanged(){const e=this.symbolLayer?.material?.color,t=this._getCombinedOpacity(e);this._materials[0]?.setParameters({opacity:t})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,P)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return R.RecreateSymbol;if(!E(this._fastUpdates,t,this._vvConvertOptions))return R.RecreateSymbol;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return R.FastUpdate}_getVertexData(e){let t=0;const r=e.paths,i=[],s=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const h of r)t+=h.length;const n=x(3*t);let l,c=0;for(const h of r){i.push({offset:c,numVertices:h.length});for(const t of h)n[c++]=t[0],n[c++]=t[1],n[c++]=e.hasZ?t[2]:0}return null==a||s.equals(a)||y(n,s,0,n,a,0,t)?(null==a||a.equals(o)?l=w(n):(l=x(3*t),y(n,a,0,l,o,0,t)),{pathVertexDataInfos:i,vertexDataES:n,vertexDataRS:l}):null}_createAs3DShape(e,t){const{graphic:a,renderingInfo:o}=e,n=a.geometry,l=this._getVertexData(n);if(null==l)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===l.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some((e=>e.length>0))||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const h=new Array,p=n.spatialReference,f=g(),d=this._context.renderCoordsHelper,u=new O(l.vertexDataES),b=a.uid;for(const g of l.pathVertexDataInfos){const e=g.numVertices;if(e<2)continue;const n=g.offset;if(null!=this._context.clippingExtent&&(_(l.vertexDataES,n,e,f),!v(f,this._context.clippingExtent)))continue;const y=new Array,x=n+3*e;for(let r=n;r<x;r+=3){u.offset=r;const e=j(u,this._context.elevationProvider,t,d);m(pe,l.vertexDataRS[r],l.vertexDataRS[r+1],l.vertexDataRS[r+2]),d.setAltitude(pe,e),l.vertexDataRS[r]=pe[0],l.vertexDataRS[r+1]=pe[1],l.vertexDataRS[r+2]=pe[2],y.push(te(this._upVectorAlignment))}const w=new F(y,l.vertexDataES,l.vertexDataRS,n);ne(w,this._upVectorAlignment,this._context.renderCoordsHelper);const P=new M(w,this._profile,this._extruder,this._startCap,this._endCap);let S=null;if(this._fastUpdates){const e=this._fastUpdates.visualVariables,t=z(e.size?.field,a)??0,r=z(e.color?.field,a)??0,i=z(e.opacity?.field,a)??0;S=new Q(P,t,r,i)}else{const e=c(this._intrinsicSize);if(this._drivenProperties.size){const t=o.size??["symbol-value","symbol-value","symbol-value"];e[0]*=le(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),e[1]*=le(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0)}let t;if(this._drivenProperties.color&&(t=o.color??this._getFallbackOpacityAndColor()),this._drivenProperties.opacity){const e=o.opacity??this._getFallbackOpacityAndColor()[3];t=t?[t[0],t[1],t[2],e]:[1,1,1,e]}const r=new X(P);r.bake(e),t&&r.bakeVertexColors(t),S=r}const C=S.createGeometryData(),D=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:b,layerUid:this._context.layer.uid}),L=new J(this._materials[0],C,S,p,this._stencilWidth,D);L.transformation=r(s(),i,P.path.origin),h.push(L),this._usedMemory+=P.usedMemory}if(0===h.length)return null;const y=new B({geometries:h,layerUid:this._context.layer.uid,graphicUid:b}),x=new C(this,y,h,null,null,((e,t,r,i,s)=>he(e,t,i,s,this._upVectorAlignment)),t);return x.alignedSampledElevation=0,x.needsElevationUpdates=P(t.mode),x}_getFallbackOpacityAndColor(){const t=this.symbolLayer?.material?.color;return e.toUnitRGBA(t)??b}}function ne(e,t,r){const{origin:i,positions:s}=e;let a=e.offset;switch(t){default:case Z.World:for(const t of e.vertices)pe[0]=s[a++]+i[0],pe[1]=s[a++]+i[1],pe[2]=s[a++]+i[2],r.worldUpAtPosition(pe,pe),t.setFrameFromUpVector(pe);break;case Z.Path:pe[0]=s[a]+i[0],pe[1]=s[a+1]+i[1],pe[2]=s[a+2]+i[2],r.worldUpAtPosition(pe,pe),Y(e,pe)}}function le(e,t,r){switch(e){case"symbol-value":return r;case"proportional":return t;default:return e}}function ce(e,t,r,i){let s=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,c=e.offset+3*o.length;for(let h=e.offset;h<c;h+=3)m(pe,l[h],l[h+1],l[h+2]),r(pe,fe),s+=fe.sampledElevation,pe[0]=n[h]+a[0],pe[1]=n[h+1]+a[1],pe[2]=n[h+2]+a[2],i.setAltitude(pe,fe.z),n[h]=pe[0]-a[0],n[h+1]=pe[1]-a[1],n[h+2]=pe[2]-a[2];return e.updatePathVertexInformation(),s/o.length}function he(e,t,r,i,s){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!K(l))continue;const e=l.path,o=e.builder.path;n+=ce(o,t,r,i),s!==Z.World&&ne(o,s,i),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(l,re.POSITION)}return n/o.length}function me(e){return 1===(e.material?.color?.a??1)}const pe=u(),fe=new S;export{oe as Graphics3DPathSymbolLayer};
5
+ import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Error.js";import{translate as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as i,create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as a,scale as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as n,fromArray as l,clone as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{F as h,i as m}from"../../../../chunks/vec32.js";import{clone as p,ZEROS as f,fromArray as d,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as y}from"../../../../geometry/projection/projectBuffer.js";import{create as g,fromSubBuffer as _,intersectsClippingArea as v}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as x,doubleArrayFrom as w}from"../../../../geometry/support/DoubleArray.js";import{needsElevationUpdates3D as P,evaluateElevationAlignmentAtPoint as j,SampleElevationInfo as S}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{pathNumRoundJoinSubdivisions as D,pathNumRoundCapExtrusionSubdivisions as L}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as A}from"./Graphics3DSymbolLayer.js";import{isValidSize as V}from"./graphicUtils.js";import{ApplyRendererDiffResult as R}from"./interfaces.js";import{ConvertOptions as U,initFastSymbolUpdatesState as k,updateFastSymbolUpdatesState as E,getAttributeValue as z}from"../support/FastSymbolUpdates.js";import{SamplePosition as O}from"../../support/ElevationProvider.js";import{NormalType as I}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{CullFaceOptions as G}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as B}from"../../webgl-engine/lib/Object3D.js";import{Path as F}from"../../webgl-engine/lib/Path.js";import{PathBuilder as M}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as q,TriangulationCapBuilder as H,NoCapBuilder as N}from"../../webgl-engine/lib/PathCapBuilder.js";import{SimpleExtruder as W,MiterExtruder as T}from"../../webgl-engine/lib/PathExtruder.js";import{UpVectorAlignment as Z,PathGeometry as J,isPathGeometry as K}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as Q,StaticPathGeometry as X}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as Y}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as $,circleProfiles as ee}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as te}from"../../webgl-engine/lib/PathVertex.js";import{VertexAttribute as re}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as ie}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as se}from"../../webgl-engine/materials/PathMaterial.js";const ae=["polyline"];class oe extends A{constructor(e,t,r,i){super(e,t,r,i,me(t)),this._intrinsicSize=n(1,1),this._upVectorAlignment=Z.Path,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}async doLoad(){const e=null!=this.symbolLayer.width?this.symbolLayer.width:this.symbolLayer.height,r=null!=this.symbolLayer.height?this.symbolLayer.height:e;this._vvConvertOptions=new U({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[e,1,r],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:[e,1,r]});const i=this._context.renderer?.visualVariables;this._fastUpdates=i?.length?k(this._context.renderer,this._vvConvertOptions):null;const s=this.symbolLayer.anchor||"center";this._upVectorAlignment="heading"===this.symbolLayer.profileRotation?Z.World:Z.Path;const n=this.symbolLayer.profile||"circle";switch(n){default:case"circle":this._profile=ee[s];break;case"quad":this._profile=$[s]}switch(this.symbolLayer.join){case"round":this._extruder=new T(0,D);break;case"bevel":this._extruder=new T(0,1);break;case"miter":this._extruder=new T(.8*Math.PI,1);break;default:this._extruder=new W}const c=this.symbolLayer.cap||"butt";switch(c){case"none":this._startCap=new N,this._endCap=new N;break;case"butt":default:this._startCap=new H(this._profile,0),this._endCap=new H(this._profile,0,!0);break;case"square":this._startCap=new H(this._profile,-.5),this._endCap=new H(this._profile,.5,!0);break;case"round":{const e="quad"===n;this._startCap=new q({profile:this._profile,flip:!1,breakNormals:e,subdivisions:L}),this._endCap=new q({profile:this._profile,flip:!0,breakNormals:e,subdivisions:L});break}}const m=this.symbolLayer?.material?.emissiveFactor,u=m?h(p(m)):f,b=this.symbolLayer?.material?.color,y=this._getCombinedOpacityAndColor(b),g=d(y),_={diffuse:g,ambient:g,emissiveFactor:u,opacity:y[3],drivenOpacity:this.needsDrivenTransparentPass,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(a(this._intrinsicSize,e,r),!V(this._intrinsicSize[0])||!V(this._intrinsicSize[1])))throw new t("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");let v;this._fastUpdates?.visualVariables.size||o(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates?v=new se({..._,...this._fastUpdates.materialParameters,size:l(this._intrinsicSize)},this._context):(_.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,_.normalType=I.Compressed,v=new ie(_,this._context)),v.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,cullFace:v.transparent||"none"===c?G.None:G.Back}),this._materials[0]=v,this._context.stage.add(v)}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,ae,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this._createAs3DShape(e,r)}layerOpacityChanged(){const e=this.symbolLayer?.material?.color,t=this._getCombinedOpacity(e);this._materials[0]?.setParameters({opacity:t})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,P)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return R.RecreateSymbol;if(!E(this._fastUpdates,t,this._vvConvertOptions))return R.RecreateSymbol;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return R.FastUpdate}_getVertexData(e){let t=0;const r=e.paths,i=[],s=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const h of r)t+=h.length;const n=x(3*t);let l,c=0;for(const h of r){i.push({offset:c,numVertices:h.length});for(const t of h)n[c++]=t[0],n[c++]=t[1],n[c++]=e.hasZ?t[2]:0}return null==a||s.equals(a)||y(n,s,0,n,a,0,t)?(null==a||a.equals(o)?l=w(n):(l=x(3*t),y(n,a,0,l,o,0,t)),{pathVertexDataInfos:i,vertexDataES:n,vertexDataRS:l}):null}_createAs3DShape(e,t){const{graphic:a,renderingInfo:o}=e,n=a.geometry,l=this._getVertexData(n);if(null==l)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===l.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some((e=>e.length>0))||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const h=new Array,p=n.spatialReference,f=g(),d=this._context.renderCoordsHelper,u=new O(l.vertexDataES),b=a.uid;let y=0;for(const g of l.pathVertexDataInfos){const e=g.numVertices;if(e<2)continue;const n=g.offset;if(null!=this._context.clippingExtent&&(_(l.vertexDataES,n,e,f),!v(f,this._context.clippingExtent)))continue;const x=new Array,w=n+3*e;for(let r=n;r<w;r+=3){u.offset=r;const e=j(u,this._context.elevationProvider,t,d);m(pe,l.vertexDataRS[r],l.vertexDataRS[r+1],l.vertexDataRS[r+2]),d.setAltitude(pe,e),l.vertexDataRS[r]=pe[0],l.vertexDataRS[r+1]=pe[1],l.vertexDataRS[r+2]=pe[2],x.push(te(this._upVectorAlignment))}const P=new F(x,l.vertexDataES,l.vertexDataRS,n);ne(P,this._upVectorAlignment,this._context.renderCoordsHelper);const S=new M(P,this._profile,this._extruder,this._startCap,this._endCap);let C=null;if(this._fastUpdates){const e=this._fastUpdates.visualVariables,t=z(e.size?.field,a)??0,r=z(e.color?.field,a)??0,i=z(e.opacity?.field,a)??0;C=new Q(S,t,r,i)}else{const e=c(this._intrinsicSize);if(this._drivenProperties.size){const t=o.size??["symbol-value","symbol-value","symbol-value"];e[0]*=le(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),e[1]*=le(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0)}let t;if(this._drivenProperties.color&&(t=o.color??this._getFallbackOpacityAndColor()),this._drivenProperties.opacity){const e=o.opacity??this._getFallbackOpacityAndColor()[3];t=t?[t[0],t[1],t[2],e]:[1,1,1,e]}const r=new X(S);r.bake(e),t&&r.bakeVertexColors(t),C=r}const D=C.createGeometryData(),L=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:b,layerUid:this._context.layer.uid}),A=new J(this._materials[0],D,C,p,this._stencilWidth,L);A.transformation=r(s(),i,S.path.origin),h.push(A),y+=S.usedMemory}if(0===h.length)return null;const x=new B({geometries:h,layerUid:this._context.layer.uid,graphicUid:b}),w=new C(this,x,h,null,null,((e,t,r,i,s)=>he(e,t,i,s,this._upVectorAlignment)),t,null,y);return w.alignedSampledElevation=0,w.needsElevationUpdates=P(t.mode),w}_getFallbackOpacityAndColor(){const t=this.symbolLayer?.material?.color;return e.toUnitRGBA(t)??b}}function ne(e,t,r){const{origin:i,positions:s}=e;let a=e.offset;switch(t){default:case Z.World:for(const t of e.vertices)pe[0]=s[a++]+i[0],pe[1]=s[a++]+i[1],pe[2]=s[a++]+i[2],r.worldUpAtPosition(pe,pe),t.setFrameFromUpVector(pe);break;case Z.Path:pe[0]=s[a]+i[0],pe[1]=s[a+1]+i[1],pe[2]=s[a+2]+i[2],r.worldUpAtPosition(pe,pe),Y(e,pe)}}function le(e,t,r){switch(e){case"symbol-value":return r;case"proportional":return t;default:return e}}function ce(e,t,r,i){let s=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,c=e.offset+3*o.length;for(let h=e.offset;h<c;h+=3)m(pe,l[h],l[h+1],l[h+2]),r(pe,fe),s+=fe.sampledElevation,pe[0]=n[h]+a[0],pe[1]=n[h+1]+a[1],pe[2]=n[h+2]+a[2],i.setAltitude(pe,fe.z),n[h]=pe[0]-a[0],n[h+1]=pe[1]-a[1],n[h+2]=pe[2]-a[2];return e.updatePathVertexInformation(),s/o.length}function he(e,t,r,i,s){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!K(l))continue;const e=l.path,o=e.builder.path;n+=ce(o,t,r,i),s!==Z.World&&ne(o,s,i),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(l,re.POSITION)}return n/o.length}function me(e){return 1===(e.material?.color?.a??1)}const pe=u(),fe=new S;export{oe as Graphics3DPathSymbolLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import r from"../../../../../core/Error.js";import{makeHandle as t}from"../../../../../core/handleUtils.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import n from"../../../../../core/Promise.js";import{on as i}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{FeatureLayerViewPerformanceInfo as u}from"../../FeatureLayerViewPerformanceInfo.js";import{Feature3DPipelineWorkerHandle as l}from"./Feature3DPipelineWorkerHandle.js";import{FeaturePipelineRenderManager as d}from"./rendering/FeaturePipelineRenderManager.js";import{emptyHighlightHandle as p}from"../../support/highlightUtils.js";import{LayerViewPerformanceInfo as m}from"../../support/LayerViewPerformanceInfo.js";import{UpdatePolicy as c}from"../../../webgl-engine/lib/UpdatePolicy.js";let y=class extends n{constructor(e){super(e),this._renderer=null,this.graphicsQuery={queryForSymbologySnapping:(e,t)=>{throw new r("unsupported-symbology-snapping")},executeQuery:async(e,r)=>await this._workerHandle.executeQuery(e,r),executeQueryForIds:async(e,r)=>await this._workerHandle.executeQueryForIds(e,r),executeQueryForCount:async(e,r)=>await this._workerHandle.executeQueryForCount(e,r),executeQueryForExtent:async(e,r)=>await this._workerHandle.executeQueryForExtent(e,r),executeQueryForLatestObservations:async(e,r)=>await this._workerHandle.executeQueryForLatestObservations(e,r)},this.maximumNumberOfFeatures=1e3}initialize(){if("point"!==this.layerView.layer.geometryType)throw new r("unsupported-geometry-type",`${this.layerView.layer.geometryType} is not supported`);this.addResolvingPromise(this.setup())}destroy(){this.removeAllHandles(),this._workerHandle.destroy(),o(this._renderer)}async setup(){const{layer:e,view:r}=this.layerView,{spatialReference:t,renderSpatialReference:o,resourceController:n}=r,s=r.state.viewingMode;if(this._renderer=new d({view:r,layerUid:e.uid}),"feature"!==e.type)throw new Error("Only FeatureLayer is supported");const a=new l({schedule:e=>n.immediate.schedule(e),layer:e,viewSpatialReference:t,renderSpatialReference:o,viewingMode:s,renderer:this._renderer});this._workerHandle=await a.when(),this.addHandles([this.layerView.view.featureTiles.addClient(),i((()=>this.layerView.view.featureTiles.tiles),"change",(e=>{this._workerHandle.onTileTreeChange(e)}),{onListenerAdd:e=>this._workerHandle.onTileTreeChange({added:e.toArray(),removed:[]}),onListenerRemove:e=>this._workerHandle.onTileTreeChange({added:[],removed:e.toArray()})}),r.elevationProvider.on("elevation-change",(e=>this._workerHandle.onElevationChange(e)))])}get legendEnabled(){return!1}get hasAllFeatures(){return!1}get hasAllFeaturesInView(){return!1}get hasFullGeometries(){return!1}get symbologySnappingSupported(){return!1}get scaleVisibilitySuspended(){return!1}get suspendInfo(){return{}}get updating(){return this._workerHandle.updating}get dataUpdating(){return!1}get updatePolicy(){return c.ASYNC}get maximumNumberOfFeaturesExceeded(){return!1}get updatingProgressValue(){return 1}get usedMemory(){return this._renderer?.usedMemory??0}get unloadedMemory(){return 0}get ignoresMemoryFactor(){return!0}get totalFeatures(){return this._renderer?.totalFeatures??0}get performanceInfo(){const e=this.totalFeatures;return new u(new m(this.usedMemory,e,e,this.maximumNumberOfFeatures,0,null),e,e,this.maximumNumberOfFeaturesExceeded,"tiles","n/a")}get suspendResumeExtentMode(){return"computed"}forEachGraphic(e){}findGraphic(e){return null}highlight(e){return p}maskOccludee(e){return t()}async whenGraphicBounds(e,r){return null}computeAttachmentOrigin(e,r){return null}elevationAlignPointsInFeatures(e,t){throw new r("unsupported-elevation-alignment")}async doRefresh(e){}setVisibility(e,r){}getMissingAttributesForFeature(e){return null}getHydratedGeometry(e){return null}};e([s()],y.prototype,"layerView",void 0),e([s()],y.prototype,"updating",null),e([s()],y.prototype,"totalFeatures",null),y=e([a("esri.views.3d.layers.graphics.pipeline.Feature3DPipeline")],y);export{y as Feature3DPipeline};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import r from"../../../../../core/Error.js";import{makeHandle as t}from"../../../../../core/handleUtils.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import n from"../../../../../core/Promise.js";import{on as i}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{FeatureLayerViewPerformanceInfo as u}from"../../FeatureLayerViewPerformanceInfo.js";import{Feature3DPipelineWorkerHandle as l}from"./Feature3DPipelineWorkerHandle.js";import{FeaturePipelineRenderManager as d}from"./rendering/FeaturePipelineRenderManager.js";import{emptyHighlightHandle as p}from"../../support/highlightUtils.js";import{LayerViewPerformanceInfo as m}from"../../support/LayerViewPerformanceInfo.js";import{UpdatePolicy as c}from"../../../webgl-engine/lib/UpdatePolicy.js";let y=class extends n{constructor(e){super(e),this._renderer=null,this.graphicsQuery={queryForSymbologySnapping:(e,t)=>{throw new r("unsupported-symbology-snapping")},executeQuery:async(e,r)=>await this._workerHandle.executeQuery(e,r),executeQueryForIds:async(e,r)=>await this._workerHandle.executeQueryForIds(e,r),executeQueryForCount:async(e,r)=>await this._workerHandle.executeQueryForCount(e,r),executeQueryForExtent:async(e,r)=>await this._workerHandle.executeQueryForExtent(e,r),executeQueryForLatestObservations:async(e,r)=>await this._workerHandle.executeQueryForLatestObservations(e,r)},this.maximumNumberOfFeatures=1e3}initialize(){if("point"!==this.layerView.layer.geometryType)throw new r("unsupported-geometry-type",`${this.layerView.layer.geometryType} is not supported`);this.addResolvingPromise(this.setup())}destroy(){this.removeAllHandles(),this._workerHandle.destroy(),o(this._renderer)}async setup(){const{layer:e,view:r}=this.layerView,{spatialReference:t,renderSpatialReference:o,resourceController:n,renderCoordsHelper:s,elevationProvider:a}=r,u=r.state.viewingMode;if(this._renderer=new d({view:r,layerUid:e.uid}),"feature"!==e.type)throw new Error("Only FeatureLayer is supported");const p=new l({schedule:e=>n.immediate.schedule(e),layer:e,viewSpatialReference:t,renderSpatialReference:o,viewingMode:u,renderer:this._renderer,elevationProvider:a,renderCoordsHelper:s});this._workerHandle=await p.when(),this.addHandles([this.layerView.view.featureTiles.addClient(),i((()=>this.layerView.view.featureTiles.tiles),"change",(e=>{this._workerHandle.onTileTreeChange(e)}),{onListenerAdd:e=>this._workerHandle.onTileTreeChange({added:e.toArray(),removed:[]}),onListenerRemove:e=>this._workerHandle.onTileTreeChange({added:[],removed:e.toArray()})}),r.elevationProvider.on("elevation-change",(e=>this._workerHandle.onElevationChange(e)))])}get legendEnabled(){return!1}get hasAllFeatures(){return!1}get hasAllFeaturesInView(){return!1}get hasFullGeometries(){return!1}get symbologySnappingSupported(){return!1}get scaleVisibilitySuspended(){return!1}get suspendInfo(){return{}}get updating(){return this._workerHandle.updating}get dataUpdating(){return!1}get updatePolicy(){return c.ASYNC}get maximumNumberOfFeaturesExceeded(){return!1}get updatingProgressValue(){return 1}get usedMemory(){return this._renderer?.usedMemory??0}get unloadedMemory(){return 0}get ignoresMemoryFactor(){return!0}get totalFeatures(){return this._renderer?.totalFeatures??0}get performanceInfo(){const e=this.totalFeatures;return new u(new m(this.usedMemory,e,e,this.maximumNumberOfFeatures,0,null),e,e,this.maximumNumberOfFeaturesExceeded,"tiles","n/a")}get suspendResumeExtentMode(){return"computed"}forEachGraphic(e){}findGraphic(e){return null}highlight(e){return p}maskOccludee(e){return t()}async whenGraphicBounds(e,r){return null}computeAttachmentOrigin(e,r){return null}elevationAlignPointsInFeatures(e,t){throw new r("unsupported-elevation-alignment")}async doRefresh(e){}setVisibility(e,r){}getMissingAttributesForFeature(e){return null}getHydratedGeometry(e){return null}};e([s()],y.prototype,"layerView",void 0),e([s()],y.prototype,"updating",null),e([s()],y.prototype,"totalFeatures",null),y=e([a("esri.views.3d.layers.graphics.pipeline.Feature3DPipeline")],y);export{y as Feature3DPipeline};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Evented.js";import{throwIfAborted as r}from"../../../../../core/promiseUtils.js";import{watch as a,initial as i}from"../../../../../core/reactiveUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import o from"../../../../../geometry/Extent.js";import{initializeProjection as u,project as m}from"../../../../../geometry/projection.js";import d from"../../../../../geometry/SpatialReference.js";import{QueryEngine as c}from"../../../../../layers/graphics/data/QueryEngine.js";import l from"../../../../../rest/support/Query.js";import{Tile3DManager as p}from"./Tile3DManager.js";import{TiledFeatureStore as y}from"./featureSet/TiledFeatureStore.js";import{Tile3DFetcher as h}from"./fetching/Tile3DFetcher.js";import{RenderCommandContext as f}from"./rendering/RenderCommandContext.js";import{UniqueValueFeatureRenderer as _}from"./symbolization/UniqueValueFeatureRenderer.js";import{RenderCoordsHelper as g}from"../../../support/RenderCoordsHelper.js";let C=class extends t.EventedAccessor{constructor(){super(...arguments),this.remoteClient=null,this._featureStore=new y,this._tileManager=null,this._renderer=null,this._fetcher=null,this._queryEngine=null,this._defaultQueryJSON=null}get updating(){return this._tileManager.updating}destroy(){this._featureStore.clear(),this._tileManager?.destroy()}async setup({viewSpatialReference:e,renderSpatialReference:t,viewingMode:r,baseQuery:n,url:s,objectIdField:y,capabilities:C,fieldsIndex:S,timeInfo:F,fullExtent:j}){const Q=d.fromJSON(e),v=d.fromJSON(t);this._fetcher=new h(Q,l.fromJSON(n),s,y,C),this._queryEngine=new c({hasZ:!0,hasM:!1,geometryType:"esriGeometryPoint",objectIdField:y,fieldsIndex:S,availableFields:[y],spatialReference:e,featureStore:this._featureStore,timeInfo:F}),this._renderer=new _({viewSpatialReference:Q,renderSpatialReference:v,renderCoordsHelper:g.create(r,v),renderCommandContext:new f(r,(async(e,t)=>{const r={materialId:e,type:t};await this.remoteClient.invoke("createMaterial",r)}),(async e=>{const t={materialId:e};await this.remoteClient.invoke("createDirectRenderer",t)}),(async(e,t,r)=>{const a={rendererId:e,lodRenderGeometry:t};await this.remoteClient.invoke("createLoDRenderer",a,{transferList:r})}),(async e=>{const t={commands:e.commands};await this.remoteClient.invoke("dispatchRenderCommands",t,{transferList:e.transferList})}))}),this._defaultQueryJSON=new l({outSpatialReference:Q}).toJSON();let x=null;if(null!=j){const e=o.fromJSON(j);await u(e.spatialReference,Q),x=m(e,Q)}return this._tileManager=new p({loadTile:(e,t)=>this._fetcher.fetch(e,t),createAddFeatureDataCommand:(e,t)=>this._createAddFeatureDataCommand(e,t),createRemoveFeatureDataCommand:e=>this._createRemoveFeatureDataCommand(e),createUpdateFeatureDataVisibilityCommand:(e,t)=>this._createUpdateFeatureDataVisibilityCommand(e,t),extent:x}),this.addHandles(a((()=>this.updating),(e=>{this.emit("notify-updating",{updating:e})})),i),await this._renderer.load(),w}async executeQuery(e,t){return{result:await this._queryEngine.executeQuery(this._ensureQuery(e),t)}}async executeQueryForIds(e,t){const r=await this._queryEngine.executeQueryForIdSet(this._ensureQuery(e),t);return{result:Array.from(r)}}async executeQueryForCount(e,t){return{result:await this._queryEngine.executeQueryForCount(this._ensureQuery(e),t)}}async executeQueryForExtent(e,t){return{result:await this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t)}}async executeQueryForLatestObservations(e,t){return{result:await this._queryEngine.executeQueryForLatestObservations(this._ensureQuery(e),t)}}async onTileTreeChange(e){return await this._tileManager.onTileTreeChange(e),w}async onElevationChange(e){return w}async _createAddFeatureDataCommand(e,t){const a=this._featureStore,i=await this._renderer.createAddCommand(e);return r(t),i.appendPipelineStateCommand((()=>{a.addTile(e)})),i}async _createRemoveFeatureDataCommand(e){const t=this._featureStore,r=this._renderer,a=await r.createRemoveCommand(e);return a.appendPipelineStateCommand((()=>{t.removeTile(e)})),a}async _createUpdateFeatureDataVisibilityCommand(e,t){const a=this._renderer,i=await a.createUpdateVisibilityCommand(e);return r(t),i}_ensureQuery(e){return e??this._defaultQueryJSON}};e([n()],C.prototype,"updating",null),C=e([s("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorker")],C);const S=C,w={result:void 0};export{S as default};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Evented.js";import{throwIfAborted as r}from"../../../../../core/promiseUtils.js";import{watch as a,initial as n}from"../../../../../core/reactiveUtils.js";import{property as i}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import s from"../../../../../geometry/Extent.js";import{initializeProjection as u,project as m}from"../../../../../geometry/projection.js";import c from"../../../../../geometry/SpatialReference.js";import{QueryEngine as d}from"../../../../../layers/graphics/data/QueryEngine.js";import l from"../../../../../rest/support/Query.js";import{Tile3DManager as p}from"./Tile3DManager.js";import{TiledFeatureStore as y}from"./featureSet/TiledFeatureStore.js";import{Tile3DFetcher as h}from"./fetching/Tile3DFetcher.js";import{RenderCommandContext as f}from"./rendering/RenderCommandContext.js";import{UniqueValueFeatureRenderer as _}from"./symbolization/UniqueValueFeatureRenderer.js";import{RenderCoordsHelper as g}from"../../../support/RenderCoordsHelper.js";let C=class extends t.EventedAccessor{constructor(){super(...arguments),this.remoteClient=null,this._featureStore=new y,this._tileManager=null,this._renderer=null,this._fetcher=null,this._queryEngine=null,this._defaultQueryJSON=null}get updating(){return this._tileManager.updating}destroy(){this._featureStore.clear(),this._tileManager?.destroy()}async setup({viewSpatialReference:e,renderSpatialReference:t,viewingMode:r,baseQuery:i,url:o,objectIdField:y,capabilities:C,fieldsIndex:w,timeInfo:v,elevationInfo:F,fullExtent:j}){const R=c.fromJSON(e),x=c.fromJSON(t);this._fetcher=new h(R,l.fromJSON(i),o,y,C),this._queryEngine=new d({hasZ:!0,hasM:!1,geometryType:"esriGeometryPoint",objectIdField:y,fieldsIndex:w,availableFields:[y],spatialReference:e,featureStore:this._featureStore,timeInfo:v});const Q={createMaterial:async(e,t)=>{const r={materialId:e,type:t};await this.remoteClient.invoke("createMaterial",r)},createDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("createDirectRenderer",t)},createLodRenderer:async(e,t,r)=>{const a={rendererId:e,lodRenderGeometry:t};await this.remoteClient.invoke("createLoDRenderer",a,{transferList:r})},executeRenderCommands:async e=>{const t={commands:e.commands};await this.remoteClient.invoke("dispatchRenderCommands",t,{transferList:e.transferList})},applyElevationAlignmentTo:async e=>{const t={mapPoints:e};return await this.remoteClient.invoke("applyElevationAlignment",t,{transferList:[e.buffer]})}};this._renderer=new _({viewSpatialReference:R,renderSpatialReference:x,renderCoordsHelper:g.create(r,x),renderCommandContext:new f(r,Q),elevationInfo:F??{},mainThreadDelegate:Q}),this._defaultQueryJSON=new l({outSpatialReference:R}).toJSON();let E=null;if(null!=j){const e=s.fromJSON(j);await u(e.spatialReference,R),E=m(e,R)}return this._tileManager=new p({loadTile:(e,t)=>this._fetcher.fetch(e,t),createAddFeatureDataCommand:(e,t)=>this._createAddFeatureDataCommand(e,t),createRemoveFeatureDataCommand:e=>this._createRemoveFeatureDataCommand(e),createUpdateFeatureDataVisibilityCommand:(e,t)=>this._createUpdateFeatureDataVisibilityCommand(e,t),extent:E}),this.addHandles(a((()=>this.updating),(e=>{this.emit("notify-updating",{updating:e})})),n),await this._renderer.load(),S}async executeQuery(e,t){return{result:await this._queryEngine.executeQuery(this._ensureQuery(e),t)}}async executeQueryForIds(e,t){const r=await this._queryEngine.executeQueryForIdSet(this._ensureQuery(e),t);return{result:Array.from(r)}}async executeQueryForCount(e,t){return{result:await this._queryEngine.executeQueryForCount(this._ensureQuery(e),t)}}async executeQueryForExtent(e,t){return{result:await this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t)}}async executeQueryForLatestObservations(e,t){return{result:await this._queryEngine.executeQueryForLatestObservations(this._ensureQuery(e),t)}}async onTileTreeChange(e){return await this._tileManager.onTileTreeChange(e),S}async onElevationChange(e){return S}async _createAddFeatureDataCommand(e,t){const a=this._featureStore,n=await this._renderer.createAddCommand(e);return r(t),n.appendPipelineStateCommand((()=>{a.addTile(e)})),n}async _createRemoveFeatureDataCommand(e){const t=this._featureStore,r=this._renderer,a=await r.createRemoveCommand(e);return a.appendPipelineStateCommand((()=>{t.removeTile(e)})),a}async _createUpdateFeatureDataVisibilityCommand(e,t){const a=this._renderer,n=await a.createUpdateVisibilityCommand(e);return r(t),n}_ensureQuery(e){return e??this._defaultQueryJSON}};e([i()],C.prototype,"updating",null),C=e([o("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorker")],C);const w=C,S={result:void 0};export{w as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Promise.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{WorkerHandle as n}from"../../../../../core/workers/WorkerHandle.js";import a from"../../../../../geometry/Extent.js";import{clone as i}from"../../../../../geometry/support/aaBoundingRect.js";import s from"../../../../../rest/support/FeatureSet.js";let d=class extends t{constructor(e){super(e),this.schedule=null,this._workerUpdating=!0}get updating(){return this._workerUpdating}initialize(){this._workerHandle=new c(this.schedule,{createMaterial:async({materialId:e,type:t})=>(await this.renderer.createMaterial(e,t),l),createDirectRenderer:async({materialId:e})=>(await this.renderer.createDirectRenderer(e),l),createLoDRenderer:async({rendererId:e,lodRenderGeometry:t},r)=>(await this.renderer.createLoDRenderer(e,t,r?.signal??void 0),l),dispatchRenderCommands:async({commands:e})=>(await this.renderer.executeRenderCommands(e),l)});const{layer:e,viewSpatialReference:t,renderSpatialReference:r}=this;this.addResolvingPromise((async()=>{await e.load();const{fullExtent:o}=e;await this._workerHandle.invokeMethod("setup",{url:e.parsedUrl?.path??"",baseQuery:e.createQuery().toJSON(),viewSpatialReference:t.toJSON(),renderSpatialReference:r.toJSON(),viewingMode:this.viewingMode,objectIdField:e.objectIdField,capabilities:e.capabilities,timeInfo:e.timeInfo?.toJSON(),fieldsIndex:e.fieldsIndex.toJSON(),fullExtent:o?.toJSON()})})()),this.addHandles(this._workerHandle.on("notify-updating",(({updating:e})=>{this._workerUpdating=e})))}onTileTreeChange({added:e,removed:t}){if(0===e.length&&0===t.length)return;const r=e.map(u),o=t.map(u);this._workerHandle.invokeMethod("onTileTreeChange",{added:r,removed:o})}onElevationChange(e){this._workerHandle.invokeMethod("onElevationChange",{context:e.context,spatialReference:e.spatialReference?.toJSON(),extent:i(e.extent)})}async executeQuery(e,t){const r=await this._workerHandle.invokeMethod("executeQuery",e?.toJSON(),t),o=s.fromJSON(r);return this._ensureLayerOnFeatures(o),o}async executeQueryForIds(e,t){return await this._workerHandle.invokeMethod("executeQueryForIds",e?.toJSON(),t)}async executeQueryForCount(e,t){return await this._workerHandle.invokeMethod("executeQueryForCount",e?.toJSON(),t)}async executeQueryForExtent(e,t){const{count:r,extent:o}=await this._workerHandle.invokeMethod("executeQueryForExtent",e?.toJSON(),t);return{count:r,extent:a.fromJSON(o)}}async executeQueryForLatestObservations(e,t){const r=await this._workerHandle.invokeMethod("executeQueryForLatestObservations",e?.toJSON(),t),o=s.fromJSON(r);return this._ensureLayerOnFeatures(o),o}_ensureLayerOnFeatures(e){const{layer:t}=this;for(const r of e.features)r.layer=t,r.sourceLayer=t}};e([r()],d.prototype,"updating",null),e([r({constructOnly:!0})],d.prototype,"schedule",void 0),e([r({constructOnly:!0})],d.prototype,"layer",void 0),e([r({constructOnly:!0})],d.prototype,"viewSpatialReference",void 0),e([r({constructOnly:!0})],d.prototype,"renderSpatialReference",void 0),e([r({constructOnly:!0})],d.prototype,"viewingMode",void 0),e([r({constructOnly:!0})],d.prototype,"renderer",void 0),e([r()],d.prototype,"_workerUpdating",void 0),d=e([o("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorkerHandle")],d);class c extends n{constructor(e,t){super("Feature3DPipelineWorker","setup",{},e,{strategy:"dedicated",client:t})}}function u({id:e,lij:t,extent:r}){return{id:e,lij:t,extent:r}}const l={result:void 0};export{d as Feature3DPipelineWorkerHandle};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Promise.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{WorkerHandle as n}from"../../../../../core/workers/WorkerHandle.js";import i from"../../../../../geometry/Extent.js";import{clone as a}from"../../../../../geometry/support/aaBoundingRect.js";import s from"../../../../../rest/support/FeatureSet.js";import{ElevationContext as d}from"../ElevationContext.js";import{applyElevationAlignment as c}from"./utils.js";let l=class extends t{constructor(e){super(e),this.schedule=null,this._workerUpdating=!0}get updating(){return this._workerUpdating}initialize(){const{layer:e,viewSpatialReference:t,renderSpatialReference:r}=this,o=e.elevationInfo;this._elevationContext=d.fromElevationInfo(o),this._workerHandle=new u(this.schedule,{createMaterial:async({materialId:e,type:t})=>(await this.renderer.createMaterial(e,t),y),createDirectRenderer:async({materialId:e})=>(await this.renderer.createDirectRenderer(e),y),createLoDRenderer:async({rendererId:e,lodRenderGeometry:t},r)=>(await this.renderer.createLoDRenderer(e,t,r?.signal??void 0),y),dispatchRenderCommands:async({commands:e})=>(await this.renderer.executeRenderCommands(e),y),applyElevationAlignment:async({mapPoints:e})=>{const{viewSpatialReference:t,elevationProvider:r,renderCoordsHelper:o}=this,n=c(e,t,this._elevationContext,r,o);return{result:n,transferList:[n.buffer]}}}),this.addResolvingPromise((async()=>{await e.load();const{fullExtent:n}=e;await this._workerHandle.invokeMethod("setup",{url:e.parsedUrl?.path??"",baseQuery:e.createQuery().toJSON(),viewSpatialReference:t.toJSON(),renderSpatialReference:r.toJSON(),viewingMode:this.viewingMode,objectIdField:e.objectIdField,capabilities:e.capabilities,timeInfo:e.timeInfo?.toJSON(),elevationInfo:o?.toJSON(),fieldsIndex:e.fieldsIndex.toJSON(),fullExtent:n?.toJSON()})})()),this.addHandles(this._workerHandle.on("notify-updating",(({updating:e})=>{this._workerUpdating=e})))}onTileTreeChange({added:e,removed:t}){if(0===e.length&&0===t.length)return;const r=e.map(p),o=t.map(p);this._workerHandle.invokeMethod("onTileTreeChange",{added:r,removed:o})}onElevationChange(e){this._workerHandle.invokeMethod("onElevationChange",{context:e.context,spatialReference:e.spatialReference?.toJSON(),extent:a(e.extent)})}async executeQuery(e,t){const r=await this._workerHandle.invokeMethod("executeQuery",e?.toJSON(),t),o=s.fromJSON(r);return this._ensureLayerOnFeatures(o),o}async executeQueryForIds(e,t){return await this._workerHandle.invokeMethod("executeQueryForIds",e?.toJSON(),t)}async executeQueryForCount(e,t){return await this._workerHandle.invokeMethod("executeQueryForCount",e?.toJSON(),t)}async executeQueryForExtent(e,t){const{count:r,extent:o}=await this._workerHandle.invokeMethod("executeQueryForExtent",e?.toJSON(),t);return{count:r,extent:i.fromJSON(o)}}async executeQueryForLatestObservations(e,t){const r=await this._workerHandle.invokeMethod("executeQueryForLatestObservations",e?.toJSON(),t),o=s.fromJSON(r);return this._ensureLayerOnFeatures(o),o}_ensureLayerOnFeatures(e){const{layer:t}=this;for(const r of e.features)r.layer=t,r.sourceLayer=t}};e([r()],l.prototype,"updating",null),e([r({constructOnly:!0})],l.prototype,"schedule",void 0),e([r({constructOnly:!0})],l.prototype,"layer",void 0),e([r({constructOnly:!0})],l.prototype,"viewSpatialReference",void 0),e([r({constructOnly:!0})],l.prototype,"renderSpatialReference",void 0),e([r({constructOnly:!0})],l.prototype,"viewingMode",void 0),e([r({constructOnly:!0})],l.prototype,"renderer",void 0),e([r({constructOnly:!0})],l.prototype,"elevationProvider",void 0),e([r({constructOnly:!0})],l.prototype,"renderCoordsHelper",void 0),e([r()],l.prototype,"_workerUpdating",void 0),l=e([o("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorkerHandle")],l);class u extends n{constructor(e,t){super("Feature3DPipelineWorker","setup",{},e,{strategy:"dedicated",client:t})}}function p({id:e,lij:t,extent:r}){return{id:e,lij:t,extent:r}}const y={result:void 0};export{l as Feature3DPipelineWorkerHandle};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as e}from"../../../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as t}from"../../../../../../geometry/projection/projectVectorToVector.js";import{center as o}from"../../../../../../geometry/support/aaBoundingRect.js";function n(r){const{featureCount:e}=r;if(0===e)return new Uint32Array;const t=new Uint32Array(e);return r.getObjectIdsArray(t),t}function a(r){const{featureCount:e}=r;if(0===e)return new Float64Array;const t=new Float64Array(3*e);return r.getCoordinatesArray(t),t}function i(r,t){const{featureCount:o}=r;if(0===o)return new Float64Array;const n=a(r),i=t.viewSpatialReference,c=t.renderSpatialReference,f=new Float64Array(3*o);if(!e(n,i,0,f,c,0,o))throw new Error("Failed to project coordinates");return f}function c(e,n){const a=n.viewSpatialReference,i=n.renderSpatialReference,{extent:c}=e,f=o(c),u=r();return t([f[0],f[1],0],a,u,i),u}export{i as computeRenderCoordinates,c as computeTileCenterRenderCoordinates,a as readMapCoordinates,n as readObjectIds};
5
+ import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as e}from"../../../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as t}from"../../../../../../geometry/projection/projectVectorToVector.js";import{center as o}from"../../../../../../geometry/support/aaBoundingRect.js";function n(r){const{featureCount:e}=r;if(0===e)return new Uint32Array;const t=new Uint32Array(e);return r.getObjectIdsArray(t),t}function a(r){const{featureCount:e}=r;if(0===e)return new Float64Array;const t=new Float64Array(3*e);return r.getCoordinatesArray(t),t}function i(r,e){const{featureCount:t}=r;if(0===t)return new Float64Array;return c(a(r),e)}function c(r,t){const o=r.length/3,n=t.viewSpatialReference,a=t.renderSpatialReference,i=new Float64Array(3*o);if(!e(r,n,0,i,a,0,o))throw new Error("Failed to project coordinates");return i}function f(e,n){const a=n.viewSpatialReference,i=n.renderSpatialReference,{extent:c}=e,f=o(c),u=r();return t([f[0],f[1],0],a,u,i),u}export{i as computeRenderCoordinates,f as computeTileCenterRenderCoordinates,c as projectToRenderCoordinates,a as readMapCoordinates,n as readObjectIds};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{nullUid as t}from"../../../../../../core/uid.js";import{property as r}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/has.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{glLayout as s}from"../../../../support/buffer/glUtil.js";import{ShaderOutput as n}from"../../../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as o}from"../../../../webgl-engine/effects/RenderPlugin.js";import{GLMaterials as a}from"../../../../webgl-engine/lib/GLMaterials.js";import{IntersectorType as l}from"../../../../webgl-engine/lib/IntersectorInterfaces.js";import{BoundingVolume as c}from"../../../../webgl-engine/lib/Object3D.js";import{RenderSlot as u}from"../../../../webgl-engine/lib/RenderSlot.js";import{DrawParameters as m}from"../../../../webgl-engine/materials/DrawParameters.js";import{HUDMaterial as d}from"../../../../webgl-engine/materials/HUDMaterial.js";let h=class extends o{constructor(e){super(e),this._glMaterials=null,this._produces=new Map,this._renderGeometries=new Map,this._vaoCache=null,this._drawParameters=new m,this._bufferWriter=null,this.slicePlaneEnabled=!1,this.isGround=!1,this.type=e.material instanceof d?l.HUD:l.OBJECT,this.layerUid=e.layerUid}get produces(){return this._produces}get numFeatures(){const e=6;let t=0;return this._renderGeometries.forEach((r=>t+=r.numElements/e)),t}get usedMemory(){let e=0;return this._renderGeometries.forEach((t=>{e+=t.vao.usedMemory})),e}intersect(e,r,i,s,n,o){const{material:a,_bufferWriter:l,layerUid:u}=this,m=this._renderGeometries;if(0!==m.size&&null!=l.intersect)for(const[d,h]of m){const{buffer:r,localOrigin:n,items:o}=h;l.intersect(r.data,a.parameters,n,e,i,s,((r,i,s,n,l,m)=>{const d=o.objectIds[s];o.visibilities[s]&&e.handleObjectIntersection({object:{id:t,graphicUid:d,layerUid:u,boundingVolumeWorldSpace:new c,geometries:[{material:a}]},geometryId:0,primIndex:s},r,i,n,null,l,m)}))}}initialize(){this._bufferWriter=this.material.createBufferWriter(),this.material.produces.forEach(((e,t)=>{this._produces.set(t,(t=>t!==n.Highlight&&t!==n.ShadowHighlight&&e(t)))}))}destroy(){this._glMaterials.dispose();const e=this._renderGeometries.keys();for(const t of e)this.removeRenderGeometry(t)}acquireTechniques(e){const t=this.material;if(!t.shouldRender(e))return null;const{output:r,bind:i}=e,s=t.produces.get(i.slot);if(!s?.(r))return null;if(r===n.Highlight||r===n.ShadowHighlight)return null;const o=this._glMaterials.load(e.rctx,i.slot,r);return o?.beginSlot(i)}render(e,t){const r=this._renderGeometries;if(0===r.size)return;const{bind:i}=e,s=i.slot===u.OCCLUDER_MATERIAL||i.slot===u.TRANSPARENT_OCCLUDER_MATERIAL?i.slot:null,n=e.rctx;n.runAppleAmdDriverHelper(),n.bindTechnique(t,i,this.material.parameters);const o=t.program;for(const[a,l]of r){const{vao:e,localOrigin:r,drawCalls:a}=l;this._drawParameters.origin=r,o.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(e),n.bindVAO(e),n.setPipelineState(t.getPipeline(!1,s));for(const i of a)n.drawArrays(t.primitiveType,i.start,i.count)}}initializeRenderContext(e,t){this._glMaterials=new a(this.material,e.materials),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,s(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}addRenderGeometry(e,t,r,i){this.removeRenderGeometry(e);const{data:s,elementCount:n}=t,o=this._vaoCache.newVao(s.byteLength);o.vertexBuffers.get("geometry").setSubData(new Uint8Array(s),0,0,s.byteLength);const a={localOrigin:i,numElements:n,buffer:t,items:r,vao:o,drawCalls:this._produceDrawCalls(r)};return this._renderGeometries.set(e,a),a}updateVisibility(e,t){const r=this._renderGeometries.get(e);if(null==r)return;const{items:i}=r;if(i.visibilities.length!==t.length)throw new Error("Unexpected mismatch between old and new visibility flag buffer length.");i.visibilities=t,r.drawCalls=this._produceDrawCalls(i)}removeRenderGeometry(e){const t=this._renderGeometries.get(e);null!=t&&(this._vaoCache.deleteVao(t.vao),this._renderGeometries.delete(e))}hasHighlight(){return!1}_produceDrawCalls(e){const{visibilities:t,ranges:r}=e,i=[];if(f(r)){if(0===r.numItems)return[];const e=r.numVertices;let s=null;for(let n=0;n<r.numItems;++n){t[n]?null==s?(s={start:n*e,count:e},i.push(s)):s.count+=e:s=null}}else{const e=r.counts,s=e.length;if(0===s)return[];let n=null,o=0;for(let r=0;r<s;++r){const s=t[r],a=e[r];s?null==n?(n={start:o,count:a},i.push(n)):n.count+=a:n=null,o+=a}}return i}};function f(e){return"numItems"in e}e([r({constructOnly:!0})],h.prototype,"material",void 0),h=e([i("esri.views.3d.layers.graphics.pipeline.rendering.DirectRenderer")],h);export{h as DirectRenderer};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{nullUid as t}from"../../../../../../core/uid.js";import{property as r}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/has.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{glLayout as s}from"../../../../support/buffer/glUtil.js";import{ShaderOutput as n}from"../../../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as o}from"../../../../webgl-engine/effects/RenderPlugin.js";import{GLMaterials as a}from"../../../../webgl-engine/lib/GLMaterials.js";import{IntersectorType as l}from"../../../../webgl-engine/lib/IntersectorInterfaces.js";import{BoundingVolume as u}from"../../../../webgl-engine/lib/Object3D.js";import{RenderSlot as c}from"../../../../webgl-engine/lib/RenderSlot.js";import{DrawParameters as m}from"../../../../webgl-engine/materials/DrawParameters.js";import{HUDMaterial as d}from"../../../../webgl-engine/materials/HUDMaterial.js";let h=class extends o{constructor(e){super(e),this._glMaterials=null,this._produces=new Map,this._renderGeometries=new Map,this._vaoCache=null,this._drawParameters=new m,this._bufferWriter=null,this.slicePlaneEnabled=!1,this.isGround=!1,this.type=e.material instanceof d?l.HUD:l.OBJECT,this.layerUid=e.layerUid}get produces(){return this._produces}get numFeatures(){const e=6;let t=0;return this._renderGeometries.forEach((r=>t+=r.numElements/e)),t}get usedMemory(){let e=0;return this._renderGeometries.forEach((t=>{e+=t.vao.usedMemory})),e}intersect(e,r,i,s,n,o){const{material:a,_bufferWriter:l,layerUid:c}=this,m=this._renderGeometries;if(0!==m.size&&null!=l.intersect)for(const[d,h]of m){const{buffer:r,localOrigin:n,items:o}=h;l.intersect(r.data,a.parameters,n,e,i,s,((r,i,s,n,l,m)=>{const d=o.objectIds[s];o.visibilities[s]&&e.handleObjectIntersection({object:{id:t,graphicUid:d,layerUid:c,boundingVolumeWorldSpace:new u,geometries:[{material:a}]},geometryId:0,primIndex:s},r,i,n,null,l,m)}))}}initialize(){this._bufferWriter=this.material.createBufferWriter(),this.material.produces.forEach(((e,t)=>{this._produces.set(t,(t=>t!==n.Highlight&&t!==n.ShadowHighlight&&e(t)))}))}destroy(){this._glMaterials.dispose();const e=this._renderGeometries.keys();for(const t of e)this.removeRenderGeometryBuffer(t)}acquireTechniques(e){const t=this.material;if(!t.shouldRender(e))return null;const{output:r,bind:i}=e,s=t.produces.get(i.slot);if(!s?.(r))return null;if(r===n.Highlight||r===n.ShadowHighlight)return null;const o=this._glMaterials.load(e.rctx,i.slot,r);return o?.beginSlot(i)}render(e,t){const r=this._renderGeometries;if(0===r.size)return;const{bind:i}=e,s=i.slot===c.OCCLUDER_MATERIAL||i.slot===c.TRANSPARENT_OCCLUDER_MATERIAL?i.slot:null,n=e.rctx;n.runAppleAmdDriverHelper(),n.bindTechnique(t,i,this.material.parameters);const o=t.program;for(const[a,l]of r){const{vao:e,localOrigin:r,drawCalls:a}=l;this._drawParameters.origin=r,o.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(e),n.bindVAO(e),n.setPipelineState(t.getPipeline(!1,s));for(const i of a)n.drawArrays(t.primitiveType,i.start,i.count)}}initializeRenderContext(e,t){this._glMaterials=new a(this.material,e.materials),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,s(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}addRenderGeometryBuffer(e,t,r,i){this.removeRenderGeometryBuffer(e);const{data:s,elementCount:n}=t,o=this._vaoCache.newVao(s.byteLength);o.vertexBuffers.get("geometry").setSubData(new Uint8Array(s),0,0,s.byteLength);const a={localOrigin:i,numElements:n,buffer:t,items:r,vao:o,drawCalls:this._produceDrawCalls(r)};this._renderGeometries.set(e,a)}updateRenderGeometryBuffer(e,t,r,i){const{data:s,elementCount:n}=t,o=this._renderGeometries.get(e);if(null==o)return;this._vaoCache.deleteVao(o.vao);const a=this._vaoCache.newVao(s.byteLength);a.vertexBuffers.get("geometry").setSubData(new Uint8Array(s),0,0,s.byteLength),o.localOrigin=i,o.numElements=n,o.buffer=t,o.items=r,o.vao=a,o.drawCalls=this._produceDrawCalls(r)}removeRenderGeometryBuffer(e){const t=this._renderGeometries.get(e);null!=t&&(this._vaoCache.deleteVao(t.vao),this._renderGeometries.delete(e))}updateVisibility(e,t){const r=this._renderGeometries.get(e);if(null==r)return;const{items:i}=r;if(i.visibilities.length!==t.length)throw new Error("Unexpected mismatch between old and new visibility flag buffer length.");i.visibilities=t,r.drawCalls=this._produceDrawCalls(i)}hasHighlight(){return!1}_produceDrawCalls(e){const{visibilities:t,ranges:r}=e,i=[];if(f(r)){if(0===r.numItems)return[];const e=r.numVertices;let s=null;for(let n=0;n<r.numItems;++n){t[n]?null==s?(s={start:n*e,count:e},i.push(s)):s.count+=e:s=null}}else{const e=r.counts,s=e.length;if(0===s)return[];let n=null,o=0;for(let r=0;r<s;++r){const s=t[r],a=e[r];s?null==n?(n={start:o,count:a},i.push(n)):n.count+=a:n=null,o+=a}}return i}};function f(e){return"numItems"in e}e([r({constructOnly:!0})],h.prototype,"material",void 0),h=e([i("esri.views.3d.layers.graphics.pipeline.rendering.DirectRenderer")],h);export{h as DirectRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import r from"../../../../../../core/Accessor.js";import"../../../../../../core/has.js";import{makeHandle as t}from"../../../../../../core/handleUtils.js";import{releaseMaybe as s}from"../../../../../../core/maybe.js";import{createAbortError as i}from"../../../../../../core/promiseUtils.js";import{property as o}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{ONES as d}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as l}from"../../../../../ViewingMode.js";import{namedAnchorToHUDMaterialAnchorPos as c}from"../../placementUtils.js";import{DirectRenderer as m}from"./DirectRenderer.js";import{LodRenderer as u}from"./LodRenderer.js";import{defaultBoundingBox as h,createTexture as p,requiresHalfTexelOffset as f}from"../../../../support/engineContent/sdfPrimitives.js";import{CullFaceOptions as g}from"../../../../webgl-engine/lib/basicInterfaces.js";import{DefaultMaterial as w}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as v}from"../../../../webgl-engine/materials/HUDMaterial.js";import{schematicMRRFactors as y}from"../../../../webgl-engine/materials/pbrUtils.js";let _=class extends r{constructor(e){super(),this.view=null,this.layerUid=null,this._materials=new Map,this._directRenderers=new Map,this._lodRenderers=new Map,this.totalFeatures=0,this.view=e.view,this.layerUid=e.layerUid}initialize(){}destroy(){this.removeAllHandles(),this._lodRenderers.forEach((e=>e.destroy()))}async createMaterial(e,r){const{view:i}=this,{sharedSymbolResources:o}=i;if(null==o)throw new Error("No shared symbol resources found!");const{textures:n}=o,d=i.state.viewingMode===l.Global;let a=null;switch(r){case"default":a=b(o,{physicalBasedRenderingEnabled:!0,slicePlaneEnabled:!1,castShadows:!0,isPrimitive:!0,screenSizePerspectiveEnabled:!0},d);break;case"hud":{const[e,r]=R(n,d);this.addHandles([t((()=>s(r)))]),a=e}break;default:throw new Error(`unable to create unknown material type ${r}`)}this._materials.set(e,a)}async createDirectRenderer(e){if(this._directRenderers.has(e))return;const r=this._materials.get(e);if(null==r)throw new Error(`material not found ${e}`);const{view:t}=this,s=new m({material:r,layerUid:this.layerUid});this._directRenderers.set(e,s),t._stage.addRenderPlugin(s),t._stage.renderView.renderer.updateHasFlags()}async createLoDRenderer(e,r,t){const s=new u({view:this.view,layerUid:this.layerUid}),o=e=>this._materials.get(e);if(await s.doLoad(r,o,t),t?.aborted)throw s.destroy(),i();this._lodRenderers.set(e,s)}async executeRenderCommands(e){for(const r of e)switch(r.id){case"add-direct-renderer-geometry":this._addDirectRendererGeometry(r);break;case"remove-direct-renderer-geometry":this._removeDirectRendererGeometry(r);break;case"add-lod-instances":this._addLodInstances(r);break;case"remove-lod-instances":this._removeLodInstances(r);break;case"update-visibility":this._updateVisibility(r)}e.length>0&&this._updateFeatureCount()}_updateFeatureCount(){let e=0;for(const r of this._directRenderers.values())e+=r.numFeatures;for(const r of this._lodRenderers.values())e+=r.numFeatures;this._set("totalFeatures",e)}get usedMemory(){let e=0;for(const r of this._directRenderers.values())e+=r.usedMemory;for(const r of this._lodRenderers.values())e+=r.usedMemory;return e}_addDirectRendererGeometry({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const o=this._directRenderers.get(r);null!=o?(o.addRenderGeometry(e,t,s,i),this.view._stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_removeDirectRendererGeometry({groupId:e,rendererId:r}){const t=this._directRenderers.get(r);null!=t?(t.removeRenderGeometry(e),this.view._stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_addLodInstances({rendererId:e,groupId:r,data:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("no lod renderer assigned to provided lod renderer Id");s.addInstances(r,t),this.view._stage.renderView.requestRender()}_removeLodInstances({rendererId:e,groupId:r}){const t=this._lodRenderers.get(e);if(null==t)throw new Error("no lod renderer assigned to provided lod renderer Id");t.removeInstances(r),this.view._stage.renderView.requestRender()}_updateVisibility({rendererId:e,groupId:r,visibility:t}){const s=this._directRenderers.get(e)??this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");s.updateVisibility(r,t),this.view._stage.renderView.requestRender()}};function R(e,r){const t={anchorPosition:c.center,occlusionTest:!0,hasSlicePlane:!1,color:[1,0,0,1],outlineColor:[0,0,0,1],outlineSize:1,distanceFieldBoundingBox:h},s=null;if(null!=e){const r=e.fromData("circle-icon",(()=>p("circle")));t.textureId=r.texture.id,t.textureIsSignedDistanceField=!0,t.sampleSignedDistanceFieldTexelCenter=f("circle")}return[new v(t,r),s]}function b(e,r,t){const s={usePBR:r.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:y,ambient:d,diffuse:d,hasSlicePlane:r.slicePlaneEnabled,castShadows:r.castShadows,offsetTransparentBackfaces:!r.isPrimitive};r.screenSizePerspectiveEnabled&&(s.screenSizePerspective=e.screenSizePerspectiveSettings),s.externalColor=a,s.isInstanced=!0;const i=new w(s,{spherical:t});return i.setParameters({cullFace:i.transparent?g.None:g.Back}),i}e([o({readOnly:!0})],_.prototype,"totalFeatures",void 0),_=e([n("esri.views.3d.layers.graphics.pipeline.rendering.FeaturePipelineRenderManager")],_);export{_ as FeaturePipelineRenderManager,b as createDefaultMaterial,R as createHudMaterial};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import r from"../../../../../../core/Accessor.js";import"../../../../../../core/has.js";import{makeHandle as t}from"../../../../../../core/handleUtils.js";import{releaseMaybe as s}from"../../../../../../core/maybe.js";import{createAbortError as i}from"../../../../../../core/promiseUtils.js";import{property as o}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{ONES as d}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as l}from"../../../../../ViewingMode.js";import{namedAnchorToHUDMaterialAnchorPos as c}from"../../placementUtils.js";import{DirectRenderer as u}from"./DirectRenderer.js";import{LodRenderer as m}from"./LodRenderer.js";import{defaultBoundingBox as f,createTexture as h,requiresHalfTexelOffset as p}from"../../../../support/engineContent/sdfPrimitives.js";import{CullFaceOptions as g}from"../../../../webgl-engine/lib/basicInterfaces.js";import{DefaultMaterial as w}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as _}from"../../../../webgl-engine/materials/HUDMaterial.js";import{schematicMRRFactors as v}from"../../../../webgl-engine/materials/pbrUtils.js";let y=class extends r{constructor(e){super(),this.view=null,this.layerUid=null,this._materials=new Map,this._directRenderers=new Map,this._lodRenderers=new Map,this.totalFeatures=0,this.view=e.view,this.layerUid=e.layerUid}initialize(){}destroy(){this.removeAllHandles(),this._lodRenderers.forEach((e=>e.destroy()))}async createMaterial(e,r){const{view:i}=this,{sharedSymbolResources:o}=i;if(null==o)throw new Error("No shared symbol resources found!");const{textures:n}=o,d=i.state.viewingMode===l.Global;let a=null;switch(r){case"default":a=b(o,{physicalBasedRenderingEnabled:!0,slicePlaneEnabled:!1,castShadows:!0,isPrimitive:!0,screenSizePerspectiveEnabled:!0},d);break;case"hud":{const[e,r]=R(n,d);this.addHandles([t((()=>s(r)))]),a=e}break;default:throw new Error(`unable to create unknown material type ${r}`)}this._materials.set(e,a)}async createDirectRenderer(e){if(this._directRenderers.has(e))return;const r=this._materials.get(e);if(null==r)throw new Error(`material not found ${e}`);const{view:t}=this,s=new u({material:r,layerUid:this.layerUid});this._directRenderers.set(e,s),t._stage.addRenderPlugin(s),t._stage.renderView.renderer.updateHasFlags()}async createLoDRenderer(e,r,t){const s=new m({view:this.view,layerUid:this.layerUid}),o=e=>this._materials.get(e);if(await s.doLoad(r,o,t),t?.aborted)throw s.destroy(),i();this._lodRenderers.set(e,s)}async executeRenderCommands(e){for(const r of e)switch(r.id){case"add-direct-renderer-geometry-buffer":this._addDirectRendererGeometryBuffer(r);break;case"update-direct-renderer-geometry-buffer":this._updateDirectRendererGeometryBuffer(r);break;case"remove-direct-renderer-geometry-buffer":this._removeDirectRendererGeometryBuffer(r);break;case"add-lod-instances":this._addLodInstances(r);break;case"remove-lod-instances":this._removeLodInstances(r);break;case"update-lod-instance-data":this._updateLodInstanceData(r);break;case"update-visibility":this._updateVisibility(r)}e.length>0&&this._updateFeatureCount()}_updateFeatureCount(){let e=0;for(const r of this._directRenderers.values())e+=r.numFeatures;for(const r of this._lodRenderers.values())e+=r.numFeatures;this._set("totalFeatures",e)}get usedMemory(){let e=0;for(const r of this._directRenderers.values())e+=r.usedMemory;for(const r of this._lodRenderers.values())e+=r.usedMemory;return e}_addDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const o=this._directRenderers.get(r);null!=o?(o.addRenderGeometryBuffer(e,t,s,i),this.view._stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_updateDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const o=this._directRenderers.get(r);null!=o?(o.updateRenderGeometryBuffer(e,t,s,i),this.view._stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_removeDirectRendererGeometryBuffer({groupId:e,rendererId:r}){const t=this._directRenderers.get(r);null!=t?(t.removeRenderGeometryBuffer(e),this.view._stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_addLodInstances({rendererId:e,groupId:r,data:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("no lod renderer assigned to provided lod renderer Id");s.addInstances(r,t),this.view._stage.renderView.requestRender()}_removeLodInstances({rendererId:e,groupId:r}){const t=this._lodRenderers.get(e);if(null==t)throw new Error("no lod renderer assigned to provided lod renderer Id");t.removeInstances(r),this.view._stage.renderView.requestRender()}_updateLodInstanceData({rendererId:e,groupId:r,globalTransforms:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");null!=t&&s.updateGlobalTransforms(r,t),this.view._stage.renderView.requestRender()}_updateVisibility({rendererId:e,groupId:r,visibility:t}){const s=this._directRenderers.get(e)??this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");s.updateVisibility(r,t),this.view._stage.renderView.requestRender()}};function R(e,r){const t={anchorPosition:c.center,occlusionTest:!0,hasSlicePlane:!1,color:[1,0,0,1],outlineColor:[0,0,0,1],outlineSize:1,distanceFieldBoundingBox:f},s=null;if(null!=e){const r=e.fromData("circle-icon",(()=>h("circle")));t.textureId=r.texture.id,t.textureIsSignedDistanceField=!0,t.sampleSignedDistanceFieldTexelCenter=p("circle")}return[new _(t,r),s]}function b(e,r,t){const s={usePBR:r.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:v,ambient:d,diffuse:d,hasSlicePlane:r.slicePlaneEnabled,castShadows:r.castShadows,offsetTransparentBackfaces:!r.isPrimitive};r.screenSizePerspectiveEnabled&&(s.screenSizePerspective=e.screenSizePerspectiveSettings),s.externalColor=a,s.isInstanced=!0;const i=new w(s,{spherical:t});return i.setParameters({cullFace:i.transparent?g.None:g.Back}),i}e([o({readOnly:!0})],y.prototype,"totalFeatures",void 0),y=e([n("esri.views.3d.layers.graphics.pipeline.rendering.FeaturePipelineRenderManager")],y);export{y as FeaturePipelineRenderManager,b as createDefaultMaterial,R as createHudMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import has from"../../../../../../core/has.js";import{throwIfAborted as r}from"../../../../../../core/promiseUtils.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import"../../../../../../core/Error.js";import{subclass as s}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{VertexAttribute as n}from"../../../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as t}from"../../../../webgl-engine/lib/lodRendering/LodRenderer.js";import{LodComponentRenderGeometry as o,LodComponentResources as i,LodLevelResources as a,LodResources as d}from"../../../../webgl-engine/lib/lodRendering/LodResources.js";let l=class{constructor(e){this._optionalFields=new Array,this._instanceGroupToIndices=new Map,this._instanceIndexToFeatureId=new Map,this._disposeResourceHandles=new Array,this._lodRendererResources=null,this._numFeatures=0,this.layerUid=e.layerUid,this.view=e.view,this.sharedResources=this.view.sharedSymbolResources,this.scheduler=this.view.resourceController.scheduler}get numFeatures(){return this._numFeatures}get usedMemory(){const e=this._lodRendererResources?.lodRenderer,r=e?.symbol;return(r?.computeUsedMemory()??0)+16*this._instanceIndexToFeatureId.size}destroy(){this._disposeResourceHandles.forEach((e=>e()))}async doLoad(e,s,t){has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(n.OBJECTANDLAYERIDCOLOR);const o=c((e=>s(e)),e),i=this.view._stage,a=o.getMaterials();i.addMany(a),this._addDisposeResource((()=>i.removeMany(a)));const d=o.getTextures();i.addMany(d),this._addDisposeResource((()=>{d.forEach((e=>e.unload())),i.removeMany(d)})),await Promise.all(d.map((e=>this.view._stage.schedule((()=>e.load(i.renderView.renderingContext)),t)))),r(t);const l=await this._createLodRenderer(o,t);this._lodRendererResources={lodRenderer:l,materials:a,textures:d}}addInstances(e,r){const s=this._lodRendererResources;if(null==s)return;const n=s.lodRenderer;if(null==n)return;const{featureIds:t,localTransforms:o,globalTransforms:i,visibility:a}=r,d=new Array,l=n.instanceData,c=t.length,u=this._instanceIndexToFeatureId;for(let h=0;h<c;++h){const e=t[h],r=l.addInstance(),s=l.view,n=16*h;s.localTransform.copyFromTypedBuffer(r,o,n),s.globalTransform.copyFromTypedBuffer(r,i,n),l.updateModelTransform(r),l.setVisible(r,Boolean(a[h])),d.push(r),u.set(r,e)}this._instanceGroupToIndices.set(e,d),this._numFeatures+=c}removeInstances(e){const r=this._instanceGroupToIndices.get(e);if(null==r)return;const s=this._lodRendererResources;if(null==s)return;const n=s.lodRenderer.instanceData,t=this._instanceIndexToFeatureId;for(const o of r)n.removeInstance(o),t.delete(o);this._numFeatures-=r.length,this._instanceGroupToIndices.delete(e)}updateVisibility(e,r){const s=this._instanceGroupToIndices.get(e);if(null==s)return;const n=this._lodRendererResources;if(null==n)return;const t=s.length;if(t!==r.length)throw new Error("Unexpected mismatch instance count and visibility flag buffer length.");const o=n.lodRenderer.instanceData;for(let i=0;i<t;++i)o.setVisible(s[i],Boolean(r[i]))}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createLodRenderer(e,r){const s=this.view._stage,n={layerUid:this.layerUid,graphicUid:e=>this._instanceIndexToFeatureId.get(e)??-1,notifyGraphicGeometryChanged:e=>1,notifyGraphicVisibilityChanged:e=>1},o=new t({symbol:e,optionalFields:this._optionalFields,metadata:n,shaderTransformation:null},this.scheduler);return o.slicePlaneEnabled=!1,this._addDisposeResource((()=>{s.removeRenderPlugin(o),o.destroy()})),await s.addRenderPlugin(o,r),o}};function c(e,r){const s=r.levels.map((r=>{const s=r.components.map((r=>{const s=e(r.materialId);if(!u(s))throw new Error("LodRenderer only supports DefaultMaterial");const n=new o(s,r.renderGeometryBuffer.data,r.renderGeometryBuffer.elementCount,r.boundingInfo);return new i(n)}));return new a(s,r.minScreenSpaceRadius)}));return new d(s)}function u(e){return null!=e&&"materialType"in e&&"default"===e.materialType}l=e([s("esri.views.3d.layers.graphics.pipeline.rendering.LodRenderer")],l);export{l as LodRenderer,u as isDefaultMaterial};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import has from"../../../../../../core/has.js";import{throwIfAborted as r}from"../../../../../../core/promiseUtils.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import"../../../../../../core/Error.js";import{subclass as s}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{VertexAttribute as n}from"../../../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as t}from"../../../../webgl-engine/lib/lodRendering/LodRenderer.js";import{LodComponentRenderGeometry as o,LodComponentResources as i,LodLevelResources as a,LodResources as d}from"../../../../webgl-engine/lib/lodRendering/LodResources.js";let l=class{constructor(e){this._optionalFields=new Array,this._instanceGroupToIndices=new Map,this._instanceIndexToFeatureId=new Map,this._disposeResourceHandles=new Array,this._lodRendererResources=null,this._numFeatures=0,this.layerUid=e.layerUid,this.view=e.view,this.sharedResources=this.view.sharedSymbolResources,this.scheduler=this.view.resourceController.scheduler}get numFeatures(){return this._numFeatures}get usedMemory(){const e=this._lodRendererResources?.lodRenderer,r=e?.symbol;return(r?.computeUsedMemory()??0)+16*this._instanceIndexToFeatureId.size}destroy(){this._disposeResourceHandles.forEach((e=>e()))}async doLoad(e,s,t){has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(n.OBJECTANDLAYERIDCOLOR);const o=c((e=>s(e)),e),i=this.view._stage,a=o.getMaterials();i.addMany(a),this._addDisposeResource((()=>i.removeMany(a)));const d=o.getTextures();i.addMany(d),this._addDisposeResource((()=>{d.forEach((e=>e.unload())),i.removeMany(d)})),await Promise.all(d.map((e=>this.view._stage.schedule((()=>e.load(i.renderView.renderingContext)),t)))),r(t);const l=await this._createLodRenderer(o,t);this._lodRendererResources={lodRenderer:l,materials:a,textures:d}}addInstances(e,r){const s=this._lodRendererResources;if(null==s)return;const n=s.lodRenderer;if(null==n)return;const{featureIds:t,localTransforms:o,globalTransforms:i,visibility:a}=r,d=new Array,l=n.instanceData,c=t.length,u=this._instanceIndexToFeatureId;for(let h=0;h<c;++h){const e=t[h],r=l.addInstance(),s=l.view,n=16*h;s.localTransform.copyFromTypedBuffer(r,o,n),s.globalTransform.copyFromTypedBuffer(r,i,n),l.updateModelTransform(r),l.setVisible(r,Boolean(a[h])),d.push(r),u.set(r,e)}this._instanceGroupToIndices.set(e,d),this._numFeatures+=c}removeInstances(e){const r=this._instanceGroupToIndices.get(e);if(null==r)return;const s=this._lodRendererResources;if(null==s)return;const n=s.lodRenderer.instanceData,t=this._instanceIndexToFeatureId;for(const o of r)n.removeInstance(o),t.delete(o);this._numFeatures-=r.length,this._instanceGroupToIndices.delete(e)}updateVisibility(e,r){const s=this._instanceGroupToIndices.get(e);if(null==s)return;const n=this._lodRendererResources;if(null==n)return;const t=s.length;if(t!==r.length)throw new Error("Unexpected mismatch instance count and visibility flag buffer length.");const o=n.lodRenderer.instanceData;for(let i=0;i<t;++i)o.setVisible(s[i],Boolean(r[i]))}updateGlobalTransforms(e,r){const s=this._instanceGroupToIndices.get(e);if(null==s)return;const n=this._lodRendererResources;if(null==n)return;const t=s.length;if(16*t!==r.length)throw new Error("Unexpected mismatch instance count and visibility flag buffer length.");const o=n.lodRenderer.instanceData,i=o.view;for(let a=0;a<t;++a){const e=s[a],n=16*a;i.globalTransform.copyFromTypedBuffer(e,r,n),o.updateModelTransform(e)}}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createLodRenderer(e,r){const s=this.view._stage,n={layerUid:this.layerUid,graphicUid:e=>this._instanceIndexToFeatureId.get(e)??-1,notifyGraphicGeometryChanged:e=>1,notifyGraphicVisibilityChanged:e=>1},o=new t({symbol:e,optionalFields:this._optionalFields,metadata:n,shaderTransformation:null},this.scheduler);return o.slicePlaneEnabled=!1,this._addDisposeResource((()=>{s.removeRenderPlugin(o),o.destroy()})),await s.addRenderPlugin(o,r),o}};function c(e,r){const s=r.levels.map((r=>{const s=r.components.map((r=>{const s=e(r.materialId);if(!u(s))throw new Error("LodRenderer only supports DefaultMaterial");const n=new o(s,r.renderGeometryBuffer.data,r.renderGeometryBuffer.elementCount,r.boundingInfo);return new i(n)}));return new a(s,r.minScreenSpaceRadius)}));return new d(s)}function u(e){return null!=e&&"materialType"in e&&"default"===e.materialType}l=e([s("esri.views.3d.layers.graphics.pipeline.rendering.LodRenderer")],l);export{l as LodRenderer,u as isDefaultMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{copy as e,invert as r,transpose as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{getContinuousIndexArray as i}from"../../../../../../geometry/support/Indices.js";import{ViewingMode as o}from"../../../../../ViewingMode.js";import{generateId as s}from"../utils.js";import{createHudMaterial as a}from"./FeaturePipelineRenderManager.js";import{BoundingInfo as d}from"../../../../webgl-engine/lib/BoundingInfo.js";import{VertexAttribute as m}from"../../../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as f}from"../../../../webgl-engine/materials/DefaultMaterial.js";class l{constructor(e,r,t,n,i){this._createClientMaterial=r,this._createClientDirectRenderer=t,this._createClientLodRenderer=n,this._dispatchRenderCommands=i,this._bufferWriters=new Map,this.globalViewingMode=e===o.Global}createRenderCommandBuffer(){return{commands:[],transferList:[]}}mergeRenderCommandBuffers(e){const r=this.createRenderCommandBuffer();for(const t of e)null!=t&&(r.commands.push(...t.commands),r.transferList.push(...t.transferList));return r}async createMaterial(e){const r=s("material");let t;switch(e){case"default":t=new f({},{spherical:this.globalViewingMode});break;case"hud":t=a(null,this.globalViewingMode)[0]}return this._bufferWriters.set(r,t.createBufferWriter()),await this._createClientMaterial(r,e),r}async createDirectRenderer(e){return await this._createClientDirectRenderer(e),e}addDirectRendererGeometry(e,r,t){const{materialId:n,objectIds:i,visibilities:o}=r;if(null==this._bufferWriters.get(n))throw new Error(`no bufferwriter found for material ${n}`);const{renderGeometryBuffer:s,renderGeometryBufferItems:a}=this.createRenderGeometryBuffer(r,t);if(o.length!==a.numItems||i.length!==a.numItems)throw new Error("Unexpected mismatch between number of RenderGeometryBufferItems and provided objectIds/visibility flags.");return{commands:[{id:"add-direct-renderer-geometry",rendererId:n,groupId:e,renderGeometryBuffer:s,renderGeometryBufferItems:{objectIds:i,visibilities:o,ranges:{numVertices:a.numVerticesPerItem,numItems:a.numItems}},localOrigin:t}],transferList:[s.data,i.buffer,o.buffer]}}removeDirectRendererGeometry(e,r){return{commands:[{id:"remove-direct-renderer-geometry",rendererId:e,groupId:r}],transferList:[]}}async createLodRenderer(e){const r=s("lod-renderer"),t=new Set,n={levels:e.levels.map((e=>({components:e.components.map((e=>{const r=e.attributes.get(m.POSITION);if(!r||0===r.indices.length)throw new Error("positions attribute expected");const n=3,o=i(r.indices.length/n),s=new d(o,n,r);if(null==this._bufferWriters.get(e.materialId))throw new Error("writer not found");const{renderGeometryBuffer:a}=this.createRenderGeometryBuffer(e,null);t.add(a.data);return{materialId:e.materialId,renderGeometryBuffer:a,boundingInfo:{bbMax:s.bbMax,bbMin:s.bbMin}}})),minScreenSpaceRadius:e.minScreenSpaceRadius})))};return await this._createClientLodRenderer(r,n,Array.from(t)),r}addLodInstances(e,r,t){return{commands:[{id:"add-lod-instances",rendererId:e,groupId:r,data:t}],transferList:[t.featureIds.buffer,t.globalTransforms.buffer,t.localTransforms.buffer,t.visibility.buffer]}}removeLodInstances(e,r){return{commands:[{id:"remove-lod-instances",rendererId:e,groupId:r}],transferList:[]}}updateVisibility(e,r,t){return{commands:[{id:"update-visibility",rendererId:e,groupId:r,visibility:t}],transferList:[t.buffer]}}async dispatchRenderCommands(e){0!==e.commands.length&&await this._dispatchRenderCommands(e)}createRenderGeometryBuffer(n,i){const{materialId:o}=n,s=this._bufferWriters.get(o);if(null==s)throw new Error("no registered bufferWriter for material found");let a=null;if(n.transformation&&i)e(u,n.transformation),u[12]-=i[0],u[13]-=i[1],u[14]-=i[2],a=u;else{if(i)throw new Error("not implemented");n.transformation&&(a=n.transformation)}let d=null;a&&(r(c,u),t(c,c),d=c);const m=n.attributes,f=s.elementCount(m),l=s.vertexBufferLayout.stride/4;f>Math.floor(b/l)&&console.warn("geometry with very large number of elements encountered");const g=s.vertexBufferLayout.createBuffer(f),h=0,p=s.write(a,d,m,n.objectAndLayerIdColor,g,h);if(null==p)throw new Error("Bufferwriter.write does not provide item information.");return{renderGeometryBuffer:{data:g.buffer,elementCount:f},renderGeometryBufferItems:p}}}const u=n(),c=n(),b=16777216/4;export{l as RenderCommandContext};
5
+ import{copy as e,invert as r,transpose as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{getContinuousIndexArray as i}from"../../../../../../geometry/support/Indices.js";import{ViewingMode as o}from"../../../../../ViewingMode.js";import{generateId as a}from"../utils.js";import{createHudMaterial as s}from"./FeaturePipelineRenderManager.js";import{BoundingInfo as d}from"../../../../webgl-engine/lib/BoundingInfo.js";import{VertexAttribute as f}from"../../../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as m}from"../../../../webgl-engine/materials/DefaultMaterial.js";class u{constructor(e,r){this._mainThreadDelegate=r,this._bufferWriters=new Map,this.globalViewingMode=e===o.Global}createRenderCommandBuffer(){return{commands:[],transferList:[]}}mergeRenderCommandBuffers(e){const r=this.createRenderCommandBuffer();for(const t of e)null!=t&&(r.commands.push(...t.commands),r.transferList.push(...t.transferList));return r}async createMaterial(e){const r=a("material");let t;switch(e){case"default":t=new m({},{spherical:this.globalViewingMode});break;case"hud":t=s(null,this.globalViewingMode)[0]}return this._bufferWriters.set(r,t.createBufferWriter()),await this._mainThreadDelegate.createMaterial(r,e),r}async createDirectRenderer(e){return await this._mainThreadDelegate.createDirectRenderer(e),e}addDirectRendererGeometry(e,r,t){const{materialId:n}=r;if(null==this._bufferWriters.get(n))throw new Error(`no bufferwriter found for material ${n}`);const{renderGeometryBuffer:i,renderGeometryBufferItems:o}=this.createRenderGeometryBuffer(r,t);return this.addDirectRendererGeometryBuffer(n,e,i,o,t)}updateDirectRendererGeometry(e,r,t){const{materialId:n}=r;if(null==this._bufferWriters.get(n))throw new Error(`no bufferwriter found for material ${n}`);const{renderGeometryBuffer:i,renderGeometryBufferItems:o}=this.createRenderGeometryBuffer(r,t);return this.updateDirectRendererGeometryBuffer(n,e,i,o,t)}addDirectRendererGeometryBuffer(e,r,t,n,i){const{objectIds:o,visibilities:a}=n;return{commands:[{id:"add-direct-renderer-geometry-buffer",rendererId:e,groupId:r,renderGeometryBuffer:t,renderGeometryBufferItems:n,localOrigin:i}],transferList:[t.data,o.buffer,a.buffer]}}updateDirectRendererGeometryBuffer(e,r,t,n,i){const{objectIds:o,visibilities:a}=n;return{commands:[{id:"update-direct-renderer-geometry-buffer",rendererId:e,groupId:r,renderGeometryBuffer:t,renderGeometryBufferItems:n,localOrigin:i}],transferList:[t.data,o.buffer,a.buffer]}}removeDirectRendererGeometryBuffer(e,r){return{commands:[{id:"remove-direct-renderer-geometry-buffer",rendererId:e,groupId:r}],transferList:[]}}async createLodRenderer(e){const r=a("lod-renderer"),t=new Set,n={levels:e.levels.map((e=>({components:e.components.map((e=>{const r=e.attributes.get(f.POSITION);if(!r||0===r.indices.length)throw new Error("positions attribute expected");const n=3,o=i(r.indices.length/n),a=new d(o,n,r);if(null==this._bufferWriters.get(e.materialId))throw new Error("writer not found");const{renderGeometryBuffer:s}=this.createRenderGeometryBuffer(e,null);t.add(s.data);return{materialId:e.materialId,renderGeometryBuffer:s,boundingInfo:{bbMax:a.bbMax,bbMin:a.bbMin}}})),minScreenSpaceRadius:e.minScreenSpaceRadius})))};return await this._mainThreadDelegate.createLodRenderer(r,n,Array.from(t)),r}addLodInstances(e,r,t){return{commands:[{id:"add-lod-instances",rendererId:e,groupId:r,data:t}],transferList:[t.featureIds.buffer,t.globalTransforms.buffer,t.localTransforms.buffer,t.visibility.buffer]}}removeLodInstances(e,r){return{commands:[{id:"remove-lod-instances",rendererId:e,groupId:r}],transferList:[]}}updateLodInstancesData(e,r,t){return{commands:[{id:"update-lod-instance-data",rendererId:e,groupId:r,globalTransforms:t}],transferList:[t.buffer]}}updateVisibility(e,r,t){return{commands:[{id:"update-visibility",rendererId:e,groupId:r,visibility:t}],transferList:[t.buffer]}}async dispatchRenderCommands(e){0!==e.commands.length&&await this._mainThreadDelegate.executeRenderCommands(e)}createRenderGeometryBuffer(n,i){const{materialId:o,visibilities:a,objectIds:s}=n,d=this._bufferWriters.get(o);if(null==d)throw new Error("no registered bufferWriter for material found");let f=null;if(n.transformation&&i)e(l,n.transformation),l[12]-=i[0],l[13]-=i[1],l[14]-=i[2],f=l;else{if(i)throw new Error("not implemented");n.transformation&&(f=n.transformation)}let m=null;f&&(r(c,l),t(c,c),m=c);const u=n.attributes,g=d.elementCount(u),h=d.vertexBufferLayout.stride/4;g>Math.floor(b/h)&&console.warn("geometry with very large number of elements encountered");const I=d.vertexBufferLayout.createBuffer(g),p=0,y=d.write(f,m,u,n.objectAndLayerIdColor,I,p);if(null==y)throw new Error("Bufferwriter.write does not provide item information.");if(a.length!==y.numItems||s.length!==y.numItems)throw new Error("Unexpected mismatch between number of RenderGeometryBufferItems and provided objectIds/visibility flags.");return{renderGeometryBuffer:{data:I.buffer,elementCount:g},renderGeometryBufferItems:{objectIds:s,visibilities:a,ranges:{numVertices:y.numVerticesPerItem,numItems:y.numItems}}}}}const l=n(),c=n(),b=16777216/4;export{u as RenderCommandContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{identity as e,scale as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as o,create as i}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as n}from"../../../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as a,size as s}from"../../../../../../geometry/support/aaBoundingBox.js";import{objectSymbolLayerPrimitiveBoundingBox as d,objectSymbolLayerSizeWithResourceSize as l}from"../../../../../../symbols/support/symbolLayerUtils3D.js";import{computeObjectScale as m}from"../../graphicUtils.js";import{readMapCoordinates as c,readObjectIds as f}from"../featureData/processingUtils.js";import{createPrimitiveGeometry as u}from"./primitiveObjectUtils.js";class p{constructor(e){this._context=e,this.lodRendererId=null,this._loaded=!1,this._loadingPromise=null,this._primitive="cone"}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}async _load(){const e=this._context.renderCommandContext,t=await e.createMaterial("default"),r=u(this._primitive,t);this.lodRendererId=await e.createLodRenderer(r),this._loaded=!0}async createAddCommand(e){const t=this._context.renderCommandContext;if(null==this.lodRendererId)throw new Error("expected lod renderer id to not be null");const{featureCount:r}=e;if(0===r)return t.createRenderCommandBuffer();const i=!0,n=a(d(this._primitive)),m=o(s(n)),u=o(l(m,{isPrimitive:i,width:100,depth:null,height:null})),p=new Float64Array(16*r),h=new Float64Array(16*r),x=c(e);for(let o=0;o<r;++o){const e=o,t=x[3*o+0],r=x[3*o+1],i=x[3*o+2],n=this._computeGlobalTransform(t,r,i,this._context.viewSpatialReference,y),a=this._computeLocalTransform(u,m,_);this._writeMatrixToTypedBuffer(p,e,a),this._writeMatrixToTypedBuffer(h,e,n)}const C=f(e),g=new Uint8Array(r);e.getVisibilityArray(g);const b={featureIds:new Uint32Array(C),visibility:g,localTransforms:p,globalTransforms:h};return t.addLodInstances(this.lodRendererId,e.id,b)}async createRemoveCommand(e){const{_context:t,lodRendererId:r}=this,o=t.renderCommandContext;return null==r?o.createRenderCommandBuffer():o.removeLodInstances(r,e)}async createUpdateVisibilityCommand(e){const{lodRendererId:t,_context:r}=this,o=r.renderCommandContext;if(null==t)return o.createRenderCommandBuffer();const i=new Uint8Array(e.featureCount);return e.getVisibilityArray(i),o.updateVisibility(t,e.id,i)}async createUpdateElevationCommand(e){const{_context:t,lodRendererId:r}=this,o=t.renderCommandContext;return o.createRenderCommandBuffer()}_writeMatrixToTypedBuffer(e,t,r){let o=16*t;for(let i=0;i<16;i++)e[o++]=r[i]}_computeGlobalTransform(e,t,r,o,i){return h[0]=e,h[1]=t,h[2]=r,n(o,h,i,this._context.renderSpatialReference),i}_computeLocalTransform(t,r,o){return e(o),this._applyObjectScale(t,r,o),o}_applyObjectScale(e,r,o){const i=m(e,e,r,this._context.renderCoordsHelper.unitInMeters);1===i[0]&&1===i[1]&&1===i[2]||t(o,o,i)}}const h=i(),_=r(),y=r();export{p as TestObjectSymbol};
5
+ import{identity as e,scale as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as o,create as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as i}from"../../../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as a,size as s}from"../../../../../../geometry/support/aaBoundingBox.js";import{objectSymbolLayerPrimitiveBoundingBox as l,objectSymbolLayerSizeWithResourceSize as d}from"../../../../../../symbols/support/symbolLayerUtils3D.js";import{computeObjectScale as m}from"../../graphicUtils.js";import{readMapCoordinates as c,readObjectIds as f}from"../featureData/processingUtils.js";import{createPrimitiveGeometry as u}from"./primitiveObjectUtils.js";class p{constructor(e){this._context=e,this.lodRendererId=null,this._loaded=!1,this._loadingPromise=null,this._primitive="cone"}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}async _load(){const e=this._context.renderCommandContext,t=await e.createMaterial("default"),r=u(this._primitive,t);this.lodRendererId=await e.createLodRenderer(r),this._loaded=!0}async createAddCommand(e){const t=this._context,{renderCommandContext:r,mainThreadDelegate:n}=t;if(null==this.lodRendererId)throw new Error("expected lod renderer id to not be null");const{featureCount:i}=e;if(0===i)return r.createRenderCommandBuffer();const m=!0,u=a(l(this._primitive)),p=o(s(u)),h=o(d(p,{isPrimitive:m,width:100,depth:null,height:null})),x=new Float64Array(16*i),g=new Float64Array(16*i),C=c(e),T=await n.applyElevationAlignmentTo(C);for(let o=0;o<i;++o){const e=o,t=T[3*o+0],r=T[3*o+1],n=T[3*o+2],i=this._computeGlobalTransform(t,r,n,this._context.viewSpatialReference,y),a=this._computeLocalTransform(h,p,_);this._writeMatrixToTypedBuffer(x,e,a),this._writeMatrixToTypedBuffer(g,e,i)}const w=f(e),b=new Uint8Array(i);e.getVisibilityArray(b);const R={featureIds:new Uint32Array(w),visibility:b,localTransforms:x,globalTransforms:g};return r.addLodInstances(this.lodRendererId,e.id,R)}async createRemoveCommand(e){const{_context:t,lodRendererId:r}=this,o=t.renderCommandContext;return null==r?o.createRenderCommandBuffer():o.removeLodInstances(r,e)}async createUpdateVisibilityCommand(e){const{lodRendererId:t,_context:r}=this,o=r.renderCommandContext;if(null==t)return o.createRenderCommandBuffer();const n=new Uint8Array(e.featureCount);return e.getVisibilityArray(n),o.updateVisibility(t,e.id,n)}async createUpdateElevationCommand(e){const{_context:t,lodRendererId:r}=this,{renderCommandContext:o,mainThreadDelegate:n}=t,{featureCount:i,id:a}=e;if(null==r||0===i)return o.createRenderCommandBuffer();const s=new Float64Array(16*i),l=c(e),d=await n.applyElevationAlignmentTo(l);for(let m=0;m<i;++m){const e=m,t=d[3*m+0],r=d[3*m+1],o=d[3*m+2],n=this._computeGlobalTransform(t,r,o,this._context.viewSpatialReference,y);this._writeMatrixToTypedBuffer(s,e,n)}return o.updateLodInstancesData(r,a,s)}_writeMatrixToTypedBuffer(e,t,r){let o=16*t;for(let n=0;n<16;n++)e[o++]=r[n]}_computeGlobalTransform(e,t,r,o,n){return h[0]=e,h[1]=t,h[2]=r,i(o,h,n,this._context.renderSpatialReference),n}_computeLocalTransform(t,r,o){return e(o),this._applyObjectScale(t,r,o),o}_applyObjectScale(e,r,o){const n=m(e,e,r,this._context.renderCoordsHelper.unitInMeters);1===n[0]&&1===n[1]&&1===n[2]||t(o,o,n)}}const h=n(),_=r(),y=r();export{p as TestObjectSymbol};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{readObjectIds as t,computeRenderCoordinates as r,computeTileCenterRenderCoordinates as n}from"../featureData/processingUtils.js";import{inputAttributesToAttributesMap as a}from"./symbolizationUtils.js";import{Attribute as i}from"../../../../webgl-engine/lib/Attribute.js";import{VertexAttribute as o}from"../../../../webgl-engine/lib/VertexAttribute.js";class d{constructor(e){this._context=e,this.materialId=null,this._loaded=!1,this._loadingPromise=null}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}async _load(){const e=this._context.renderCommandContext;this.materialId=await e.createMaterial("hud"),await e.createDirectRenderer(this.materialId),this._loaded=!0}async createAddCommand(d){if(null==this.materialId)throw new Error("expected material not to be null");const s=this._context,l=s.renderCommandContext,{featureCount:m,id:c}=d;if(0===m)return l.createRenderCommandBuffer();const u=t(d),y=r(d,s),f=n(d,s),C=new Float64Array([0,0,1]),w=new Float64Array([255,255,255,255]),h=new Float64Array([24,24]),A=new Float64Array([0,0,0,1]),b=new Float64Array([0,0]),I=new Float64Array([0]),x=new Uint32Array(m);for(let e=0;e<m;++e)x[e]=e;const _=new Uint32Array(m);for(let e=0;e<m;++e)_[e]=0;const g=new i(y,x,3,!0),R=new i(C,_,3,!0),p=new i(b,_,2,!0),U=new i(w,_,4,!0),F=new i(I,_,1,!0),O=new i(h,_,2,!0),j=new i(A,_,4,!0),E=[[o.POSITION,g],[o.NORMAL,R],[o.UV0,p],[o.COLOR,U],[o.ROTATION,F],[o.SIZE,O],[o.CENTEROFFSETANDDISTANCE,j]],D=new Uint8Array(m);d.getVisibilityArray(D);const N={attributes:a(E),objectAndLayerIdColor:void 0,transformation:e(),materialId:this.materialId,objectIds:u,visibilities:D};return l.addDirectRendererGeometry(c,N,f)}async createRemoveCommand(e){const{materialId:t,_context:r}=this,n=r.renderCommandContext;return null==t?n.createRenderCommandBuffer():n.removeDirectRendererGeometry(t,e)}async createUpdateVisibilityCommand(e){const{materialId:t,_context:r}=this,n=r.renderCommandContext;if(null==t)return n.createRenderCommandBuffer();const a=new Uint8Array(e.featureCount);return e.getVisibilityArray(a),n.updateVisibility(t,e.id,a)}async createUpdateElevationCommand(e){const{materialId:t,_context:r}=this,n=r.renderCommandContext;return n.createRenderCommandBuffer()}}export{d as TestSymbol};
5
+ import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{computeTileCenterRenderCoordinates as t,readObjectIds as r,readMapCoordinates as n,projectToRenderCoordinates as a}from"../featureData/processingUtils.js";import{inputAttributesToAttributesMap as i}from"./symbolizationUtils.js";import{Attribute as o}from"../../../../webgl-engine/lib/Attribute.js";import{VertexAttribute as l}from"../../../../webgl-engine/lib/VertexAttribute.js";class d{constructor(e){this._context=e,this.materialId=null,this._loaded=!1,this._loadingPromise=null}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}async _load(){const e=this._context.renderCommandContext;this.materialId=await e.createMaterial("hud"),await e.createDirectRenderer(this.materialId),this._loaded=!0}async createAddCommand(e){const{materialId:r,_context:n}=this,{renderCommandContext:a}=n;if(null==r)throw new Error("expected material not to be null");const i=await this._createGeometry(e);if(null==i)return a.createRenderCommandBuffer();const o=t(e,n);return a.addDirectRendererGeometry(e.id,i,o)}async _createGeometry(t){const{materialId:d,_context:s}=this,{mainThreadDelegate:m}=s,{featureCount:c}=t;if(0===c||null==d)return null;const u=r(t),f=n(t),y=await m.applyElevationAlignmentTo(f),w=a(y,s),C=new Float64Array([0,0,1]),h=new Float64Array([255,255,255,255]),A=new Float64Array([24,24]),_=new Float64Array([0,0,0,1]),b=new Float64Array([0,0]),x=new Float64Array([0]),I=new Uint32Array(c);for(let e=0;e<c;++e)I[e]=e;const g=new Uint32Array(c);for(let e=0;e<c;++e)g[e]=0;const p=new o(w,I,3,!0),R=new o(C,g,3,!0),U=new o(b,g,2,!0),D=new o(h,g,4,!0),E=new o(x,g,1,!0),F=new o(A,g,2,!0),O=new o(_,g,4,!0),T=[[l.POSITION,p],[l.NORMAL,R],[l.UV0,U],[l.COLOR,D],[l.ROTATION,E],[l.SIZE,F],[l.CENTEROFFSETANDDISTANCE,O]],j=new Uint8Array(c);t.getVisibilityArray(j);return{attributes:i(T),objectAndLayerIdColor:void 0,transformation:e(),materialId:d,objectIds:u,visibilities:j}}async createRemoveCommand(e){const{materialId:t,_context:r}=this,n=r.renderCommandContext;return null==t?n.createRenderCommandBuffer():n.removeDirectRendererGeometryBuffer(t,e)}async createUpdateVisibilityCommand(e){const{materialId:t,_context:r}=this,n=r.renderCommandContext;if(null==t)return n.createRenderCommandBuffer();const a=new Uint8Array(e.featureCount);return e.getVisibilityArray(a),n.updateVisibility(t,e.id,a)}async createUpdateElevationCommand(e){const{materialId:r,_context:n}=this,{renderCommandContext:a}=n,{featureCount:i,id:o}=e;if(null==r||0===i)return a.createRenderCommandBuffer();const l=await this._createGeometry(e);if(null==l)return a.createRenderCommandBuffer();const d=t(e,n);return a.updateDirectRendererGeometry(o,l,d)}}export{d as TestSymbol};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{generateUID as r}from"../../../../../core/uid.js";function o(o=""){return`${o}${r()}`}export{o as generateId};
5
+ import{generateUID as e}from"../../../../../core/uid.js";import{getProjector as t,copy3 as o}from"../../../../../geometry/projection/projectors.js";function r(t=""){return`${t}${e()}`}function n(e,r,n,s,a){const l=s.spatialReference,i=t(r,l);if(null==i)return e;let f=t=>[e[t],e[t+1],e[t+2]];i!==o&&(f=t=>(i(e,t,c,0),[c[0],c[1],c[2]]));const u=e.length/3,d=n.mode;switch(n.mode){case"on-the-ground":for(let t=0;t<u;++t){const o=3*t,[r,n]=f(o);e[o+2]=s.getElevation(r,n,0,s.spatialReference,"ground")??0}break;case"relative-to-ground":case"relative-to-scene":{const t="relative-to-ground"===d?"ground":"scene";for(let o=0;o<u;++o){const r=3*o,[c,l,i]=f(r),u=n.calculateOffsetRenderUnits(a),d=s.getElevation(c,l,0,s.spatialReference,t)??0;e[r+2]=i+u+d}}break;case"absolute-height":for(let t=0;t<u;++t){const o=3*t,r=e[o+2],c=n.calculateOffsetRenderUnits(a);e[o+2]=r+c}}return e}const c=new Float64Array(3);export{n as applyElevationAlignment,r as generateId};