@arcgis/core 4.28.0-next.20230818 → 4.28.0-next.20230821
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.
- package/arcade/functions/centroid.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/003744a45b07865f1be9.js +1 -0
- package/assets/esri/core/workers/chunks/034accc7cab6c88a3b31.js +1 -0
- package/assets/esri/core/workers/chunks/05ab09713d599687afa3.js +1 -0
- package/assets/esri/core/workers/chunks/{3724f23b6f5ac8ec2568.js → 12b8fe0374fa9ab4ca09.js} +1 -1
- package/assets/esri/core/workers/chunks/16d1a72014074e87ecb9.js +1 -0
- package/assets/esri/core/workers/chunks/{e4b6565c16430b28ad93.js → 19857e5420cdf23c5f2e.js} +1 -1
- package/assets/esri/core/workers/chunks/{1a804dea42c0fb5e5c07.js → 1bab408eaffd2c18976d.js} +1 -1
- package/assets/esri/core/workers/chunks/201365f53509e3f78e17.js +1 -0
- package/assets/esri/core/workers/chunks/{2031451b82ff70fb201a.js → 2f48f4a9a0a056ac5e1c.js} +1 -1
- package/assets/esri/core/workers/chunks/318b51fdee09c1fd750f.js +1 -0
- package/assets/esri/core/workers/chunks/{5b799dc155adeb728c74.js → 3361e3e8385f8de8820c.js} +1 -1
- package/assets/esri/core/workers/chunks/3ce1870c28ab6ac3648e.js +1 -0
- package/assets/esri/core/workers/chunks/41929e4531787389804b.js +1 -0
- package/assets/esri/core/workers/chunks/{55ac725127c5ea9fb942.js → 4e39252f40bc57be9d12.js} +1 -1
- package/assets/esri/core/workers/chunks/4e496b03ce24b1206f86.js +1 -0
- package/assets/esri/core/workers/chunks/{ee5f17c1790dc07f9d9e.js → 50455c84131b634ca6b4.js} +1 -1
- package/assets/esri/core/workers/chunks/54513578f735d274a20e.js +1 -0
- package/assets/esri/core/workers/chunks/{d46f8ef92e79d12384c9.js → 587437526ea77f764986.js} +1 -1
- package/assets/esri/core/workers/chunks/{ab720e2f0a35138564b2.js → 5ffabd1a90c5b08109aa.js} +1 -1
- package/assets/esri/core/workers/chunks/6108d72faf48a592c8ba.js +1 -0
- package/assets/esri/core/workers/chunks/6479439afae01f9bb5e6.js +1 -0
- package/assets/esri/core/workers/chunks/69306dfc89e877539223.js +1 -0
- package/assets/esri/core/workers/chunks/6db4a6f9d25691830829.js +1 -0
- package/assets/esri/core/workers/chunks/{61393fd3376ea599a447.js → 76e27cece1559ae815df.js} +1 -1
- package/assets/esri/core/workers/chunks/81526909c0fa11639038.js +1 -0
- package/assets/esri/core/workers/chunks/873111ddf4813cdd4903.js +1 -0
- package/assets/esri/core/workers/chunks/8d4f1170394a8be15da9.js +1 -0
- package/assets/esri/core/workers/chunks/8d8bdfda09c24e363f78.js +1 -0
- package/assets/esri/core/workers/chunks/9b54b5bdb6367c36f6e9.js +1 -0
- package/assets/esri/core/workers/chunks/b2752e038c5fa3c21e49.js +1 -0
- package/assets/esri/core/workers/chunks/{dd3b7cfc6f78552249a4.js → b78dc6cbe14e5817b4d9.js} +1 -1
- package/assets/esri/core/workers/chunks/{e31d0c7363cbceeb5ac9.js → c35b850fbfcb28133235.js} +1 -1
- package/assets/esri/core/workers/chunks/c83e1be4ee64320cf2fe.js +1 -0
- package/assets/esri/core/workers/chunks/c88869d2a647c22dc3e6.js +1 -0
- package/assets/esri/core/workers/chunks/cb0a5bc6deaa98026bb5.js +1 -0
- package/assets/esri/core/workers/chunks/{767467738aeabec14abd.js → d0c4367a197b193e95d4.js} +1 -1
- package/assets/esri/core/workers/chunks/{f113141e254505116b82.js → d1cc2c050423595e54e0.js} +1 -1
- package/assets/esri/core/workers/chunks/{7f34945036495ad7c3f8.js → d2a8bf2d090b94cb294b.js} +1 -1
- package/assets/esri/core/workers/chunks/{08af7f7f1950a59a8e47.js → d6c96a20e9640b433719.js} +4 -4
- package/assets/esri/core/workers/chunks/da5453e67d00ff546640.js +1 -0
- package/assets/esri/core/workers/chunks/daa79c14150c12d8bc3d.js +1 -0
- package/assets/esri/core/workers/chunks/ef03b78659c72de93076.js +1 -0
- package/assets/esri/core/workers/chunks/{c3cace5b25b5170228ba.js → f2fe89b6ac6bf6817e71.js} +1 -1
- package/assets/esri/core/workers/chunks/f3554627664a419e00fa.js +1 -0
- package/assets/esri/themes/base/_core.scss +2 -0
- package/assets/esri/themes/base/widgets/_DirectionalPad.scss +76 -0
- package/assets/esri/themes/base/widgets/_Editor.scss +65 -4
- package/assets/esri/themes/base/widgets/_UtilityNetworkAssociations.scss +97 -39
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad.json +1 -0
- package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_en.json +1 -0
- package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-caps/butt.png +0 -0
- package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-caps/round.png +0 -0
- package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-caps/square.png +0 -0
- package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/dash-dot.png +0 -0
- package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/dash.png +0 -0
- package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/dot.png +0 -0
- package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/long-dash-dot-dot.png +0 -0
- package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/long-dash-dot.png +0 -0
- package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/long-dash.png +0 -0
- package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dash-dot-dot.png +0 -0
- package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dash-dot.png +0 -0
- package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dash.png +0 -0
- package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dot.png +0 -0
- package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/solid.png +0 -0
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_en.json +1 -1
- package/chunks/HighlightBlur.glsl.js +3 -3
- package/chunks/HighlightDownsample.glsl.js +24 -6
- package/chunks/SSAO.glsl.js +2 -2
- package/core/timeUtils.js +1 -1
- package/interfaces.d.ts +182 -2
- package/intl/date.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/ImageryLayer.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/StreamLayer.js +1 -1
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/graphics/sources/support/uploads.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/save/featureLayerUtils.js +1 -1
- package/layers/save/imageryUtils.js +1 -1
- package/layers/save/streamLayerUtils.js +1 -1
- package/libs/maquette-advanced-projector/utils.js +1 -1
- package/package.json +1 -1
- package/popup/support/FieldInfoFormat.js +1 -1
- package/portal/PortalItem.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/navigation/MapViewNavigation.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/support/LaserLineRenderer.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
- package/views/3d/webgl-engine/lib/GLMaterials.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightDownsample.glsl.js +1 -1
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/interactive/sketch/constraints.js +1 -1
- package/views/interactive/sketch/normalizedPoint.js +1 -1
- package/views/interactive/snapping/SnappingManager.js +1 -1
- package/views/interactive/snapping/candidates/IntersectionSnappingCandidate.js +1 -1
- package/views/interactive/tooltip/TooltipEditableField.js +1 -1
- package/views/interactive/tooltip/TooltipEditableFieldAngle.js +1 -1
- package/views/interactive/tooltip/constraintUtils.js +5 -0
- package/views/support/angularMeasurementUtils.js +1 -1
- package/widgets/Compass/CompassViewModel.js +1 -1
- package/widgets/Compass/utils.js +5 -0
- package/widgets/DirectionalPad/DirectionalPadViewModel.d.ts +4 -0
- package/widgets/DirectionalPad/DirectionalPadViewModel.js +5 -0
- package/widgets/DirectionalPad/VisibleElements.js +5 -0
- package/widgets/DirectionalPad/constants.js +5 -0
- package/widgets/DirectionalPad/css.js +5 -0
- package/widgets/DirectionalPad/utils.js +5 -0
- package/widgets/DirectionalPad.d.ts +4 -0
- package/widgets/DirectionalPad.js +5 -0
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/Upload.js +1 -1
- package/widgets/Editor/components/CreateFeaturesPanelContent.js +1 -1
- package/widgets/Editor/components/UploadDetails.js +1 -1
- package/widgets/Editor/modelUploadUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/ElevationProfile.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/FieldInput.js +1 -1
- package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
- package/widgets/FeatureForm/InputBase.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js +5 -0
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
- package/widgets/UtilityNetworkAssociations/VisibleElements.js +5 -0
- package/widgets/UtilityNetworkAssociations/VisibleElementsSettingsPane.js +5 -0
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/assets/esri/core/workers/chunks/11abbbf97093b55e2417.js +0 -1
- package/assets/esri/core/workers/chunks/1b2a081f2c3b97ba7e00.js +0 -1
- package/assets/esri/core/workers/chunks/235f333177ed7ea21e01.js +0 -1
- package/assets/esri/core/workers/chunks/3725dd14c2da0f47198f.js +0 -1
- package/assets/esri/core/workers/chunks/39467e1da18924cfb9b6.js +0 -1
- package/assets/esri/core/workers/chunks/42595c4870c673ed451c.js +0 -1
- package/assets/esri/core/workers/chunks/481cdd2a4bc40c6fef66.js +0 -1
- package/assets/esri/core/workers/chunks/54893132e70c515ea7e3.js +0 -1
- package/assets/esri/core/workers/chunks/6509a4198972b323d9b6.js +0 -1
- package/assets/esri/core/workers/chunks/68598d2806d4aa3d8acc.js +0 -1
- package/assets/esri/core/workers/chunks/718d2e8ea61f3b7b70c5.js +0 -1
- package/assets/esri/core/workers/chunks/7bce4b5eec630ef57f1e.js +0 -1
- package/assets/esri/core/workers/chunks/81df7304f97d1fc3ba16.js +0 -1
- package/assets/esri/core/workers/chunks/8706dc9f852df9b2095d.js +0 -1
- package/assets/esri/core/workers/chunks/8ef26aac0fe7feb8c324.js +0 -1
- package/assets/esri/core/workers/chunks/91e61da22f258d9e86c5.js +0 -1
- package/assets/esri/core/workers/chunks/9f039bf79b34d8fd75ae.js +0 -1
- package/assets/esri/core/workers/chunks/a1f3352301472e4b8956.js +0 -1
- package/assets/esri/core/workers/chunks/a20fd9e7db37b3c3b041.js +0 -1
- package/assets/esri/core/workers/chunks/aa83dce42d64034a0a13.js +0 -1
- package/assets/esri/core/workers/chunks/c8c8471b59700914ee9d.js +0 -1
- package/assets/esri/core/workers/chunks/cdcf0a5e05283d37b3ac.js +0 -1
- package/assets/esri/core/workers/chunks/d4f9106bf2ea5d66d96a.js +0 -1
- package/assets/esri/core/workers/chunks/e6bfbc4347fa13db4df2.js +0 -1
- package/assets/esri/core/workers/chunks/f1d5487f2d828fb142ba.js +0 -1
- package/assets/esri/core/workers/chunks/f97f165d05439e668e05.js +0 -1
- package/assets/esri/core/workers/chunks/fe973d8155c22d73a4f9.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import i from"../../../Viewpoint.js";import o from"../../../core/Accessor.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../geometry/Point.js";import{rotateBy as r,translateBy as c,padAndScaleAndRotateBy as h}from"../viewpointUtils.js";import m from"./ZoomBox.js";import p from"./actions/Pan.js";import u from"./actions/Pinch.js";import l from"./actions/Rotate.js";const v=10,w=1,g=new i({targetGeometry:new a}),_=[0,0],d=250;let T=class extends o{constructor(t){super(t),this._endTimer=null,this._lastEventTimestamp=null,this.animationManager=null,this.interacting=!1}initialize(){this.pan=new p({navigation:this}),this.rotate=new l({navigation:this}),this.pinch=new u({navigation:this}),this.zoomBox=new m({view:this.view,navigation:this})}destroy(){this.pan=n(this.pan),this.rotate=n(this.rotate),this.pinch=n(this.pinch),this.zoomBox=n(this.zoomBox),this.animationManager=null}begin(){this._set("interacting",!0)}end(){this._lastEventTimestamp=performance.now(),this._startTimer(d)}async zoom(t,i=this._getDefaultAnchor()){if(this.stop(),this.begin(),this.view.constraints.snapToZoom&&this.view.constraints.effectiveLODs)return t<1?this.zoomIn(i):this.zoomOut(i);this.setViewpoint(i,t,0,[0,0])}async zoomIn(t){const i=this.view,o=i.constraints.snapToNextScale(i.scale);return this._zoomToScale(o,t)}async zoomOut(t){const i=this.view,o=i.constraints.snapToPreviousScale(i.scale);return this._zoomToScale(o,t)}setViewpoint(t,i,o,n){this.begin(),this.view.stateManager.state.viewpoint=this._scaleRotateTranslateViewpoint(this.view.viewpoint,t,i,o,n),this.end()}setViewpointImmediate(t,i=0,o=[0,0],n=this._getDefaultAnchor()){this.view.stateManager.state.viewpoint=this._scaleRotateTranslateViewpoint(this.view.viewpoint,n,t,i,o)}continousRotateClockwise(){const t=this.view.viewpoint;this.animationManager?.animateContinous(t,(t=>{r(t,t,-w)}))}continousRotateCounterclockwise(){const t=this.view.viewpoint;this.animationManager?.animateContinous(t,(t=>{r(t,t,w)}))}resetRotation(){this.view.rotation=0}continousPanLeft(){this._continuousPan([-v,0])}continousPanRight(){this._continuousPan([v,0])}continousPanUp(){this._continuousPan([0,v])}continousPanDown(){this._continuousPan([0,-v])}stop(){this.pan.stopMomentumNavigation(),this.animationManager?.stop(),this.end(),null!==this._endTimer&&(clearTimeout(this._endTimer),this._endTimer=null,this._set("interacting",!1))}_continuousPan(t){const i=this.view.viewpoint;this.animationManager?.animateContinous(i,(i=>{c(i,i,t),this.view.constraints.constrainByGeometry(i)}))}_startTimer(t){return null!==this._endTimer||(this._endTimer=setTimeout((()=>{this._endTimer=null;const t=performance.now()-(this._lastEventTimestamp??0);t<d?this._endTimer=this._startTimer(t):this._set("interacting",!1)}),t)),this._endTimer}_getDefaultAnchor(){const{size:t,padding:{left:i,right:o,top:n,bottom:e}}=this.view;return _[0]=.5*(t[0]-o+i),_[1]=.5*(t[1]-e+n),_}async _zoomToScale(t,i=this._getDefaultAnchor()){const{view:o}=this,{constraints:n,scale:e,viewpoint:s,size:a,padding:r}=o,c=n.canZoomInTo(t),m=n.canZoomOutTo(t);if(!(t<e&&!c||t>e&&!m))return h(g,s,t/e,0,i,a,r),n.constrainByGeometry(g),o.goTo(g,{animate:!0})}_scaleRotateTranslateViewpoint(t,i,o,n,e){const{view:s}=this,{size:a,padding:r,constraints:m,scale:p,viewpoint:u}=s,l=p*o,v=m.canZoomInTo(l),w=m.canZoomOutTo(l);return(o<1&&!v||o>1&&!w)&&(o=1),c(u,u,e),h(t,u,o,n,i,a,r),m.constrainByGeometry(t)}};t([e()],T.prototype,"animationManager",void 0),t([e({type:Boolean,readOnly:!0})],T.prototype,"interacting",void 0),t([e()],T.prototype,"pan",void 0),t([e()],T.prototype,"pinch",void 0),t([e()],T.prototype,"rotate",void 0),t([e()],T.prototype,"view",void 0),t([e()],T.prototype,"zoomBox",void 0),T=t([s("esri.views.2d.navigation.MapViewNavigation")],T);const y=T;export{y as default};
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import i from"../../../Viewpoint.js";import o from"../../../core/Accessor.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../geometry/Point.js";import{rotateBy as r,translateBy as c,padAndScaleAndRotateBy as h}from"../viewpointUtils.js";import m from"./ZoomBox.js";import p from"./actions/Pan.js";import u from"./actions/Pinch.js";import l from"./actions/Rotate.js";const v=10,w=1,g=new i({targetGeometry:new a}),_=[0,0],d=250;let T=class extends o{constructor(t){super(t),this._endTimer=null,this._lastEventTimestamp=null,this.animationManager=null,this.interacting=!1}initialize(){this.pan=new p({navigation:this}),this.rotate=new l({navigation:this}),this.pinch=new u({navigation:this}),this.zoomBox=new m({view:this.view,navigation:this})}destroy(){this.pan=n(this.pan),this.rotate=n(this.rotate),this.pinch=n(this.pinch),this.zoomBox=n(this.zoomBox),this.animationManager=null}begin(){this._set("interacting",!0)}end(){this._lastEventTimestamp=performance.now(),this._startTimer(d)}async zoom(t,i=this._getDefaultAnchor()){if(this.stop(),this.begin(),this.view.constraints.snapToZoom&&this.view.constraints.effectiveLODs)return t<1?this.zoomIn(i):this.zoomOut(i);this.setViewpoint(i,t,0,[0,0])}async zoomIn(t){const i=this.view,o=i.constraints.snapToNextScale(i.scale);return this._zoomToScale(o,t)}async zoomOut(t){const i=this.view,o=i.constraints.snapToPreviousScale(i.scale);return this._zoomToScale(o,t)}setViewpoint(t,i,o,n){this.begin(),this.view.stateManager.state.viewpoint=this._scaleRotateTranslateViewpoint(this.view.viewpoint,t,i,o,n),this.end()}setViewpointImmediate(t,i=0,o=[0,0],n=this._getDefaultAnchor()){this.view.stateManager.state.viewpoint=this._scaleRotateTranslateViewpoint(this.view.viewpoint,n,t,i,o)}continousRotateClockwise(){const t=this.view.viewpoint;this.animationManager?.animateContinous(t,(t=>{r(t,t,-w)}))}continousRotateCounterclockwise(){const t=this.view.viewpoint;this.animationManager?.animateContinous(t,(t=>{r(t,t,w)}))}resetRotation(){this.view.rotation=0}continousPanLeft(){this._continuousPan([-v,0])}continousPanRight(){this._continuousPan([v,0])}continousPanUp(){this._continuousPan([0,v])}continousPanDown(){this._continuousPan([0,-v])}continuousPanVector({x:t,y:i}){this._continuousPan([t*v,i*v])}stop(){this.pan.stopMomentumNavigation(),this.animationManager?.stop(),this.end(),null!==this._endTimer&&(clearTimeout(this._endTimer),this._endTimer=null,this._set("interacting",!1))}_continuousPan(t){const i=this.view.viewpoint;this.animationManager?.animateContinous(i,(i=>{c(i,i,t),this.view.constraints.constrainByGeometry(i)}))}_startTimer(t){return null!==this._endTimer||(this._endTimer=setTimeout((()=>{this._endTimer=null;const t=performance.now()-(this._lastEventTimestamp??0);t<d?this._endTimer=this._startTimer(t):this._set("interacting",!1)}),t)),this._endTimer}_getDefaultAnchor(){const{size:t,padding:{left:i,right:o,top:n,bottom:e}}=this.view;return _[0]=.5*(t[0]-o+i),_[1]=.5*(t[1]-e+n),_}async _zoomToScale(t,i=this._getDefaultAnchor()){const{view:o}=this,{constraints:n,scale:e,viewpoint:s,size:a,padding:r}=o,c=n.canZoomInTo(t),m=n.canZoomOutTo(t);if(!(t<e&&!c||t>e&&!m))return h(g,s,t/e,0,i,a,r),n.constrainByGeometry(g),o.goTo(g,{animate:!0})}_scaleRotateTranslateViewpoint(t,i,o,n,e){const{view:s}=this,{size:a,padding:r,constraints:m,scale:p,viewpoint:u}=s,l=p*o,v=m.canZoomInTo(l),w=m.canZoomOutTo(l);return(o<1&&!v||o>1&&!w)&&(o=1),c(u,u,e),h(t,u,o,n,i,a,r),m.constrainByGeometry(t)}};t([e()],T.prototype,"animationManager",void 0),t([e({type:Boolean,readOnly:!0})],T.prototype,"interacting",void 0),t([e()],T.prototype,"pan",void 0),t([e()],T.prototype,"pinch",void 0),t([e()],T.prototype,"rotate",void 0),t([e()],T.prototype,"view",void 0),t([e()],T.prototype,"zoomBox",void 0),T=t([s("esri.views.2d.navigation.MapViewNavigation")],T);const y=T;export{y 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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import{lerp as t}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i,initial as a,sync as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{l,i as d,f as p}from"../../../chunks/vec3.js";import{f as u}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import{isMoon as _,isEarth as c,isMars as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as w}from"../../ViewingMode.js";import{AtmosphereType as f}from"./AtmosphereType.js";import{ChapmanAtmosphere as y}from"./ChapmanAtmosphere.js";import{CloudsComposition as P}from"./CloudsComposition.js";import{isReadyCloudsData as v,CloudsRenderingStages as b}from"./CloudsData.js";import{CloudsGenerator as R}from"./CloudsGenerator.js";import{FadeMode as A}from"./CloudsParameters.js";import{cloudPresets as x}from"./CloudsPresets.js";import{Fog as F,FogParameters as N}from"./Fog.js";import{LocalAtmosphere as C}from"./LocalAtmosphere.js";import E from"./MarsAtmosphere.js";import{Precipitation as j}from"./Precipitation.js";import{Stars as W}from"./Stars.js";import{weatherHeightLimit as S}from"./weather.js";import{ShaderOutput as O}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as M}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as T}from"../webgl-engine/lib/RenderSlot.js";import{Update as z}from"../webgl-engine/lib/Update.js";var L;let U=L=class extends M{constructor(e){super(e),this.renderSlots=[T.POSTPROCESSING_ENVIRONMENT_OPAQUE,T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT],this._context=null,this._atmosphere=null,this._oldWeatherParameters=new I,this._newWeatherParameters=new I,this._fadedWeatherParameters=new I,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return null!=this.atmosphere?this.atmosphere.type:f.None}canRender(){return!(null===this._atmosphere&&null===this._stars)}requires(e){return e===O.Depth&&this._atmosphereType===f.Realistic}updateAnimation(e){return null!=this._precipitation&&this._precipitation.update(e)}get updating(){return null!=this._stars&&this._stars.updating||null!=this._clouds&&this._clouds.running}get weatherVisible(){return l(this.view.state.camera.eye)-m(this.view.spatialReference).radius<=S}get usedMemory(){return this._clouds?.usedMemory??0}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,r=this._get("_stars");return t&&null!=this._context?null!=r?r:new W({view:e,requestRender:()=>this._setNeedsRender()}):(s(r),null)}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||null==this._context)return s(e),null;const t=this.view,r=this._context;return null!=e&&e.context===r?e:(s(e),new j({context:r,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context;return s(e),new R({context:r,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||null==this._context)return s(e),null;const t=this.view.state.viewingMode,r=this._context.renderContext.rctx,i=m(this.view.spatialReference).radius;return null!=e&&e.viewingMode===t&&e.planetRadius===i?e:(s(e),new P({rctx:r,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context,i=this._context.renderContext.rctx,a=this.view.state.viewingMode;return new F({context:r,view:t,rctx:i,viewingMode:a})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([r((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled})),(e=>this._updateAtmosphere(e)),i),r((()=>this._stars),t),r((()=>this._precipitation),t),r((()=>this._clouds),(()=>this._updateWeather()),a),r((()=>this._fog),(()=>this._updateFogHaze()),a),r((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),o),r((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),i)])}uninitializeRenderContext(){this._context=null,this._atmosphere=s(this._atmosphere),this._set("_stars",s(this._stars)),this._set("_precipitation",s(this._precipitation)),this._set("_clouds",s(this._clouds)),this._set("_cloudsComposition",s(this._cloudsComposition)),this._set("_fog",s(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=v(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&(this._updateWeatherFading(e.bindParameters,e.time),e.bindParameters.cloudsFade.renderingStage===b.FINISHED&&null!=this._clouds&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}render(e){if(e.output===O.Color)switch(e.bindParameters.slot){case T.POSTPROCESSING_ENVIRONMENT_OPAQUE:null!=this._stars&&this._stars.render(e),null!=this.atmosphere&&(this.atmosphere.render(e,this.view?._stage?.renderer?.fullResolutionAtmosphere),null!=this._cloudsComposition&&null!=e.bindParameters.cloudsFade.data&&(this.weatherVisible&&null!=this._clouds&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),e.bindParameters.cloudsFade.isFading&&null!=this._context&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&this._context.requestRender());break;case T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(null!=this.atmosphere&&(this.atmosphere.renderHaze(e,this._weatherParameters.hazeAmount,this.view?._stage?.renderer?.fullResolutionAtmosphere),this._weatherParameters.fog.amount>0&&null!=this._fog&&this._fog.render(e,this._weatherParameters.fog),null!=this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,r){if(null!=this._context){const i=this._context.renderContext;i.bindParameters.oldLighting.copyFrom(i.bindParameters.lighting),i.bindParameters.newLighting.noonFactor=t,i.bindParameters.newLighting.globalFactor=s,i.bindParameters.newLighting.set(e);r===z.Faded||i.bindParameters.weatherFading?i.bindParameters.fadeLighting(0):i.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return null==e?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e,t){e.cloudsFade.updateFading(e.camera,this.view.state.mode,t,this.view.qualitySettings.fadeDuration),e.cloudsFade.updateParallax(e.camera),e.weatherFading&&(this._updateLighting(e),this._updateFogAtmoshpere(e))}_updateLighting(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?e.fadeLighting(0):e.fadeLighting(e.cloudsFade.fadeFactor)}_updateFogAtmoshpere(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?this._fadeWeather(0):this._fadeWeather(e.cloudsFade.fadeFactor)}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;null!=e&&null!=this._clouds&&(this._clouds.applyPreset(x[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){null!=this._context&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(null==this._fog||null==e||null==this._context)return;const s=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=t(3e-5,.005,e.weatherAdjustment**3),d(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}s.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(t!==f.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==t){this._atmosphere=s(this._atmosphere);const e=this._getAtmosphereClass(t);e&&(this._atmosphere=new e(this.view,this._context))}}else this._atmosphere=s(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(e){switch(e){case f.Realistic:return y;case f.Local:return C;case f.Mars:return E;default:case f.None:return null}}_selectAtmosphereType(e){const{enabled:t,viewingMode:s}=e;return!t||_(this.view.spatialReference)?f.None:s===w.Local?f.Local:null!=this._context&&y.isSupported(this._context)&&c(this.view.spatialReference)?f.Realistic:g(this.view.spatialReference)?f.Mars:f.None}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),stubGetAtmosphereClass:e=>{V=L.prototype._getAtmosphereClass,L.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{L.prototype._getAtmosphereClass=V}}}};e([n({constructOnly:!0})],U.prototype,"view",void 0),e([n({readOnly:!0})],U.prototype,"atmosphere",null),e([n({readOnly:!0})],U.prototype,"_atmosphereType",null),e([n({type:Boolean,readOnly:!0})],U.prototype,"updating",null),e([n({readOnly:!0})],U.prototype,"weatherVisible",null),e([n()],U.prototype,"_context",void 0),e([n()],U.prototype,"_atmosphere",void 0),e([n({readOnly:!0})],U.prototype,"_stars",null),e([n({readOnly:!0})],U.prototype,"_precipitation",null),e([n({readOnly:!0})],U.prototype,"_clouds",null),e([n({readOnly:!0})],U.prototype,"_cloudsComposition",null),e([n({readOnly:!0})],U.prototype,"_fog",null),e([n({readOnly:!0})],U.prototype,"weatherEnabled",null),e([n({readOnly:!0})],U.prototype,"_precipitationEnabled",null),e([n({readOnly:!0})],U.prototype,"_weatherUpdateParameters",null),U=L=e([h("esri.views.3d.environment.EnvironmentRenderer")],U);class I{constructor(){this.fog=new N,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,d(this.fog.color,e.fog.color)}lerp(e,s,r){this.fog.amount=t(e.fog.amount,s.fog.amount,r),this.hazeAmount=t(e.hazeAmount,s.hazeAmount,r),this.fog.strength=t(e.fog.strength,s.fog.strength,r),p(this.fog.color,e.fog.color,s.fog.color,r)}}const q=u(.5,.5,.5),D=u(1.5,1.5,1.5);let V;export{U as EnvironmentRenderer,I as WeatherParameters};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import{lerp as t}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i,initial as a,sync as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{l,i as d,f as p}from"../../../chunks/vec3.js";import{f as u}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import{isMoon as _,isEarth as c,isMars as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as w}from"../../ViewingMode.js";import{AtmosphereType as f}from"./AtmosphereType.js";import{ChapmanAtmosphere as y}from"./ChapmanAtmosphere.js";import{CloudsComposition as P}from"./CloudsComposition.js";import{isReadyCloudsData as v,CloudsRenderingStages as b}from"./CloudsData.js";import{CloudsGenerator as R}from"./CloudsGenerator.js";import{FadeMode as A}from"./CloudsParameters.js";import{cloudPresets as x}from"./CloudsPresets.js";import{Fog as F,FogParameters as N}from"./Fog.js";import{LocalAtmosphere as C}from"./LocalAtmosphere.js";import E from"./MarsAtmosphere.js";import{Precipitation as j}from"./Precipitation.js";import{Stars as W}from"./Stars.js";import{weatherHeightLimit as S}from"./weather.js";import{ShaderOutput as O}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as M}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as T}from"../webgl-engine/lib/RenderSlot.js";import{Update as z}from"../webgl-engine/lib/Update.js";var L;let U=L=class extends M{constructor(e){super(e),this.renderSlots=[T.POSTPROCESSING_ENVIRONMENT_OPAQUE,T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT],this._context=null,this._atmosphere=null,this._oldWeatherParameters=new I,this._newWeatherParameters=new I,this._fadedWeatherParameters=new I,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return null!=this.atmosphere?this.atmosphere.type:f.None}produces(){return!(null===this._atmosphere&&null===this._stars)}consumes(e){return e===O.Depth&&this._atmosphereType===f.Realistic}updateAnimation(e){return null!=this._precipitation&&this._precipitation.update(e)}get updating(){return null!=this._stars&&this._stars.updating||null!=this._clouds&&this._clouds.running}get weatherVisible(){return l(this.view.state.camera.eye)-m(this.view.spatialReference).radius<=S}get usedMemory(){return this._clouds?.usedMemory??0}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,r=this._get("_stars");return t&&null!=this._context?null!=r?r:new W({view:e,requestRender:()=>this._setNeedsRender()}):(s(r),null)}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||null==this._context)return s(e),null;const t=this.view,r=this._context;return null!=e&&e.context===r?e:(s(e),new j({context:r,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context;return s(e),new R({context:r,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||null==this._context)return s(e),null;const t=this.view.state.viewingMode,r=this._context.renderContext.rctx,i=m(this.view.spatialReference).radius;return null!=e&&e.viewingMode===t&&e.planetRadius===i?e:(s(e),new P({rctx:r,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context,i=this._context.renderContext.rctx,a=this.view.state.viewingMode;return new F({context:r,view:t,rctx:i,viewingMode:a})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([r((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled})),(e=>this._updateAtmosphere(e)),i),r((()=>this._stars),t),r((()=>this._precipitation),t),r((()=>this._clouds),(()=>this._updateWeather()),a),r((()=>this._fog),(()=>this._updateFogHaze()),a),r((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),o),r((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),i)])}uninitializeRenderContext(){this._context=null,this._atmosphere=s(this._atmosphere),this._set("_stars",s(this._stars)),this._set("_precipitation",s(this._precipitation)),this._set("_clouds",s(this._clouds)),this._set("_cloudsComposition",s(this._cloudsComposition)),this._set("_fog",s(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=v(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&(this._updateWeatherFading(e.bindParameters,e.time),e.bindParameters.cloudsFade.renderingStage===b.FINISHED&&null!=this._clouds&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}render(e){if(e.output===O.Color)switch(e.bindParameters.slot){case T.POSTPROCESSING_ENVIRONMENT_OPAQUE:null!=this._stars&&this._stars.render(e),null!=this.atmosphere&&(this.atmosphere.render(e,this.view?._stage?.renderer?.fullResolutionAtmosphere),null!=this._cloudsComposition&&null!=e.bindParameters.cloudsFade.data&&(this.weatherVisible&&null!=this._clouds&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),e.bindParameters.cloudsFade.isFading&&null!=this._context&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&this._context.requestRender());break;case T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(null!=this.atmosphere&&(this.atmosphere.renderHaze(e,this._weatherParameters.hazeAmount,this.view?._stage?.renderer?.fullResolutionAtmosphere),this._weatherParameters.fog.amount>0&&null!=this._fog&&this._fog.render(e,this._weatherParameters.fog),null!=this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,r){if(null!=this._context){const i=this._context.renderContext;i.bindParameters.oldLighting.copyFrom(i.bindParameters.lighting),i.bindParameters.newLighting.noonFactor=t,i.bindParameters.newLighting.globalFactor=s,i.bindParameters.newLighting.set(e);r===z.Faded||i.bindParameters.weatherFading?i.bindParameters.fadeLighting(0):i.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return null==e?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e,t){e.cloudsFade.updateFading(e.camera,this.view.state.mode,t,this.view.qualitySettings.fadeDuration),e.cloudsFade.updateParallax(e.camera),e.weatherFading&&(this._updateLighting(e),this._updateFogAtmoshpere(e))}_updateLighting(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?e.fadeLighting(0):e.fadeLighting(e.cloudsFade.fadeFactor)}_updateFogAtmoshpere(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?this._fadeWeather(0):this._fadeWeather(e.cloudsFade.fadeFactor)}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;null!=e&&null!=this._clouds&&(this._clouds.applyPreset(x[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){null!=this._context&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(null==this._fog||null==e||null==this._context)return;const s=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=t(3e-5,.005,e.weatherAdjustment**3),d(this._newWeatherParameters.fog.color,V),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,V),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}s.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(t!==f.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==t){this._atmosphere=s(this._atmosphere);const e=this._getAtmosphereClass(t);e&&(this._atmosphere=new e(this.view,this._context))}}else this._atmosphere=s(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(e){switch(e){case f.Realistic:return y;case f.Local:return C;case f.Mars:return E;default:case f.None:return null}}_selectAtmosphereType(e){const{enabled:t,viewingMode:s}=e;return!t||_(this.view.spatialReference)?f.None:s===w.Local?f.Local:null!=this._context&&y.isSupported(this._context)&&c(this.view.spatialReference)?f.Realistic:g(this.view.spatialReference)?f.Mars:f.None}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),stubGetAtmosphereClass:e=>{k=L.prototype._getAtmosphereClass,L.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{L.prototype._getAtmosphereClass=k}}}};e([n({constructOnly:!0})],U.prototype,"view",void 0),e([n({readOnly:!0})],U.prototype,"atmosphere",null),e([n({readOnly:!0})],U.prototype,"_atmosphereType",null),e([n({type:Boolean,readOnly:!0})],U.prototype,"updating",null),e([n({readOnly:!0})],U.prototype,"weatherVisible",null),e([n()],U.prototype,"_context",void 0),e([n()],U.prototype,"_atmosphere",void 0),e([n({readOnly:!0})],U.prototype,"_stars",null),e([n({readOnly:!0})],U.prototype,"_precipitation",null),e([n({readOnly:!0})],U.prototype,"_clouds",null),e([n({readOnly:!0})],U.prototype,"_cloudsComposition",null),e([n({readOnly:!0})],U.prototype,"_fog",null),e([n({readOnly:!0})],U.prototype,"weatherEnabled",null),e([n({readOnly:!0})],U.prototype,"_precipitationEnabled",null),e([n({readOnly:!0})],U.prototype,"_weatherUpdateParameters",null),U=L=e([h("esri.views.3d.environment.EnvironmentRenderer")],U);class I{constructor(){this.fog=new N,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,d(this.fog.color,e.fog.color)}lerp(e,s,r){this.fog.amount=t(e.fog.amount,s.fog.amount,r),this.hazeAmount=t(e.hazeAmount,s.hazeAmount,r),this.fog.strength=t(e.fog.strength,s.fog.strength,r),p(this.fog.color,e.fog.color,s.fog.color,r)}}const D=u(.5,.5,.5),V=u(1.5,1.5,1.5);let k;export{U as EnvironmentRenderer,I as WeatherParameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Collection.js";import t from"../../../core/Logger.js";import{watch as s,initial as n}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import d from"./RenderContext.js";import{ShaderOutput as a}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as c}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as h}from"../webgl-engine/lib/RenderSlot.js";class l{constructor(){this._renderers=new r}add(e,r){let t=this._findStageRenderer(e);t||(t=new p({view:e}),this._renderers.add(t)),t.add(r)}remove(e,r){const t=this._findStageRenderer(e);t&&(t.remove(r),0===t.renderers.length&&(t.destroy(),this._renderers.remove(t)))}_findStageRenderer(e){return this._renderers.find((r=>r.view===e))}}let p=class extends c{
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Collection.js";import t from"../../../core/Logger.js";import{watch as s,initial as n}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import d from"./RenderContext.js";import{ShaderOutput as a}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as c}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as h}from"../webgl-engine/lib/RenderSlot.js";class l{constructor(){this._renderers=new r}add(e,r){let t=this._findStageRenderer(e);t||(t=new p({view:e}),this._renderers.add(t)),t.add(r)}remove(e,r){const t=this._findStageRenderer(e);t&&(t.remove(r),0===t.renderers.length&&(t.destroy(),this._renderers.remove(t)))}_findStageRenderer(e){return this._renderers.find((r=>r.view===e))}}let p=class extends c{produces(e){return e!==h.TRANSPARENT_MATERIAL||this.renderers.some((e=>"function"==typeof e.renderTransparent))}constructor(e){super(e),this.renderSlots=[h.OPAQUE_MATERIAL,h.TRANSPARENT_MATERIAL],this.renderers=new r,this.context=null}initialize(){this.addHandles([s((()=>this.view.ready),(e=>{e?(this.context=new d(this.view),this.view._stage.addRenderPlugin(this)):(this.renderers.forEach((e=>m(e,"dispose",this.context))),this.context=null)}),n)])}destroy(){this.renderers.drain((e=>{this.context&&m(e,"dispose",this.context)})),this.view._stage?.removeRenderPlugin(this),this.context=null}add(e){this.renderers.includes(e)?t.getLogger("esri.views.3d.externalRenderers.ExternalRendererStore").warn("add(): Cannot add external renderer: renderer has already been added"):(this.renderers.add(e),this.context&&(this._webglStateReset(),m(e,"setup",this.context),this.view._stage.renderView.requestRender()))}remove(e){const r=this.renderers.indexOf(e);-1!==r&&(this.renderers.removeAt(r),this.context&&(m(e,"dispose",this.context),this.view._stage.renderView.requestRender()))}initializeRenderContext(e){this.context.rctx=e.renderContext.rctx,this.renderers.length>0&&this._webglStateReset(),this.renderers.forEach((e=>m(e,"setup",this.context)))}uninitializeRenderContext(){}render(e){0===this.renderers.length||e.output!==a.Color||e.bindParameters.slot!==h.OPAQUE_MATERIAL&&e.bindParameters.slot!==h.TRANSPARENT_MATERIAL||(this._updateContext(e),this._webglStateReset(),this.renderers.forEach((r=>{switch(e.bindParameters.slot){case h.OPAQUE_MATERIAL:m(r,"render",this.context);break;case h.TRANSPARENT_MATERIAL:m(r,"renderTransparent",this.context)}})))}_updateContext(e){this.context.camera.copyFrom(e.bindParameters.camera),this.context.sunLight=e.bindParameters.lighting.legacy,this.context._renderTargetHelper=e.offscreenRenderingHelper}_webglStateReset(){this.context.rctx.resetState(),this.context._renderTargetHelper?.bindFbo()}};function m(e,r,t){"function"==typeof e[r]&&null!=t&&e[r]?.(t)}e([i({constructOnly:!0})],p.prototype,"view",void 0),p=e([o("esri.views.3d.externalRenderers.ExternalRendererStore")],p);export{l 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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as n,l as o,b as a,o as l,d as h,p as c}from"../../../../chunks/vec3.js";import{c as u}from"../../../../chunks/vec3f64.js";import{s as d}from"../../../../chunks/vec4.js";import{create as p,offset as m,contains as g,containsPoint as _,set as f,POSITIVE_INFINITY as P,equals as b}from"../../../../geometry/support/aaBoundingBox.js";import{create as S}from"../../../../geometry/support/plane.js";import{fromPoints as x}from"../../../../geometry/support/ray.js";import{PclTarget as z}from"./Intersector.js";import{PointHighlights as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as n,l as o,b as a,o as l,d as h,p as c}from"../../../../chunks/vec3.js";import{c as u}from"../../../../chunks/vec3f64.js";import{s as d}from"../../../../chunks/vec4.js";import{create as p,offset as m,contains as g,containsPoint as _,set as f,POSITIVE_INFINITY as P,equals as b}from"../../../../geometry/support/aaBoundingBox.js";import{create as S}from"../../../../geometry/support/plane.js";import{fromPoints as x}from"../../../../geometry/support/ray.js";import{PclTarget as z}from"./Intersector.js";import{PointHighlights as w}from"./PointHighlights.js";import{minimumDistancePlane as R,maximumDistancePlane as j,intersectLine as y,toAaBoundingBox as q}from"../../support/orientedBoundingBox.js";import{ShaderOutput as A}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncPrepareRenderPlugin as I}from"../../webgl-engine/effects/RenderPlugin.js";import{Default3D as v}from"../../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{newIntersectorResult as E}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as F,StoreResults as C}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{RenderSlot as O}from"../../webgl-engine/lib/RenderSlot.js";import{VertexArrayObject as T}from"../../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as L}from"../../webgl-engine/lib/VertexAttribute.js";import{P as N,a as H,g as B}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as M}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as D}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{BufferObject as U}from"../../../webgl/BufferObject.js";import{DataType as V,PrimitiveType as W,Usage as k}from"../../../webgl/enums.js";import{VertexElementDescriptor as G}from"../../../webgl/VertexElementDescriptor.js";const Q={positions:[new G(L.POSITION,3,V.FLOAT,0,12)],colors:[new G(L.COLOR,3,V.UNSIGNED_BYTE,0,3,!0)]};let Y=class extends I{constructor(e){super(e),this.type=F.PCL,this.isGround=!1,this.renderSlots=[O.OPAQUE_MATERIAL],this._passParameters=new N,this._highlights=new w({forEachNode:e=>this.forEachNode(e),addHighlight:(e,t,s)=>this._addHighlight(e,t,s),removeHighlight:(e,t)=>this._removeHighlight(e,t)}),this.layerUid="",this._slicePlaneEnabled=!1,this._techniqueConfig=new D,this._nodes=new s}produces(e,t){return t!==A.Highlight||!this._highlights.empty}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,t,s,i){const r=u(),f=u(),P=u(),b=u(),w=S(),A=e.camera.perScreenPixelRatio/2,I=e.camera.near;n(f,i,s);const v=1/o(f);a(f,f,v),l(P,f),d(w,f[0],f[1],f[2],-h(f,s));const F=new ie,O=new ie,T=new Array,L=p(),N=p(this._passParameters.clipBox);m(N,-s[0],-s[1],-s[2],N),this._nodes.forAll((o=>{const a=o.splatSize*this._passParameters.scaleFactor;let l=R(o.obb,w),u=j(o.obb,w);l-=Z(a,l+I,this._passParameters,A,o.isLeaf),u-=Z(a,u+I,this._passParameters,A,o.isLeaf);const d=u<0,p=null!=F.dist&&null!=O.dist&&F.dist<l*v&&O.dist>u*v;if(d||p)return;const S=X(a,u+I,this._passParameters,A,o.isLeaf);if(!y(o.obb,s,f,S))return;const x=S*S;q(o.obb,L),m(L,-s[0],-s[1],-s[2],L);const z=!g(N,L);n(b,o.origin,s);const E=o.coordinates.length/3;for(let n=0;n<E;n++){if(r[0]=b[0]+o.coordinates[3*n],r[1]=b[1]+o.coordinates[3*n+1],r[2]=b[2]+o.coordinates[3*n+2],z&&!_(N,r))continue;const l=h(r,f),u=c(r)-l*l;if(u>x)continue;let d=l+I;const p=Z(a,d,this._passParameters,A,o.isLeaf);if(l-p<0)continue;d-=p;const m=X(a,d,this._passParameters,A,o.isLeaf);if(u>m*m)continue;const g=(l-p)*v,S=e=>(e.point=$(o,n,e.point),e.dist=g,e.normal=P,e.node=o,e.pointId=n,e.layerUid=this.layerUid,e);if((null==F.dist||g<F.dist)&&(null==t||t(s,i,g))&&S(F),e.options.store!==C.MIN&&(null==O.dist||g>O.dist)&&(null==t||t(s,i,g))&&S(O),e.options.store===C.ALL&&(null==t||t(s,i,g))){const e=new ie;T.push(S(e))}}}));const H=e=>{const{layerUid:t,node:s,pointId:i}=e;return new z(e.point,t,i,(()=>this.createGraphic(s,i,e.point)))},B=(e,t)=>{const s=H(t);e.set(this.type,s,t.dist,t.normal)};if(re(F)){const t=e.results.min;(null==t.dist||F.dist<t.dist)&&B(t,F)}if(re(O)&&e.options.store!==C.MIN){const t=e.results.max;(null==t.dist||O.dist>t.dist)&&B(t,O)}if(e.options.store===C.ALL){const t=x(s,i);for(const s of T){const i=E(t);B(i,s),e.results.all.push(i)}}}prepareTechnique(e){return 0===this._nodes.length||e.output!==A.Color&&e.output!==A.Depth&&e.output!==A.Highlight?null:(this._nodes.forAll((t=>{null==t.vao&&this._initNode(e,t)})),this._techniqueConfig.drawScreenSize=this._passParameters.drawScreenSpace,this._techniqueConfig.useFixedSizes=this._passParameters.useFixedSizes,this._techniqueConfig.hasSlicePlane=this._slicePlaneEnabled,this._techniqueConfig.hasOccludees=e.bindParameters.hasOccludees,this._techniqueConfig.clippingEnabled=this._clippingEnabled,this._techniqueConfig.output=e.output===A.Depth?A.Depth:e.output===A.Highlight?A.Highlight:A.Color,this._context.techniqueRepository.releaseAndAcquire(M,this._techniqueConfig,this._technique))}render(e,t){const s=e.rctx,i=s.bindTechnique(t,this._passParameters,e.bindParameters),r=e.output===A.Highlight;this._nodes.forAll((t=>{0===t.coordinates.length||r&&!t.highlights||(i.bindDraw(t,e.bindParameters,this._passParameters),s.bindVAO(t.vao),r?this._renderHighlightFragments(s,t):s.drawArrays(W.POINTS,0,t.coordinates.length/3))}))}_renderHighlightFragments(e,t){const s=t.highlights;if(null==s)return;let i=s[0].component,r=i+1;for(let o=1;o<s.length;o++){const t=s[o].component;if(t!==r){const s=r-i;s>0&&e.drawArrays(W.POINTS,i,s),i=t}r=t+1}const n=r-i;n>0&&e.drawArrays(W.POINTS,i,n)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){f(this._passParameters.clipBox,e||P)}get _clippingEnabled(){return!b(this._passParameters.clipBox,P,((e,t)=>e===t))}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let s=null;return this._nodes.filterInPlace((i=>i.id!==e||(s=i,i.vao=t(i.vao),this._highlights.nodeRemoved(i),!1))),this._requestRender(),s}forEachNode(e){this._nodes.forAll(e)}removeAll(){this._nodes.forAll((e=>e.vao=t(e.vao))),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e){return this._highlights.add(e)}_addHighlight(e,t,s){e.highlights=te(e.highlights,t,s),this._requestRender()}_removeHighlight(e,t){e.highlights=se(e.highlights,t),this._requestRender()}_initNode(e,t){const s=e.rctx;t.vao=new T(s,v,Q,{positions:U.createVertex(s,k.STATIC_DRAW,t.coordinates),colors:U.createVertex(s,k.STATIC_DRAW,t.rgb)})}_requestRender(){this._context&&this._context.requestRender()}};e([i({constructOnly:!0})],Y.prototype,"createGraphic",void 0),Y=e([r("esri.views.3d.layers.i3s.PointRenderer")],Y);class J extends H{constructor(e,t,s,i,r,n,o,a,l=null,h=null){super(s,r,t),this.id=e,this.obb=i,this.coordinates=n,this.rgb=o,this.attributes=a,this.pointIdFilterMap=l,this.highlights=h}}function K(e){return e.hasOwnProperty("splatSize")}function X(e,t,s,i,r){if(s.drawScreenSpace)return s.fixedSize*t*i;const n=B(r)*t*i;return s.useFixedSizes?Math.min(s.fixedSize/2,n):s.screenMinSize>0?Math.min(Math.max(s.screenMinSize*t*i,e/2),n):Math.min(e/2,n)}function Z(e,t,s,i,r){return s.drawScreenSpace?0:X(e,t,s,i,r)}function $(e,t,s){return null==s&&(s=u()),s[0]=e.origin[0]+e.coordinates[3*t],s[1]=e.origin[1]+e.coordinates[3*t+1],s[2]=e.origin[2]+e.coordinates[3*t+2],s}function ee(e){return null!=e.component?e.component:-1}function te(e,t,s){null==e&&(e=[]);const i={component:t,id:s};e.push(i);const r=ee(i);let n=e.length-1;for(;n>0&&r<ee(e[n-1]);)[e[n-1],e[n]]=[e[n],e[n-1]],--n;return e}function se(e,t){if(null==e)return e;const s=e.filter((e=>e.id!==t));return 0===s.length?null:s}class ie{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerUid=""}}function re(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{Y as PointRenderer,J as PointRendererNode,K as isInstanceOfNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{releaseMaybe as t,disposeMaybe as i}from"../../../core/maybe.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{i as r,e as a}from"../../../chunks/vec3.js";import{create as h,fromRay as l,getStart as o,getEnd as c}from"../../../geometry/support/clipRay.js";import{intersectClipRay as d}from"../../../geometry/support/frustum.js";import{copy as p}from"../../../geometry/support/lineSegment.js";import{wrap as _}from"../../../geometry/support/ray.js";import{ViewingMode as u}from"../../ViewingMode.js";import{LaserlinePathData as m}from"./LaserlinePathData.js";import{ShaderOutput as g}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncPrepareRenderPlugin as P}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as b}from"../webgl-engine/lib/RenderSlot.js";import{updateParameters as E}from"../webgl-engine/materials/internal/MaterialUtil.js";import{LaserlinePathTechnique as f}from"../webgl-engine/shaders/LaserlinePathTechnique.js";import{LaserlinePathTechniqueConfiguration as q}from"../webgl-engine/shaders/LaserlinePathTechniqueConfiguration.js";import{LaserlinePassParameters as L,LaserlineTechnique as R}from"../webgl-engine/shaders/LaserlineTechnique.js";import{LaserlineTechniqueConfiguration as V}from"../webgl-engine/shaders/LaserlineTechniqueConfiguration.js";let D=class extends P{constructor(e){super(e),this._technique=null,this._heightManifoldEnabled=!1,this._pointDistanceEnabled=!1,this._lineVerticalPlaneEnabled=!1,this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._viewingMode=u.Local,this._pathVerticalPlaneEnabled=!1,this._pathVerticalPlaneData=null,this._pathTechnique=null,this._passParameters=new L}initialize(){this._passParameters.renderCoordsHelper=this.renderCoordsHelper}get renderSlots(){return[this.contrastControlEnabled?b.LASERLINES_CONTRAST_CONTROL:b.LASERLINES]}
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{releaseMaybe as t,disposeMaybe as i}from"../../../core/maybe.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{i as r,e as a}from"../../../chunks/vec3.js";import{create as h,fromRay as l,getStart as o,getEnd as c}from"../../../geometry/support/clipRay.js";import{intersectClipRay as d}from"../../../geometry/support/frustum.js";import{copy as p}from"../../../geometry/support/lineSegment.js";import{wrap as _}from"../../../geometry/support/ray.js";import{ViewingMode as u}from"../../ViewingMode.js";import{LaserlinePathData as m}from"./LaserlinePathData.js";import{ShaderOutput as g}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncPrepareRenderPlugin as P}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as b}from"../webgl-engine/lib/RenderSlot.js";import{updateParameters as E}from"../webgl-engine/materials/internal/MaterialUtil.js";import{LaserlinePathTechnique as f}from"../webgl-engine/shaders/LaserlinePathTechnique.js";import{LaserlinePathTechniqueConfiguration as q}from"../webgl-engine/shaders/LaserlinePathTechniqueConfiguration.js";import{LaserlinePassParameters as L,LaserlineTechnique as R}from"../webgl-engine/shaders/LaserlineTechnique.js";import{LaserlineTechniqueConfiguration as V}from"../webgl-engine/shaders/LaserlineTechniqueConfiguration.js";let D=class extends P{constructor(e){super(e),this._technique=null,this._heightManifoldEnabled=!1,this._pointDistanceEnabled=!1,this._lineVerticalPlaneEnabled=!1,this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._viewingMode=u.Local,this._pathVerticalPlaneEnabled=!1,this._pathVerticalPlaneData=null,this._pathTechnique=null,this._passParameters=new L}initialize(){this._passParameters.renderCoordsHelper=this.renderCoordsHelper}get renderSlots(){return[this.contrastControlEnabled?b.LASERLINES_CONTRAST_CONTROL:b.LASERLINES]}produces(e){return e===b.LASERLINES||this.contrastControlEnabled&&e===b.LASERLINES_CONTRAST_CONTROL}consumes(e){return e===g.Depth}get isDecoration(){return this._isDecoration}get heightManifoldEnabled(){return this._heightManifoldEnabled}set heightManifoldEnabled(e){this._heightManifoldEnabled!==e&&(this._heightManifoldEnabled=e,this._requestRender())}get heightManifoldTarget(){return this._passParameters.heightManifoldTarget}set heightManifoldTarget(e){r(this._passParameters.heightManifoldTarget,e),this._requestRender()}get pointDistanceEnabled(){return this._pointDistanceEnabled}set pointDistanceEnabled(e){e!==this._pointDistanceEnabled&&(this._pointDistanceEnabled=e,this._requestRender())}get pointDistanceTarget(){return this._passParameters.pointDistanceTarget}set pointDistanceTarget(e){r(this._passParameters.pointDistanceTarget,e),this._requestRender()}get pointDistanceOrigin(){return this._passParameters.pointDistanceOrigin}set pointDistanceOrigin(e){r(this._passParameters.pointDistanceOrigin,e),this._requestRender()}get lineVerticalPlaneEnabled(){return this._lineVerticalPlaneEnabled}set lineVerticalPlaneEnabled(e){e!==this._lineVerticalPlaneEnabled&&(this._lineVerticalPlaneEnabled=e,this._requestRender())}get lineVerticalPlaneSegment(){return this._passParameters.lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){p(e,this._passParameters.lineVerticalPlaneSegment),this._requestRender()}get intersectsLineEnabled(){return this._intersectsLineEnabled}set intersectsLineEnabled(e){e!==this._intersectsLineEnabled&&(this._intersectsLineEnabled=e,this._requestRender())}get intersectsLineSegment(){return this._passParameters.intersectsLineSegment}set intersectsLineSegment(e){p(e,this._passParameters.intersectsLineSegment),this._requestRender()}get intersectsLineRadius(){return this._passParameters.intersectsLineRadius}set intersectsLineRadius(e){e!==this._passParameters.intersectsLineRadius&&(this._passParameters.intersectsLineRadius=e,this._requestRender())}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){e!==this._intersectsLineInfinite&&(this._intersectsLineInfinite=e,this._requestRender())}get viewingMode(){return this._viewingMode}set viewingMode(e){e!==this._viewingMode&&(this._viewingMode=e,this._requestRender())}get pathVerticalPlaneEnabled(){return this._pathVerticalPlaneEnabled}set pathVerticalPlaneEnabled(e){e!==this._pathVerticalPlaneEnabled&&(this._pathVerticalPlaneEnabled=e,null!=this._pathVerticalPlaneData&&this._requestRender())}set pathVerticalPlaneVertices(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new m(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.vertices=e,this.pathVerticalPlaneEnabled&&this._requestRender()}set pathVerticalPlaneBuffers(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new m(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.buffers=e,this.pathVerticalPlaneEnabled&&this._requestRender()}setParameters(e){E(this._passParameters,e)&&this._requestRender()}initializeRenderContext(e){this._context=e,this._techniqueRepository=e.techniqueRepository,this._techniqueConfig=new V;const t=new q;t.contrastControlEnabled=this.contrastControlEnabled,this._pathTechnique=this._techniqueRepository.acquire(f,t)}uninitializeRenderContext(){this._technique=t(this._technique),this._pathVerticalPlaneData=i(this._pathVerticalPlaneData),this._pathTechnique=t(this._pathTechnique)}prepareTechnique(){return this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled?(this._techniqueConfig.heightManifoldEnabled=this.heightManifoldEnabled,this._techniqueConfig.lineVerticalPlaneEnabled=this.lineVerticalPlaneEnabled,this._techniqueConfig.pointDistanceEnabled=this.pointDistanceEnabled,this._techniqueConfig.intersectsLineEnabled=this.intersectsLineEnabled,this._techniqueConfig.contrastControlEnabled=this.contrastControlEnabled,this._techniqueConfig.spherical=this._viewingMode===u.Global,this._technique=this._techniqueRepository.releaseAndAcquire(R,this._techniqueConfig,this._technique),this._technique):this._pathTechnique}render(e,t){(this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled)&&this._renderUnified(e,t),this.pathVerticalPlaneEnabled&&this._renderPath(e)}_renderUnified(e,t){const i=e.rctx;this._updatePassParameters(e),i.bindTechnique(t,this._passParameters,e.bindParameters),i.screen.draw()}_renderPath(e){if(null==this._pathVerticalPlaneData||null==this._pathTechnique)return;const t=e.rctx,i=this._pathTechnique;t.bindTechnique(i,{...this._passParameters,origin:this._pathVerticalPlaneData.origin},e.bindParameters),this._pathVerticalPlaneData.draw(e.rctx)}_updatePassParameters(e){if(!this._intersectsLineEnabled)return;const t=e.bindParameters.camera;if(this._intersectsLineInfinite){if(l(_(this._passParameters.intersectsLineSegment.origin,this._passParameters.intersectsLineSegment.vector),S),S.c0=-Number.MAX_VALUE,!d(t.frustum,S))return;o(S,this._passParameters.lineStartWorld),c(S,this._passParameters.lineEndWorld)}else r(this._passParameters.lineStartWorld,this._passParameters.intersectsLineSegment.origin),a(this._passParameters.lineEndWorld,this._passParameters.intersectsLineSegment.origin,this._passParameters.intersectsLineSegment.vector)}_requestRender(){this._context&&this._context.requestRender()}get test(){return{passParameters:this._passParameters}}};e([s({constructOnly:!0})],D.prototype,"contrastControlEnabled",void 0),e([s({constructOnly:!0})],D.prototype,"_isDecoration",void 0),e([s({constructOnly:!0})],D.prototype,"renderCoordsHelper",void 0),D=e([n("esri.views.3d.support.LaserLineRenderer")],D);const S=h();export{D as LaserLineRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import{someMap as t}from"../../../core/MapUtils.js";import{releaseMaybe as s,disposeMaybe as i,destroyMaybe as o}from"../../../core/maybe.js";import a from"../../../core/PooledArray.js";import{watch as n,syncAndInitial as d,on as h}from"../../../core/reactiveUtils.js";import{someSet as l}from"../../../core/SetUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{x as p,f as m}from"../../../chunks/mat4.js";import{s as _}from"../../../chunks/vec3.js";import{f as g}from"../../../chunks/vec3f64.js";import{ViewingMode as y}from"../../ViewingMode.js";import{DrapeTargetType as R,DrapeSourceType as f,DrapedRenderGroup as T}from"../layers/interfaces.js";import{debugFlags as b}from"../support/debugFlags.js";import{OverlayIndex as v,RenderTargetType as w}from"./interfaces.js";import{Overlay as x}from"./Overlay.js";import{OverlayRenderTarget as D}from"./OverlayRenderTarget.js";import{ColorFormat as S}from"../webgl-engine/core/FBOCache.js";import{ShaderOutput as P}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as O}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as E}from"../../../chunks/TextureOnly.glsl.js";import{ShaderTechniqueRepository as j}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js";import{SyncRenderPlugin as C}from"../webgl-engine/effects/RenderPlugin.js";import{Camera as A}from"../webgl-engine/lib/Camera.js";import{GLMaterialRepository as M}from"../webgl-engine/lib/GLMaterialRepository.js";import{createEmptyDepthTexture as W}from"../webgl-engine/lib/glUtil3D.js";import{GridLocalOriginFactory as q}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderOccludedFlag as L}from"../webgl-engine/lib/Material.js";import{OverlayRenderContext as F}from"../webgl-engine/lib/RenderContext.js";import{RenderSlot as V}from"../webgl-engine/lib/RenderSlot.js";import{ShadowMap as U}from"../webgl-engine/lib/ShadowMap.js";import{SortedRenderGeometryRenderer as H}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{TextureTechnique as I}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as k}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{TransparencyPassType as N}from"../webgl-engine/lib/TransparencyPassType.js";import{UpdatePolicy as G}from"../webgl-engine/lib/UpdatePolicy.js";import{AmbientLight as B}from"../webgl-engine/lighting/Lightsources.js";import{O as z}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as Y}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as X,noBudget as J}from"../../support/Scheduler.js";import{ClearBufferBit as K,TextureSamplingMode as Q}from"../../webgl/enums.js";import{Texture as Z}from"../../webgl/Texture.js";import{TextureDescriptor as $}from"../../webgl/TextureDescriptor.js";let ee=class extends C{get _bindParameters(){return this._renderContext.bindParameters}get _rctx(){return this.view._stage.renderView.renderingContext}get rctx(){return this._rctx}get materialRepository(){return this._materialRepository}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}constructor(e){super(e),this._overlays=null,this._overlayRenderTarget=null,this._overlayParameters=new z,this.hasHighlights=!1,this._rendersOccluded=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new a,this._passParameters=new E,this._materialRepository=null,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new A,this.worldToPCSRatio=1,this.events=new r,this.longitudeCyclical=null,this.renderSlots=[V.DRAPED_MATERIAL,V.DRAPED_WATER]}initialize(){const e=this.view._stage.renderer.fboCache,r=this.view._stage.renderView,{waterTextureRepository:t,stippleTextureRepository:s,markerTextureRepository:i}=r;this._shaderTechniqueRepository=new j({rctx:this._rctx,viewingMode:y.Local,stippleTextureRepository:s,markerTextureRepository:i,waterTextureRepository:t}),this._renderContext=new F(this._rctx,new U(e,this.view.state.viewingMode),null),this.addHandles([n((()=>t.updating),(()=>this.events.emit("content-changed")),d),n((()=>this.spatialReference),(e=>this._localOriginFactory=new q(e)),d),h((()=>this.view.allLayerViews),"after-changes",(()=>this._sortedDrapeSourceRenderersDirty=!0))]),this._materialRepository=new M(r.textureRepository,this._shaderTechniqueRepository,(e=>{(e.renderOccluded&ie)>0!==this._rendersOccluded&&this._updateRendersOccluded(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")}),(()=>this.events.emit("content-changed"))),this._bindParameters.slot=V.DRAPED_MATERIAL,this._bindParameters.mainDepth=W(this._rctx),this._camera.near=1,this._camera.far=1e4,this._camera.relativeElevation=null,this._bindParameters.camera=this._camera,this._bindParameters.transparencyPassType=N.NONE,this._bindParameters.newLighting.noonFactor=0,this._bindParameters.newLighting.globalFactor=0,this._bindParameters.newLighting.set([new B(g(1,1,1))]),this.addHandles(this.view.resourceController.scheduler.registerTask(X.STAGE,this))}destroy(){this._renderers.forEach((e=>e.destroy())),this._renderers.clear(),this._debugTextureTechnique=s(this._debugTextureTechnique),this._passParameters.texture=i(this._passParameters.texture),this._bindParameters.mainDepth=i(this._bindParameters.mainDepth),this._shaderTechniqueRepository=o(this._shaderTechniqueRepository),this.disposeOverlays()}canRender(e,r){return!(r===P.Highlight&&!this.hasHighlights)&&(e===V.DRAPED_MATERIAL||e===V.DRAPED_WATER)}initializeRenderContext(e){this.pluginContext=e}uninitializeRenderContext(){}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,(e=>e.updating))}get hasOverlays(){return null!=this._overlays&&null!=this._overlayRenderTarget}get usedMemory(){return Array.from(this._renderers.values()).reduce(((e,r)=>e+r.usedMemory),0)}createGeometryDrapeSourceRenderer(e){return this.createDrapeSourceRenderer(e,H)}createDrapeSourceRenderer(e,r,t){const s=this._renderers.get(e);null!=s&&s.destroy();const i=new r({...t,rendererContext:this,drapeSource:e});return this._renderers.set(e,i),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(n((()=>e.fullOpacity),(()=>this.events.emit("content-changed"))),e),i}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._overlayRenderTarget?.computeValidity()??0}releaseRenderTargets(){this._overlayRenderTarget?.dispose()}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){null!=this._overlays&&this._overlays.forEach((r=>r.hasTargetWithoutRasterImage=l(e,(e=>e.drapeTargetType===R.WithoutRasterImage))))}ensureDrapeSources(e){null!=this._overlays&&this._overlays.forEach((r=>{r.hasDrapedFeatureSource=l(e,(e=>e.drapeSourceType===f.Features)),r.hasDrapedRasterSource=l(e,(e=>e.drapeSourceType===f.RasterImage))}))}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._overlayRenderTarget=new D(this.view._stage.renderer.fboCache),this._overlays=[new x(v.INNER,this._overlayRenderTarget),new x(v.OUTER,this._overlayRenderTarget)]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._overlayRenderTarget=i(this._overlayRenderTarget),this.events.emit("textures-disposed")}get running(){return this.updating}runTask(e){this._processDrapeSources(e,(()=>!0))}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges()&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers()),s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this.hasHighlights=t(this._renderers,(e=>e.hasHighlights)),this._updateRendersOccluded(),this._updateHasWater())}processSyncDrapeSources(){this._processDrapeSources(J,(e=>e.updatePolicy===G.SYNC))}get isEmpty(){return!b.OVERLAY_DRAW_DEBUG_TEXTURE&&!t(this._renderers,(e=>!e.isEmpty))}get hasWater(){return this._hasWater}get rendersOccluded(){return this._rendersOccluded}get mode(){return this.isEmpty?O.Disabled:this._overlayRenderTarget?.getTexture(w.Water)?O.EnabledWithWater:this._overlayRenderTarget?.getTexture(w.Color)?O.Enabled:O.Disabled}updateAnimation(e){let r=!1;return this._renderers.forEach((t=>r=t.updateAnimation(e)||r)),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}drawTarget(e,r,t){const s=e.canvasGeometries;if(0===s.numViews)return;const{alignPixelEnabled:i,contentPixelRatio:o}=t;this._screenToWorldRatio=o*e.mapUnitsPerPixel/this._bindParameters.overlayStretch;const a=r.output;if(this.isEmpty||a===P.Highlight&&!this.hasHighlights||a===P.Normal&&!this.hasWater||!e.hasSomeSizedView())return;const n=this._rctx;this._camera.pixelRatio=e.pixelRatio*o,this._renderContext.output=a,this._bindParameters.alignPixelEnabled=i,this._bindParameters.screenToWorldRatio=this._screenToWorldRatio,this._bindParameters.screenToPCSRatio=this._screenToWorldRatio*this.worldToPCSRatio,this._bindParameters.slot=a===P.Normal?V.DRAPED_WATER:V.DRAPED_MATERIAL;const d=b.OVERLAY_DRAW_DEBUG_TEXTURE&&r.type!==w.Occluded;if(!d&&!this._sortedRenderers.some((({renderer:e})=>e.shouldRender(this._renderContext))))return;e.applyViewport(this._rctx);const h=2*e.resolution,l=e.resolution,c=r.fbo;if(c.bind(n,h,l),e.index===v.INNER&&(n.setClearColor(0,0,0,0),n.clearSafe(K.COLOR_BUFFER_BIT)),r.type===w.Occluded&&(this._renderContext.renderOccludedMask=ie),d)for(let u=0;u<s.numViews;u++)this._setViewParameters(s.extents[u],e),this._ensureDebugPatternResources(e.resolution,te[e.index]),this._rctx.bindTechnique(this._debugTextureTechnique,this._passParameters,null),this._rctx.screen.draw();this._sortedRenderers.forAll((({drapeSource:t,renderer:i})=>{if(r.type===w.ColorNoRasterImage&&t.drapeSourceType===f.RasterImage)return;const{fullOpacity:o}=t,d=null!=o&&o<1&&a===P.Color?this.bindTemporaryFramebuffer(h,l):null;for(let r=0;r<s.numViews;r++)this._setViewParameters(s.extents[r],e),i.render(this._renderContext);if(d){c.bind(n,h,l),this._overlayParameters.texture=d.colorTexture,this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e.index;const r=this.pluginContext.techniqueRepository.acquire(Y);this._rctx.bindTechnique(r,this._overlayParameters,this._renderContext.bindParameters),this._rctx.screen.draw(),r.release(),d.release()}})),n.bindFramebuffer(null),c.generateMipMap(),this._renderContext.resetRenderOccludedMask()}bindTemporaryFramebuffer(e,r){const t=this.view._stage.renderer.fboCache,s=t.acquire(S.RGBA,e,r);return t.rctx.bindFramebuffer(s.fbo),t.rctx.clearSafe(K.COLOR_BUFFER_BIT),s}async reloadShaders(){await this._shaderTechniqueRepository.reloadAll()}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){let i=0;for(const o of this._renderers.values())i=o.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this.view.map.allLayers;this._renderers.forEach(((r,t)=>{const s=e.indexOf(t.layer),i=s>=0,o=this._renderers.size*(t.renderGroup??(i?T.MapLayer:T.ViewLayer))+(i?s:0);this._sortedRenderers.push(new re(t,r,o))})),this._sortedRenderers.sort(((e,r)=>e.index-r.index))}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],p(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),m(t.viewMatrix,[-e[0],-e[1],0])}_updateHasWater(){const e=t(this._renderers,(e=>e.hasWater));e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water",e))}_updateRendersOccluded(){const e=t(this._renderers,(e=>e.rendersOccluded));e!==this._rendersOccluded&&(this._rendersOccluded=e,this.events.emit("renders-occluded",e))}_ensureDebugPatternResources(e,r){if(_(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let a=0;a<e;a++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(a/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&a?0:255:1&i^1&o?0:128)}const i=new $(e);i.samplingMode=Q.NEAREST,this._passParameters.texture=new Z(this._rctx,i,t);const o=new k;o.hasAlpha=!0,this._debugTextureTechnique=this._shaderTechniqueRepository.acquire(I,o)}get test(){return{drapedRenderers:Array.from(this._renderers.values()),getDrapeSourceRenderer:e=>this._renderers.get(e)}}};e([c()],ee.prototype,"hasHighlights",void 0),e([c()],ee.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([c({autoDestroy:!0})],ee.prototype,"_shaderTechniqueRepository",void 0),e([c({constructOnly:!0})],ee.prototype,"view",void 0),e([c()],ee.prototype,"worldToPCSRatio",void 0),e([c()],ee.prototype,"spatialReference",void 0),e([c({type:Boolean,readOnly:!0})],ee.prototype,"updating",null),e([c()],ee.prototype,"isEmpty",null),ee=e([u("esri.views.3d.terrain.OverlayRenderer")],ee);class re{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const te=[[1,.5,.5],[.5,.5,1]],se=-2,ie=L.OccludeAndTransparent;export{se as DRAPED_Z,ee as OverlayRenderer,ie as overlayRenderOccludedFlag};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import{someMap as t}from"../../../core/MapUtils.js";import{releaseMaybe as s,disposeMaybe as i,destroyMaybe as o}from"../../../core/maybe.js";import a from"../../../core/PooledArray.js";import{watch as n,syncAndInitial as d,on as h}from"../../../core/reactiveUtils.js";import{someSet as l}from"../../../core/SetUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{x as p,f as m}from"../../../chunks/mat4.js";import{s as _}from"../../../chunks/vec3.js";import{f as g}from"../../../chunks/vec3f64.js";import{ViewingMode as y}from"../../ViewingMode.js";import{DrapeTargetType as R,DrapeSourceType as f,DrapedRenderGroup as T}from"../layers/interfaces.js";import{debugFlags as b}from"../support/debugFlags.js";import{OverlayIndex as v,RenderTargetType as w}from"./interfaces.js";import{Overlay as x}from"./Overlay.js";import{OverlayRenderTarget as D}from"./OverlayRenderTarget.js";import{ColorFormat as S}from"../webgl-engine/core/FBOCache.js";import{ShaderOutput as P}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as O}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as E}from"../../../chunks/TextureOnly.glsl.js";import{ShaderTechniqueRepository as j}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js";import{SyncRenderPlugin as C}from"../webgl-engine/effects/RenderPlugin.js";import{Camera as A}from"../webgl-engine/lib/Camera.js";import{GLMaterialRepository as M}from"../webgl-engine/lib/GLMaterialRepository.js";import{createEmptyDepthTexture as W}from"../webgl-engine/lib/glUtil3D.js";import{GridLocalOriginFactory as q}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderOccludedFlag as L}from"../webgl-engine/lib/Material.js";import{OverlayRenderContext as F}from"../webgl-engine/lib/RenderContext.js";import{RenderSlot as V}from"../webgl-engine/lib/RenderSlot.js";import{ShadowMap as U}from"../webgl-engine/lib/ShadowMap.js";import{SortedRenderGeometryRenderer as H}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{TextureTechnique as I}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as k}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{TransparencyPassType as N}from"../webgl-engine/lib/TransparencyPassType.js";import{UpdatePolicy as G}from"../webgl-engine/lib/UpdatePolicy.js";import{AmbientLight as B}from"../webgl-engine/lighting/Lightsources.js";import{O as z}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as Y}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as X,noBudget as J}from"../../support/Scheduler.js";import{ClearBufferBit as K,TextureSamplingMode as Q}from"../../webgl/enums.js";import{Texture as Z}from"../../webgl/Texture.js";import{TextureDescriptor as $}from"../../webgl/TextureDescriptor.js";let ee=class extends C{get _bindParameters(){return this._renderContext.bindParameters}get _rctx(){return this.view._stage.renderView.renderingContext}get rctx(){return this._rctx}get materialRepository(){return this._materialRepository}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}constructor(e){super(e),this._overlays=null,this._overlayRenderTarget=null,this._overlayParameters=new z,this.hasHighlights=!1,this._rendersOccluded=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new a,this._passParameters=new E,this._materialRepository=null,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new A,this.worldToPCSRatio=1,this.events=new r,this.longitudeCyclical=null,this.renderSlots=[V.DRAPED_MATERIAL,V.DRAPED_WATER]}initialize(){const e=this.view._stage.renderer.fboCache,r=this.view._stage.renderView,{waterTextureRepository:t,stippleTextureRepository:s,markerTextureRepository:i}=r;this._shaderTechniqueRepository=new j({rctx:this._rctx,viewingMode:y.Local,stippleTextureRepository:s,markerTextureRepository:i,waterTextureRepository:t}),this._renderContext=new F(this._rctx,new U(e,this.view.state.viewingMode),null),this.addHandles([n((()=>t.updating),(()=>this.events.emit("content-changed")),d),n((()=>this.spatialReference),(e=>this._localOriginFactory=new q(e)),d),h((()=>this.view.allLayerViews),"after-changes",(()=>this._sortedDrapeSourceRenderersDirty=!0))]),this._materialRepository=new M(r.textureRepository,this._shaderTechniqueRepository,(e=>{(e.renderOccluded&ie)>0!==this._rendersOccluded&&this._updateRendersOccluded(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")}),(()=>this.events.emit("content-changed"))),this._bindParameters.slot=V.DRAPED_MATERIAL,this._bindParameters.mainDepth=W(this._rctx),this._camera.near=1,this._camera.far=1e4,this._camera.relativeElevation=null,this._bindParameters.camera=this._camera,this._bindParameters.transparencyPassType=N.NONE,this._bindParameters.newLighting.noonFactor=0,this._bindParameters.newLighting.globalFactor=0,this._bindParameters.newLighting.set([new B(g(1,1,1))]),this.addHandles(this.view.resourceController.scheduler.registerTask(X.STAGE,this))}destroy(){this._renderers.forEach((e=>e.destroy())),this._renderers.clear(),this._debugTextureTechnique=s(this._debugTextureTechnique),this._passParameters.texture=i(this._passParameters.texture),this._bindParameters.mainDepth=i(this._bindParameters.mainDepth),this._shaderTechniqueRepository=o(this._shaderTechniqueRepository),this.disposeOverlays()}produces(e,r){return!(r===P.Highlight&&!this.hasHighlights)&&(e===V.DRAPED_MATERIAL||e===V.DRAPED_WATER)}initializeRenderContext(e){this.pluginContext=e}uninitializeRenderContext(){}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,(e=>e.updating))}get hasOverlays(){return null!=this._overlays&&null!=this._overlayRenderTarget}get usedMemory(){return Array.from(this._renderers.values()).reduce(((e,r)=>e+r.usedMemory),0)}createGeometryDrapeSourceRenderer(e){return this.createDrapeSourceRenderer(e,H)}createDrapeSourceRenderer(e,r,t){const s=this._renderers.get(e);null!=s&&s.destroy();const i=new r({...t,rendererContext:this,drapeSource:e});return this._renderers.set(e,i),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(n((()=>e.fullOpacity),(()=>this.events.emit("content-changed"))),e),i}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._overlayRenderTarget?.computeValidity()??0}releaseRenderTargets(){this._overlayRenderTarget?.dispose()}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){null!=this._overlays&&this._overlays.forEach((r=>r.hasTargetWithoutRasterImage=l(e,(e=>e.drapeTargetType===R.WithoutRasterImage))))}ensureDrapeSources(e){null!=this._overlays&&this._overlays.forEach((r=>{r.hasDrapedFeatureSource=l(e,(e=>e.drapeSourceType===f.Features)),r.hasDrapedRasterSource=l(e,(e=>e.drapeSourceType===f.RasterImage))}))}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._overlayRenderTarget=new D(this.view._stage.renderer.fboCache),this._overlays=[new x(v.INNER,this._overlayRenderTarget),new x(v.OUTER,this._overlayRenderTarget)]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._overlayRenderTarget=i(this._overlayRenderTarget),this.events.emit("textures-disposed")}get running(){return this.updating}runTask(e){this._processDrapeSources(e,(()=>!0))}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges()&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers()),s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this.hasHighlights=t(this._renderers,(e=>e.hasHighlights)),this._updateRendersOccluded(),this._updateHasWater())}processSyncDrapeSources(){this._processDrapeSources(J,(e=>e.updatePolicy===G.SYNC))}get isEmpty(){return!b.OVERLAY_DRAW_DEBUG_TEXTURE&&!t(this._renderers,(e=>!e.isEmpty))}get hasWater(){return this._hasWater}get rendersOccluded(){return this._rendersOccluded}get mode(){return this.isEmpty?O.Disabled:this._overlayRenderTarget?.getTexture(w.Water)?O.EnabledWithWater:this._overlayRenderTarget?.getTexture(w.Color)?O.Enabled:O.Disabled}updateAnimation(e){let r=!1;return this._renderers.forEach((t=>r=t.updateAnimation(e)||r)),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}drawTarget(e,r,t){const s=e.canvasGeometries;if(0===s.numViews)return;const{alignPixelEnabled:i,contentPixelRatio:o}=t;this._screenToWorldRatio=o*e.mapUnitsPerPixel/this._bindParameters.overlayStretch;const a=r.output;if(this.isEmpty||a===P.Highlight&&!this.hasHighlights||a===P.Normal&&!this.hasWater||!e.hasSomeSizedView())return;const n=this._rctx;this._camera.pixelRatio=e.pixelRatio*o,this._renderContext.output=a,this._bindParameters.alignPixelEnabled=i,this._bindParameters.screenToWorldRatio=this._screenToWorldRatio,this._bindParameters.screenToPCSRatio=this._screenToWorldRatio*this.worldToPCSRatio,this._bindParameters.slot=a===P.Normal?V.DRAPED_WATER:V.DRAPED_MATERIAL;const d=b.OVERLAY_DRAW_DEBUG_TEXTURE&&r.type!==w.Occluded;if(!d&&!this._sortedRenderers.some((({renderer:e})=>e.shouldRender(this._renderContext))))return;e.applyViewport(this._rctx);const h=2*e.resolution,l=e.resolution,c=r.fbo;if(c.bind(n,h,l),e.index===v.INNER&&(n.setClearColor(0,0,0,0),n.clearSafe(K.COLOR_BUFFER_BIT)),r.type===w.Occluded&&(this._renderContext.renderOccludedMask=ie),d)for(let u=0;u<s.numViews;u++)this._setViewParameters(s.extents[u],e),this._ensureDebugPatternResources(e.resolution,te[e.index]),this._rctx.bindTechnique(this._debugTextureTechnique,this._passParameters,null),this._rctx.screen.draw();this._sortedRenderers.forAll((({drapeSource:t,renderer:i})=>{if(r.type===w.ColorNoRasterImage&&t.drapeSourceType===f.RasterImage)return;const{fullOpacity:o}=t,d=null!=o&&o<1&&a===P.Color?this.bindTemporaryFramebuffer(h,l):null;for(let r=0;r<s.numViews;r++)this._setViewParameters(s.extents[r],e),i.render(this._renderContext);if(d){c.bind(n,h,l),this._overlayParameters.texture=d.colorTexture,this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e.index;const r=this.pluginContext.techniqueRepository.acquire(Y);this._rctx.bindTechnique(r,this._overlayParameters,this._renderContext.bindParameters),this._rctx.screen.draw(),r.release(),d.release()}})),n.bindFramebuffer(null),c.generateMipMap(),this._renderContext.resetRenderOccludedMask()}bindTemporaryFramebuffer(e,r){const t=this.view._stage.renderer.fboCache,s=t.acquire(S.RGBA,e,r);return t.rctx.bindFramebuffer(s.fbo),t.rctx.clearSafe(K.COLOR_BUFFER_BIT),s}async reloadShaders(){await this._shaderTechniqueRepository.reloadAll()}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){let i=0;for(const o of this._renderers.values())i=o.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this.view.map.allLayers;this._renderers.forEach(((r,t)=>{const s=e.indexOf(t.layer),i=s>=0,o=this._renderers.size*(t.renderGroup??(i?T.MapLayer:T.ViewLayer))+(i?s:0);this._sortedRenderers.push(new re(t,r,o))})),this._sortedRenderers.sort(((e,r)=>e.index-r.index))}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],p(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),m(t.viewMatrix,[-e[0],-e[1],0])}_updateHasWater(){const e=t(this._renderers,(e=>e.hasWater));e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water",e))}_updateRendersOccluded(){const e=t(this._renderers,(e=>e.rendersOccluded));e!==this._rendersOccluded&&(this._rendersOccluded=e,this.events.emit("renders-occluded",e))}_ensureDebugPatternResources(e,r){if(_(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let a=0;a<e;a++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(a/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&a?0:255:1&i^1&o?0:128)}const i=new $(e);i.samplingMode=Q.NEAREST,this._passParameters.texture=new Z(this._rctx,i,t);const o=new k;o.hasAlpha=!0,this._debugTextureTechnique=this._shaderTechniqueRepository.acquire(I,o)}get test(){return{drapedRenderers:Array.from(this._renderers.values()),getDrapeSourceRenderer:e=>this._renderers.get(e)}}};e([c()],ee.prototype,"hasHighlights",void 0),e([c()],ee.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([c({autoDestroy:!0})],ee.prototype,"_shaderTechniqueRepository",void 0),e([c({constructOnly:!0})],ee.prototype,"view",void 0),e([c()],ee.prototype,"worldToPCSRatio",void 0),e([c()],ee.prototype,"spatialReference",void 0),e([c({type:Boolean,readOnly:!0})],ee.prototype,"updating",null),e([c()],ee.prototype,"isEmpty",null),ee=e([u("esri.views.3d.terrain.OverlayRenderer")],ee);class re{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const te=[[1,.5,.5],[.5,.5,1]],se=-2,ie=L.OccludeAndTransparent;export{se as DRAPED_Z,ee as OverlayRenderer,ie as overlayRenderOccludedFlag};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import{disposeMaybe as r}from"../../../core/maybe.js";import i from"../../../core/ObjectPool.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{I as o}from"../../../chunks/mat4f64.js";import{g as a,s as l,d as u}from"../../../chunks/vec3.js";import{Z as c,f as h,c as d}from"../../../chunks/vec3f64.js";import{Z as p}from"../../../chunks/vec4f64.js";import{create as _,set as f}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as m}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as g}from"../../ViewingMode.js";import{TextureUpdate as b}from"./interfaces.js";import{LayerClass as y}from"./LayerClass.js";import{OverlaySource as T}from"./Overlay.js";import{overlayRenderOccludedFlag as R}from"./OverlayRenderer.js";import{clearCaches as x}from"./PatchGeometry.js";import{PatchRenderData as O}from"./PatchRenderData.js";import{RenderOrder as C}from"./RenderOrder.js";import{ENABLE_TERRAIN_INTERNAL_CHECKS as v}from"./terrainUtils.js";import{TileRenderer as D}from"./TileRenderer.js";import{TileUpdate as P}from"./TileUpdate.js";import{IteratorPreorder as S,sortTiles as q,compareTiles as E}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as A,ComponentIntersectionData as w}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as N}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{T as j}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as G}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncPrepareRenderPlugin as I}from"../webgl-engine/effects/RenderPlugin.js";import{Attribute as L}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as F}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as U}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as k}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as B,StoreResults as M}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as z}from"../webgl-engine/lib/Material.js";import{RenderSlot as V}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as H}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as W}from"../webgl-engine/lib/VertexAttribute.js";import{TERRAIN_ID as Y,getVerticalOffsetTerrain as Q}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as X}from"../webgl-engine/materials/DrawParameters.js";import{intersectAabbInvDirBefore as Z,intersectTriangles as K}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as J}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as $}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as ee}from"../../webgl/enums.js";const te=7,re=10,ie=_();var se;!function(e){e[e.Opaque=0]="Opaque",e[e.Semitransparent=1]="Semitransparent",e[e.TransparentWithDraped=2]="TransparentWithDraped",e[e.Empty=3]="Empty"}(se||(se={}));let ne=class extends I{get _isGlobal(){return this._stage.viewingMode===g.Global}get _techniques(){return this._context.techniqueRepository}get _rctx(){return this._context.renderContext.rctx}constructor(e){super(e),this.type=B.TERRAIN,this.isGround=!0,this.renderSlots=[V.OPAQUE_TERRAIN,V.TRANSPARENT_TERRAIN,V.OCCLUDED_TERRAIN],this._tileSize=256,this._techniqueConfiguration=new $,this._passParameters=new j,this._renderDataPool=new i(O),this._patchGroups=new Map,this._patchGroupsDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new S,this._highestVisibleLODTile=null,this._transparencyState=se.Opaque,this._castShadows=!0,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=z.Occlude}initialize(){this._stage.addRenderPlugin(this)}destroy(){this._stage.removeRenderPlugin(this),x()}canRender(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}requires(e){return e===N.Depth&&this._overlayRenderer.hasWater}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}set transparency(e){this._transparencyState!==e&&(this._techniqueConfiguration.invisible=e===se.TransparentWithDraped||e===se.Empty,this._transparencyState=e,this.setNeedsRender())}get transparency(){return this._transparencyState}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._techniqueConfiguration.visualizeNormals}set visualizeNormals(e){this._techniqueConfiguration.visualizeNormals!==e&&(this._techniqueConfiguration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return Y}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._techniqueConfiguration.pbrMode!==e&&(this._techniqueConfiguration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?R:z.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_prepareTileForLoading(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometryState(e),this.updateTileTexture(e,P.TEXTURE_FADING)}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===P.TEXTURE_FADING?b.FADING:b.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const r of e.layerInfo[y.ELEVATION])r.pendingUpdates&=~P.GEOMETRY;e.resetPendingUpdate(P.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.isLoaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=re-te,r=Math.max(0,Math.floor((e.level-t)/te)*te);if(this._isGlobal&&0===r)return c;for(;e.parent&&e.level>r;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=F.UPDATE){this._patchGroupsDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=F.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=F.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new D(this._rctx,this._tileSize,this._techniques,this._cache),this.updateTileBackground(),this._emptyTex=U(this._rctx)}uninitializeRenderContext(){this._emptyTex=r(this._emptyTex),this._tileRenderer=r(this._tileRenderer)}intersect(e,t,r,i){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==se.Opaque)return;const s=oe,n=ae;a(s,i,r),l(n,1/s[0],1/s[1],1/s[2]);const c=e.results.min,h=e.results.max,d=e.results.ground,p=e.options.store===M.MIN,_=!!e.results.ground.target,g=Q(e.verticalOffset),b=e.tolerance;let y,T=p&&null!=c.dist?c.dist:1/0;const R=l=>{const _=l.renderData;if(!_?.vao)return;const R=_.geometry;f(ie,R.boundingBox);const x=_.localOrigin;null!=g&&(g.localOrigin=x,g.applyToAabb(ie));const O=ie;if(le[0]=r[0]-x[0],le[1]=r[1]-x[1],le[2]=r[2]-x[2],!Z(O,le,n,b,T))return;const C=(e,t,r)=>{e.set(this.type,l,t,r,o),T=p&&null!=c.dist?c.dist:1/0},v=(n,o)=>{if(null!=o&&n>=0&&(e.options.backfacesTerrain||u(o,s)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(r,i,n))){if((null==d.dist||n<d.dist)&&C(d,n,o),e.options.isFiltered)return;e.options.store===M.ALL&&(null==y?(y=k(e.ray),C(y,n,o),e.results.all.push(y)):n<y.dist&&C(y,n,o)),(null==c.dist||n<c.dist)&&C(c,n,o),e.options.store!==M.MIN&&(null==h.dist||n>h.dist)&&C(h,n,o)}},D=ue;a(D,i,x);const P=R.indices,S=R.vertexAttributes,q=S.getField(W.POSITION,m),E=new L(q.typedBuffer,3,!1,S.stride/4),N=R.indexCount/3;if(!g&&N>A){const e=l.renderData;null==e.intersectionData&&(e.intersectionData=new w(P,0,N,E)),e.intersectionData.intersectRay({r0:le,r1:D},v)}else K(le,D,0,N,P,E,null,g,v)},x=this._rootTiles;if(null!=x){(()=>{const t=this._tileIterator;t.reset(x);const i=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||i&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(r,s,b,T)||_&&this._useStencilForTile(e)?t.skipSubtree():R(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._patchGroups.values())for(const r of t)null!=r.renderData?.textureReference&&e.queriesForTile(r);e.process(),t.madeProgress()}}prepareTechnique(e){if(e.bindParameters.slot===V.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&R))return null}else{const t=this.transparency===se.Opaque?V.OPAQUE_TERRAIN:V.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}switch(e.output){case N.Color:return this.transparency===se.Empty?null:(this._techniqueConfiguration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._techniqueConfiguration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=null!=e.bindParameters.ssao,this._techniqueConfiguration.overlayMode=this._overlayRenderer.mode,this._updateTechnique(N.Color,e.bindParameters.slot===V.OCCLUDED_TERRAIN));case N.Shadow:case N.ShadowExcludeHighlight:return this._castShadows&&1===e.bindParameters.lighting.globalFactor?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(N.Shadow,!1)):null;case N.Depth:return this.transparency===se.Empty?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(N.Depth,!1));case N.Normal:return this.transparency===se.Empty?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(N.Normal,!1));case N.ObjectAndLayerIdColor:return this.transparency===se.Empty?null:this._updateTechnique(N.ObjectAndLayerIdColor,!1);case N.Highlight:return this.transparency!==se.Empty&&this._overlayRenderer.hasHighlights?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(N.Highlight,!1)):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case N.Color:{const r=e.bindParameters.slot===V.OCCLUDED_TERRAIN?T.Occluded:T.ColorAndWater;this._renderMaterialPass(e,t,r);break}case N.Depth:case N.Normal:this._renderAuxiliaryPass(e,t,T.ColorAndWater);break;case N.Highlight:this._renderAuxiliaryPass(e,t,T.Highlight);break;case N.Shadow:case N.ShadowExcludeHighlight:this._renderAuxiliaryPass(e,t,T.None);break;case N.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,T.ObjectAndLayerIdColor)}}_renderMaterialPass(e,t,r){const{rctx:i}=e;this._passParameters.overlaySource=r,i.bindTechnique(t,this._passParameters,e.bindParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this._renderPatchGroups(e,t,r)}_renderAuxiliaryPass(e,t,r){const i=e.rctx;this._passParameters.overlaySource=r,i.bindTechnique(t,this._passParameters,e.bindParameters),this._renderPatchGroupsAuxiliary(e,t,r)}updateTileBackground(e=null){if(null==this._tileRenderer)return;const r=this._tileRenderer;let i=null;if(null!=e){const r=t.toUnitRGBA(e);i=h(r[0]||0,r[1]||0,r[2]||0)}r.setBackground(i),this._allTiles.forAll((e=>r.updateTileTexture(e,b.FADING))),this._techniqueConfiguration.tileBlendInput=r.backgroundIsGrid?G.GridComposite:null!=r.backgroundColor?G.ColorComposite:G.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchGroupsDirty&&(this._highestVisibleLODTile=null,this._rebuildPatchGroups(),this._patchGroupsDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==C.NONE){const e=Array.from(this._patchGroups.values()),t=this._stencilEnabledLayerExtents;for(const r of e)q(this.renderOrder,r,t);e.sort(((e,t)=>E(e[0],t[0],this.renderOrder))),this._patchGroups=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._patchGroups.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),r=e.renderData;if(!r){this._numTilesCulled++;continue}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}const i=r.localOrigin;let s=this._patchGroups.get(i);s||(s=new Array,this._patchGroups.set(i,s)),s.push(e),(!this._highestVisibleLODTile||e.elevationLevel>this._highestVisibleLODTile.elevationLevel)&&(this._highestVisibleLODTile=e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderPatchGroupsAuxiliary(e,t,r){const i=this._stencilEnabledLayerExtents.length>0;this._patchGroups.forEach((s=>{const n=s[0].renderData.localOrigin;t.program.bindDraw(new X(n),e.bindParameters,this._passParameters);for(let o=0;o<s.length;o++)this._renderPatch(e,t,s[o],ee.TRIANGLES,i,r)})),e.rctx.bindVAO(null)}_renderPatchGroups(e,t,r){const i=e.bindParameters.camera,s=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=H(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:i.fovY})}const n=this._stencilEnabledLayerExtents.length>0,o=r===T.Occluded;o&&(s.bindTexture("tex",this._emptyTex),s.setUniform3fv("textureOpacities",c),s.setUniform4fv("texOffsetAndScale",p));const a=null!=this._tileRenderer&&null!=this._tileRenderer.backgroundColor?this._tileRenderer.backgroundColor:c;this._techniqueConfiguration.tileBlendInput===G.ColorComposite&&s.setUniform3fv("backgroundColor",a);const l=this.wireframe?ee.LINES:ee.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&s.bindTexture("texNext",this._emptyTex);const u=this._patchGroups;for(const c of u.values()){const i=c[0].renderData.localOrigin;t.program.bindDraw(new X(i),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const a of c){const i=a.renderData,u=i.textureReference;if(null!=u){if(!o){s.setUniform4fv("texOffsetAndScale",u.offsetAndScale),s.bindTexture("tex",u.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&null!=t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),i.textureIsFading&&this.setNeedsRender(),s.setUniform3fv("textureOpacities",u.opacities)}this._renderPatch(e,t,a,l,n,r),a.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,r,i,s,n){const o=r.renderData,a=o.vao,l=a.indexBuffer;if(null==l)return void(v&&console.error("Rendered tile with no indices: ",r.lij," : ",o));const u=t.program;n===T.None||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(u,o.overlay),s&&(t.useStencil=this._useStencilForTile(r),t.bindPipelineState(e.rctx,e.bindParameters.slot));const c=o.geometry.indexCount;e.rctx.bindVAO(a),u.assertCompatibleVertexAttributeLocations(a),e.rctx.drawElements(i,c,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,this._techniqueConfiguration.renderOccluded=t,this._shaderTechnique=this._techniques.releaseAndAcquire(J,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this._tileRenderer}}};e([s({constructOnly:!0})],ne.prototype,"_overlayRenderer",void 0),e([s({constructOnly:!0})],ne.prototype,"_stage",void 0),e([s({readOnly:!0})],ne.prototype,"_isGlobal",null),e([s({constructOnly:!0})],ne.prototype,"_allTiles",void 0),e([s({constructOnly:!0})],ne.prototype,"_cache",void 0),e([s({constructOnly:!0})],ne.prototype,"_ellipsoidRadius",void 0),e([s({value:!1})],ne.prototype,"renderingDisabled",null),e([s({value:!0})],ne.prototype,"visible",null),e([s()],ne.prototype,"renderPatchBorders",null),e([s()],ne.prototype,"visualizeNormals",null),e([s()],ne.prototype,"cullBackFaces",null),e([s({value:C.FRONT_TO_BACK})],ne.prototype,"renderOrder",null),e([s()],ne.prototype,"wireframe",null),ne=e([n("esri.views.3d.terrain.TerrainRenderer")],ne);const oe=d(),ae=d(),le=d(),ue=d();export{ne as TerrainRenderer,se as TransparencyMode};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import{disposeMaybe as r}from"../../../core/maybe.js";import i from"../../../core/ObjectPool.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{I as o}from"../../../chunks/mat4f64.js";import{g as a,s as l,d as u}from"../../../chunks/vec3.js";import{Z as c,f as h,c as d}from"../../../chunks/vec3f64.js";import{Z as p}from"../../../chunks/vec4f64.js";import{create as _,set as f}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as m}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as g}from"../../ViewingMode.js";import{TextureUpdate as b}from"./interfaces.js";import{LayerClass as y}from"./LayerClass.js";import{OverlaySource as T}from"./Overlay.js";import{overlayRenderOccludedFlag as R}from"./OverlayRenderer.js";import{clearCaches as x}from"./PatchGeometry.js";import{PatchRenderData as O}from"./PatchRenderData.js";import{RenderOrder as C}from"./RenderOrder.js";import{ENABLE_TERRAIN_INTERNAL_CHECKS as v}from"./terrainUtils.js";import{TileRenderer as D}from"./TileRenderer.js";import{TileUpdate as P}from"./TileUpdate.js";import{IteratorPreorder as S,sortTiles as q,compareTiles as E}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as A,ComponentIntersectionData as w}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as N}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{T as j}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as G}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncPrepareRenderPlugin as I}from"../webgl-engine/effects/RenderPlugin.js";import{Attribute as L}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as F}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as U}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as k}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as B,StoreResults as M}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as z}from"../webgl-engine/lib/Material.js";import{RenderSlot as V}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as H}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as W}from"../webgl-engine/lib/VertexAttribute.js";import{TERRAIN_ID as Y,getVerticalOffsetTerrain as Q}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as X}from"../webgl-engine/materials/DrawParameters.js";import{intersectAabbInvDirBefore as Z,intersectTriangles as K}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as J}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as $}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as ee}from"../../webgl/enums.js";const te=7,re=10,ie=_();var se;!function(e){e[e.Opaque=0]="Opaque",e[e.Semitransparent=1]="Semitransparent",e[e.TransparentWithDraped=2]="TransparentWithDraped",e[e.Empty=3]="Empty"}(se||(se={}));let ne=class extends I{get _isGlobal(){return this._stage.viewingMode===g.Global}get _techniques(){return this._context.techniqueRepository}get _rctx(){return this._context.renderContext.rctx}constructor(e){super(e),this.type=B.TERRAIN,this.isGround=!0,this.renderSlots=[V.OPAQUE_TERRAIN,V.TRANSPARENT_TERRAIN,V.OCCLUDED_TERRAIN],this._tileSize=256,this._techniqueConfiguration=new $,this._passParameters=new j,this._renderDataPool=new i(O),this._patchGroups=new Map,this._patchGroupsDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new S,this._highestVisibleLODTile=null,this._transparencyState=se.Opaque,this._castShadows=!0,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=z.Occlude}initialize(){this._stage.addRenderPlugin(this)}destroy(){this._stage.removeRenderPlugin(this),x()}produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(e){return e===N.Depth&&this._overlayRenderer.hasWater}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}set transparency(e){this._transparencyState!==e&&(this._techniqueConfiguration.invisible=e===se.TransparentWithDraped||e===se.Empty,this._transparencyState=e,this.setNeedsRender())}get transparency(){return this._transparencyState}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._techniqueConfiguration.visualizeNormals}set visualizeNormals(e){this._techniqueConfiguration.visualizeNormals!==e&&(this._techniqueConfiguration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return Y}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._techniqueConfiguration.pbrMode!==e&&(this._techniqueConfiguration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?R:z.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_prepareTileForLoading(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometryState(e),this.updateTileTexture(e,P.TEXTURE_FADING)}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===P.TEXTURE_FADING?b.FADING:b.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const r of e.layerInfo[y.ELEVATION])r.pendingUpdates&=~P.GEOMETRY;e.resetPendingUpdate(P.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.isLoaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=re-te,r=Math.max(0,Math.floor((e.level-t)/te)*te);if(this._isGlobal&&0===r)return c;for(;e.parent&&e.level>r;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=F.UPDATE){this._patchGroupsDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=F.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=F.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new D(this._rctx,this._tileSize,this._techniques,this._cache),this.updateTileBackground(),this._emptyTex=U(this._rctx)}uninitializeRenderContext(){this._emptyTex=r(this._emptyTex),this._tileRenderer=r(this._tileRenderer)}intersect(e,t,r,i){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==se.Opaque)return;const s=oe,n=ae;a(s,i,r),l(n,1/s[0],1/s[1],1/s[2]);const c=e.results.min,h=e.results.max,d=e.results.ground,p=e.options.store===M.MIN,_=!!e.results.ground.target,g=Q(e.verticalOffset),b=e.tolerance;let y,T=p&&null!=c.dist?c.dist:1/0;const R=l=>{const _=l.renderData;if(!_?.vao)return;const R=_.geometry;f(ie,R.boundingBox);const x=_.localOrigin;null!=g&&(g.localOrigin=x,g.applyToAabb(ie));const O=ie;if(le[0]=r[0]-x[0],le[1]=r[1]-x[1],le[2]=r[2]-x[2],!Z(O,le,n,b,T))return;const C=(e,t,r)=>{e.set(this.type,l,t,r,o),T=p&&null!=c.dist?c.dist:1/0},v=(n,o)=>{if(null!=o&&n>=0&&(e.options.backfacesTerrain||u(o,s)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(r,i,n))){if((null==d.dist||n<d.dist)&&C(d,n,o),e.options.isFiltered)return;e.options.store===M.ALL&&(null==y?(y=k(e.ray),C(y,n,o),e.results.all.push(y)):n<y.dist&&C(y,n,o)),(null==c.dist||n<c.dist)&&C(c,n,o),e.options.store!==M.MIN&&(null==h.dist||n>h.dist)&&C(h,n,o)}},D=ue;a(D,i,x);const P=R.indices,S=R.vertexAttributes,q=S.getField(W.POSITION,m),E=new L(q.typedBuffer,3,!1,S.stride/4),N=R.indexCount/3;if(!g&&N>A){const e=l.renderData;null==e.intersectionData&&(e.intersectionData=new w(P,0,N,E)),e.intersectionData.intersectRay({r0:le,r1:D},v)}else K(le,D,0,N,P,E,null,g,v)},x=this._rootTiles;if(null!=x){(()=>{const t=this._tileIterator;t.reset(x);const i=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||i&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(r,s,b,T)||_&&this._useStencilForTile(e)?t.skipSubtree():R(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._patchGroups.values())for(const r of t)null!=r.renderData?.textureReference&&e.queriesForTile(r);e.process(),t.madeProgress()}}prepareTechnique(e){if(e.bindParameters.slot===V.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&R))return null}else{const t=this.transparency===se.Opaque?V.OPAQUE_TERRAIN:V.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}switch(e.output){case N.Color:return this.transparency===se.Empty?null:(this._techniqueConfiguration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._techniqueConfiguration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=null!=e.bindParameters.ssao,this._techniqueConfiguration.overlayMode=this._overlayRenderer.mode,this._updateTechnique(N.Color,e.bindParameters.slot===V.OCCLUDED_TERRAIN));case N.Shadow:case N.ShadowExcludeHighlight:return this._castShadows&&1===e.bindParameters.lighting.globalFactor?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(N.Shadow,!1)):null;case N.Depth:return this.transparency===se.Empty?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(N.Depth,!1));case N.Normal:return this.transparency===se.Empty?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(N.Normal,!1));case N.ObjectAndLayerIdColor:return this.transparency===se.Empty?null:this._updateTechnique(N.ObjectAndLayerIdColor,!1);case N.Highlight:return this.transparency!==se.Empty&&this._overlayRenderer.hasHighlights?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(N.Highlight,!1)):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case N.Color:{const r=e.bindParameters.slot===V.OCCLUDED_TERRAIN?T.Occluded:T.ColorAndWater;this._renderMaterialPass(e,t,r);break}case N.Depth:case N.Normal:this._renderAuxiliaryPass(e,t,T.ColorAndWater);break;case N.Highlight:this._renderAuxiliaryPass(e,t,T.Highlight);break;case N.Shadow:case N.ShadowExcludeHighlight:this._renderAuxiliaryPass(e,t,T.None);break;case N.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,T.ObjectAndLayerIdColor)}}_renderMaterialPass(e,t,r){const{rctx:i}=e;this._passParameters.overlaySource=r,i.bindTechnique(t,this._passParameters,e.bindParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this._renderPatchGroups(e,t,r)}_renderAuxiliaryPass(e,t,r){const i=e.rctx;this._passParameters.overlaySource=r,i.bindTechnique(t,this._passParameters,e.bindParameters),this._renderPatchGroupsAuxiliary(e,t,r)}updateTileBackground(e=null){if(null==this._tileRenderer)return;const r=this._tileRenderer;let i=null;if(null!=e){const r=t.toUnitRGBA(e);i=h(r[0]||0,r[1]||0,r[2]||0)}r.setBackground(i),this._allTiles.forAll((e=>r.updateTileTexture(e,b.FADING))),this._techniqueConfiguration.tileBlendInput=r.backgroundIsGrid?G.GridComposite:null!=r.backgroundColor?G.ColorComposite:G.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchGroupsDirty&&(this._highestVisibleLODTile=null,this._rebuildPatchGroups(),this._patchGroupsDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==C.NONE){const e=Array.from(this._patchGroups.values()),t=this._stencilEnabledLayerExtents;for(const r of e)q(this.renderOrder,r,t);e.sort(((e,t)=>E(e[0],t[0],this.renderOrder))),this._patchGroups=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._patchGroups.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),r=e.renderData;if(!r){this._numTilesCulled++;continue}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}const i=r.localOrigin;let s=this._patchGroups.get(i);s||(s=new Array,this._patchGroups.set(i,s)),s.push(e),(!this._highestVisibleLODTile||e.elevationLevel>this._highestVisibleLODTile.elevationLevel)&&(this._highestVisibleLODTile=e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderPatchGroupsAuxiliary(e,t,r){const i=this._stencilEnabledLayerExtents.length>0;this._patchGroups.forEach((s=>{const n=s[0].renderData.localOrigin;t.program.bindDraw(new X(n),e.bindParameters,this._passParameters);for(let o=0;o<s.length;o++)this._renderPatch(e,t,s[o],ee.TRIANGLES,i,r)})),e.rctx.bindVAO(null)}_renderPatchGroups(e,t,r){const i=e.bindParameters.camera,s=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=H(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:i.fovY})}const n=this._stencilEnabledLayerExtents.length>0,o=r===T.Occluded;o&&(s.bindTexture("tex",this._emptyTex),s.setUniform3fv("textureOpacities",c),s.setUniform4fv("texOffsetAndScale",p));const a=null!=this._tileRenderer&&null!=this._tileRenderer.backgroundColor?this._tileRenderer.backgroundColor:c;this._techniqueConfiguration.tileBlendInput===G.ColorComposite&&s.setUniform3fv("backgroundColor",a);const l=this.wireframe?ee.LINES:ee.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&s.bindTexture("texNext",this._emptyTex);const u=this._patchGroups;for(const c of u.values()){const i=c[0].renderData.localOrigin;t.program.bindDraw(new X(i),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const a of c){const i=a.renderData,u=i.textureReference;if(null!=u){if(!o){s.setUniform4fv("texOffsetAndScale",u.offsetAndScale),s.bindTexture("tex",u.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&null!=t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),i.textureIsFading&&this.setNeedsRender(),s.setUniform3fv("textureOpacities",u.opacities)}this._renderPatch(e,t,a,l,n,r),a.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,r,i,s,n){const o=r.renderData,a=o.vao,l=a.indexBuffer;if(null==l)return void(v&&console.error("Rendered tile with no indices: ",r.lij," : ",o));const u=t.program;n===T.None||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(u,o.overlay),s&&(t.useStencil=this._useStencilForTile(r),t.bindPipelineState(e.rctx,e.bindParameters.slot));const c=o.geometry.indexCount;e.rctx.bindVAO(a),u.assertCompatibleVertexAttributeLocations(a),e.rctx.drawElements(i,c,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,this._techniqueConfiguration.renderOccluded=t,this._shaderTechnique=this._techniques.releaseAndAcquire(J,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this._tileRenderer}}};e([s({constructOnly:!0})],ne.prototype,"_overlayRenderer",void 0),e([s({constructOnly:!0})],ne.prototype,"_stage",void 0),e([s({readOnly:!0})],ne.prototype,"_isGlobal",null),e([s({constructOnly:!0})],ne.prototype,"_allTiles",void 0),e([s({constructOnly:!0})],ne.prototype,"_cache",void 0),e([s({constructOnly:!0})],ne.prototype,"_ellipsoidRadius",void 0),e([s({value:!1})],ne.prototype,"renderingDisabled",null),e([s({value:!0})],ne.prototype,"visible",null),e([s()],ne.prototype,"renderPatchBorders",null),e([s()],ne.prototype,"visualizeNormals",null),e([s()],ne.prototype,"cullBackFaces",null),e([s({value:C.FRONT_TO_BACK})],ne.prototype,"renderOrder",null),e([s()],ne.prototype,"wireframe",null),ne=e([n("esri.views.3d.terrain.TerrainRenderer")],ne);const oe=d(),ae=d(),le=d(),ue=d();export{ne as TerrainRenderer,se as TransparencyMode};
|