@arcgis/core 4.25.0-next.20220912 → 4.25.0-next.20220913
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{10f314bda1d8e9703810.js → 574483b0dec14cb84d21.js} +1 -1
- package/chunks/Clouds.glsl.js +24 -18
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/3d/analysis/Dimensioning/DimensioningTool.js +1 -1
- package/views/3d/analysis/Dimensioning/LengthDimensionSubTool.js +1 -1
- package/views/3d/environment/Clouds.glsl.js +1 -1
- package/views/3d/environment/CloudsComposition.js +1 -1
- package/views/3d/environment/CloudsCompositionParameters.js +1 -1
- package/views/3d/environment/CloudsGenerator.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
- package/views/3d/environment/weatherUtils.js +5 -0
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsLayerView3D.js +1 -1
- package/views/3d/layers/graphics/elevationAlignPointsInFeatures.js +5 -0
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +10 -10
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lighting/SceneLighting.js +1 -1
- package/views/3d/webgl-engine/materials/WaterGLMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/interactive/snapping/featureSources/FeatureCollectionSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
- package/widgets/AreaMeasurement2D.js +1 -1
- package/widgets/AreaMeasurement3D.js +1 -1
- package/widgets/DirectLineMeasurement3D.js +1 -1
- package/widgets/DistanceMeasurement2D.js +1 -1
- package/widgets/Measurement.js +1 -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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{destroyHandle as t}from"../../../../core/handleUtils.js";import{isSome as i,isNone as o}from"../../../../core/maybe.js";import{watch as s,syncAndInitial as n,when as r}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{sv3d as c}from"../../../../geometry/support/vectorStacks.js";import{LengthDimensionSubTool as p}from"./LengthDimensionSubTool.js";import{newIntersector as u}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{destroyHandle as t}from"../../../../core/handleUtils.js";import{isSome as i,isNone as o}from"../../../../core/maybe.js";import{watch as s,syncAndInitial as n,when as r}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{sv3d as c}from"../../../../geometry/support/vectorStacks.js";import{LengthDimensionSubTool as p}from"./LengthDimensionSubTool.js";import{newIntersector as u}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as d}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{AnalysisToolBase as h}from"../../../interactive/AnalysisToolBase.js";import{SKETCH_KEYS as m}from"../../../interactive/keybindings.js";import{createScreenPointArrayFromEvent as v}from"../../../support/screenUtils.js";var y;!function(e){e.Ready="ready",e.Creating="creating",e.Created="created"}(y||(y={}));let _=class extends h{constructor(e){super(e),this.automaticManipulatorSelection=!1}initialize(){this._intersector=u(this.view.state.viewingMode),this._intersector.options.store=d.MIN,this._lengthDimensionSubTool=new p({analysis:this.analysis,analysisViewData:this.analysisViewData,manipulators:this.manipulators,view:this.view}),this.addHandles(t(this._lengthDimensionSubTool)),this.addHandles([s((()=>this.state),(e=>{e===y.Created&&this.finishToolCreation()}),n),r((()=>this.firstGrabbedManipulator),(e=>{this.selectedDimension=e.metadata}),n)])}get state(){return this.analysis.dimensions.some((e=>"length"===e.type))?i(this._activeSubTool)?y.Creating:y.Created:y.Ready}get updating(){return this._lengthDimensionSubTool.updating}get cursor(){return this.active?"crosshair":null}get selectedDimension(){return this.analysisViewData.selectedDimension}set selectedDimension(e){this.analysisViewData.selectedDimension=e}onInputEvent(e){switch(e.type){case"immediate-click":this._clickHandler(e);break;case"immediate-double-click":this._doubleClickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e);break;case"key-down":m.cancel===e.key?this.selectedDimension=null:m.delete.includes(e.key)&&this._deleteKeyHandler()}}onActivate(){this._activeSubTool=this._lengthDimensionSubTool}onDeactivate(){i(this._activeSubTool)&&(this._activeSubTool.onDeactivate(),this._activeSubTool=null)}onManipulatorSelectionChanged(){this._lengthDimensionSubTool.onManipulatorSelectionChanged()}onHide(){this.selectedDimension=null}_clickHandler(e){if(o(this._activeSubTool))return;if(this.hasFocusedManipulators)return;const t=this._intersectScreen(e);o(t)||(this.selectedDimension=this._activeSubTool.onClick({mapPoint:t,pointerType:e.pointerType}),e.stopPropagation())}_doubleClickHandler(e){this.active&&(this.view.activeTool=null,e.stopPropagation())}_pointerMoveHandler(e){if(o(this._activeSubTool))return;if(this.hasFocusedManipulators)return;const t=this._intersectScreen(e);o(t)||this._activeSubTool.onPointerMove({mapPoint:t,pointerType:e.pointerType})}_deleteKeyHandler(){i(this._activeSubTool)&&this._activeSubTool.removeStaged(),this._removeSelected()}_intersectScreen(e){const t=v(e);this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector);const i=this._intersector.results.min,o=c.get();return i.getIntersectionPoint(o)?this.view.renderCoordsHelper.fromRenderCoords(o,this.view.spatialReference):null}_removeSelected(){i(this.selectedDimension)&&(this.analysis.dimensions.remove(this.selectedDimension),this.selectedDimension=null)}get testInfo(){return this._lengthDimensionSubTool.testInfo}};e([a({constructOnly:!0})],_.prototype,"view",void 0),e([a({constructOnly:!0})],_.prototype,"analysis",void 0),e([a({readOnly:!0})],_.prototype,"state",null),e([a({readOnly:!0})],_.prototype,"updating",null),e([a({readOnly:!0})],_.prototype,"cursor",null),e([a({constructOnly:!0})],_.prototype,"analysisViewData",void 0),e([a()],_.prototype,"selectedDimension",null),e([a()],_.prototype,"automaticManipulatorSelection",void 0),e([a()],_.prototype,"_activeSubTool",void 0),e([a()],_.prototype,"_lengthDimensionSubTool",void 0),_=e([l("esri.views.3d.analysis.Dimensioning.DimensioningTool")],_);export{_ as DimensioningTool};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import"../../../../geometry.js";import{LengthDimensionAxis as i,LengthDimensionOffsetDirection as n}from"../../../../analysis/dimensionUtils.js";import s from"../../../../analysis/LengthDimension.js";import"../../../../core/has.js";import{HandleOwner as a}from"../../../../core/HandleOwner.js";import o from"../../../../core/Handles.js";import{equals as r}from"../../../../core/lang.js";import{rad2deg as p}from"../../../../core/mathUtils.js";import{isSome as l,applySome as d,isNone as c,destroyMaybe as m,unwrapOr as u}from"../../../../core/maybe.js";import{ignoreAbortErrors as f}from"../../../../core/promiseUtils.js";import{watch as h,sync as g,syncAndInitial as _}from"../../../../core/reactiveUtils.js";import{pt2px as y}from"../../../../core/screenUtils.js";import{property as M}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as v}from"../../../../core/accessorSupport/decorators/subclass.js";import{l as S}from"../../../../chunks/mat4.js";import{c as w}from"../../../../chunks/mat4f64.js";import{g as x,b as j,f as D,c as C,e as P,l as O,s as H,p as b}from"../../../../chunks/vec3.js";import{c as R,Z as V,f as T}from"../../../../chunks/vec3f64.js";import{fromPositionAndNormal as A,create as k,signedDistance as U,normal as z}from"../../../../geometry/support/plane.js";import{sv3d as F}from"../../../../geometry/support/vectorStacks.js";import{clonePoint as G}from"../../../../layers/graphics/hydratedFeatures.js";import{directUp as E,headingFromGeometry as L,directStartToEnd as W,dimensionStartToEnd as I}from"./lengthDimensionUtils.js";import{settings as B}from"./settings.js";import{getRotateHeadingTexture as q}from"../Slice/images/Factory.js";import{Manipulator3D as N}from"../../interactive/Manipulator3D.js";import{createSphereManipulator as Z,createRotateManipulator as J,calculateInputRotationTransform as K,calculateTranslateRotateFromBases as Q}from"../../interactive/manipulatorUtils.js";import{SnappingVisualizer3D as X}from"../../interactive/SnappingVisualizer3D.js";import{screenToMap3D as Y,screenToRenderPlane as $,hideManipulatorWhileDragging as tt}from"../../interactive/editingTools/dragEventPipeline3D.js";import et from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as it}from"../../webgl-engine/lib/Material.js";import{RibbonLineMaterial as nt}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createCoordinateHelper as st}from"../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as at,resetProperties as ot}from"../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as rt}from"../../../interactive/interfaces.js";import{EditGeometry as pt}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as lt}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{acquire as dt}from"../../../interactive/snapping/SceneSnappingManagerPool.js";import{SnappingContext as ct}from"../../../interactive/snapping/SnappingContext.js";import{SnappingPipeline as mt}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as ut}from"../../../interactive/snapping/SnappingOperation.js";import ft from"../../../../geometry/Point.js";let ht=class extends a{constructor(t){super(t),this.stagedDimension=null,this._computationManipulators=new Map,this._computationHandles=new o,this._snappingPipeline=new mt,this._internalAxisChange=!1,this._snappingManagerResult=dt(t.view),this.addHandles(this._snappingManagerResult),this._unfocusedOffsetManipulatorMaterial=Dt(),this._focusedOffsetManipulatorMaterial=Dt(),this._updateManipulatorStyle(t.analysis.lineWidth)}initialize(){this._snappingOperation=new ut({view:this.view}),this._rotateManipulatorTexture=q(this.view.toolViewManager.textures);const{computations:t}=this.analysisViewData;for(const e of t)this._addComputation(e);this.addHandles([t.on("after-add",(t=>this._addComputation(t.item))),t.on("after-remove",(t=>this._removeComputation(t.item)))]),this.addHandles([h((()=>this._snappingOperation.stagedPoint),(t=>{l(this.stagedDimension)&&(this.stagedDimension.endPoint=d(t,(t=>G(t,new ft))))}),g),h((()=>this.stagedDimension),(()=>{for(const[t,e]of this._computationManipulators)this._updateManipulators(t.geometry,t.dimension,e)}),_),h((()=>this.analysisViewData.selectedComputation),((t,e)=>{for(const i of[t,e])if(l(i)){const t=this._computationManipulators.get(i);this._updateManipulators(i.geometry,i.dimension,t)}}),_),h((()=>this.analysis.lineWidth),(t=>{this._updateManipulatorStyle(t)})),h((()=>{const{selectedComputation:t}=this.analysisViewData;if(c(t))return null;const{axis:e,offsetDirection:i}=t.dimension;return{axis:e,offsetDirection:i,selectedComputation:t}}),((t,e)=>{if(!c(t)&&!c(e)&&t.selectedComputation===e.selectedComputation&&!this._internalAxisChange){const{axis:e,offsetDirection:i,selectedComputation:n}=t;n.userSetAxis=e,n.userSetOffsetDirection=i}}),g),h((()=>{const{stagedDimension:t}=this,e=this.analysisViewData.computations.at(-1);if(c(t)||c(e)||e.dimension!==t)return null;const{startPoint:i,endPoint:n}=t,{geometry:s}=e;return{startPoint:i,endPoint:n,computation:e,geometry:s}}),(t=>{if(c(t))return;const{computation:e}=t;this._applyConstraint(e),this._updateHeadingFromCamera(e)}),g)])}destroy(){this._snappingOperation=m(this._snappingOperation),this._computationHandles.destroy()}get updating(){return this.updatingHandles.updating||this._snappingManager.updating}get _snappingManager(){return this._snappingManagerResult.snappingManager}onDeactivate(){this._snappingManager.doneSnapping()}onUnstagedClick({mapPoint:t,pointerType:e}){const i=this._snappingContext(e),n=G(this._snappingManager.update(t,i),new ft),a=new s({startPoint:n,endPoint:null});return this.stagedDimension=a,this._snappingManager.doneSnapping(),a}onStagedClick({mapPoint:t,pointerType:e}){if(c(this.stagedDimension))return;const i=this._snappingContext(e),n=G(this._snappingManager.update(t,i),new ft);this.stagedDimension.endPoint=n,this.stagedDimension=null,this._snappingManager.doneSnapping()}onPointerMove({mapPoint:t,pointerType:e}){const i=this._snappingContext(e);this.updatingHandles.addPromise(f(this._snappingOperation.snap(t,this._snappingManager,i)))}onManipulatorSelectionChanged(){if(l(this.analysisViewData.selectedComputation)){this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null)}}_addComputation(t){if(this._computationManipulators.has(t))return;const e=this._createPointManipulator(t,{isStart:!0}),i=this._createPointManipulator(t,{isStart:!1}),n=this._createOffsetManipulator(t),s=this._createHeadingManipulator(t),a=new gt({start:e,end:i,offset:n,heading:s});this._setupComputationToManipulatorsSync(t,a),this._computationManipulators.set(t,a),this.manipulators.addMany(Array.from(a.values()))}_removeComputation(t){const e=this._computationManipulators.get(t);if(!c(e)){this._computationHandles.remove(t),this._computationManipulators.delete(t);for(const t of e.values())this.manipulators.remove(t)}}_setupComputationToManipulatorsSync(t,e){const{dimension:i}=t;this._computationHandles.add([h((()=>t.geometry),(t=>{this._updateManipulators(t,i,e)}),{..._,equals:r})],t)}_createPointManipulator(t,i){const{dimension:n}=t,{isStart:s}=i,a=s?"startPoint":"endPoint",o=Z(this.view,e.toUnitRGB(B.pointManipulators.color),B.pointManipulators.opacity);o.available=!1,o.radius=B.pointManipulators.radius,o.metadata=t.dimension,o.collisionPriority=1;const r=at(o,((e,i,s,o)=>{const r=tt(e);i.next(r).next(Y(this.view)).next(this._snappingPipeline.createSnapDragEventPipelineStep({snappingContext:this._snappingContext(o),snappingManager:this._snappingManager,cancel:s,updatingHandles:this.updatingHandles}),this._snappingPipeline.next).next((e=>{const i=G(e.mapEnd,new ft);n[a]=i,this._applyConstraint(t),this._updateHeadingFromCamera(t)})),s.next(r).next(ot(n,[a]))}));return this._computationHandles.add(r,t),o}_createOffsetManipulator(t){const e=[T(-.5,0,0),T(.5,0,0)],{lengthFraction:i}=B.offsetManipulator,n=et.createPolylineGeometry(e.map((t=>x(R(),t,i)))),s=new N({view:this.view,renderObjects:[{geometry:n,material:this._unfocusedOffsetManipulatorMaterial,stateMask:rt.Unfocused|rt.Selected},{geometry:n,material:this._focusedOffsetManipulatorMaterial,stateMask:rt.Focused|rt.Selected}],collisionType:{type:"line",paths:[e]},radius:this._focusedOffsetWidth(this.analysis.lineWidth)/2,focusMultiplier:1,available:!1,autoScaleRenderObjects:!1,worldSized:!0,metadata:t.dimension}),a=at(s,((e,i,n)=>{if(c(t.geometry))return;const{dimensionSegment:s,primaryOffsetAxis:a}=t.geometry,o=j(F.get(),s.endRenderSpace,s.startRenderSpace);D(o,o,a);const r=A(s.startRenderSpace,o,k()),p=A(s.startRenderSpace,a,k()),{dimension:l}=t,d=l.offset;let m=0;const u=tt(e);i.next(u).next($(this.view,r)).next((t=>{"start"===t.action&&(m=U(p,t.renderStart));const e=(U(p,t.renderEnd)-m)*this.view.renderCoordsHelper.unitInMeters;l.offset=d+e})),n.next(u).next(ot(l,["offset"]))}));return this._computationHandles.add(a,t),s}_createHeadingManipulator(t){const e=J(this.view,this._rotateManipulatorTexture.texture);e.metadata=t.dimension;const i=at(e,((e,i,n)=>{const{dimension:s,geometry:a}=t,{renderCoordsHelper:o}=this.view;if(c(a))return;const r=E(F.get(),a,o),l=R(),d=St(R(),a,a.directSegment,o),m=A(d,r,k()),f=u(s.heading,(()=>L(a,o)));i.next($(this.view,m)).next((t=>{"start"===t.action&&C(l,t.renderStart);const e=z(m),i=K(l,t.renderEnd,d,e);s.heading=f-p(i)})),n.next(ot(s,["heading"]))}));return this._computationHandles.add(i,t),e}_updateManipulators(t,e,s){const{start:a,end:o,offset:r,heading:p}=s,d=l(t),m=this.analysisViewData.selectedDimension===e,u=d&&c(this.stagedDimension);for(const l of s.values())l===r?(l.available=u,l.selected=m):l.available=l===p?u&&m&&e.axis===i.Vertical&&e.offsetDirection===n.Side:u&&m;u&&(a.renderLocation=t.directSegment.startRenderSpace,o.renderLocation=t.directSegment.endRenderSpace,_t(r,t),p.available&&yt(p,t,e,this.view.renderCoordsHelper))}_updateManipulatorStyle(t){const e=this._unfocusedOffsetWidth(t),i=this._focusedOffsetWidth(t);for(const{offset:n}of this._computationManipulators.values())n.radius=i/2;this._unfocusedOffsetManipulatorMaterial.setParameters({width:e}),this._focusedOffsetManipulatorMaterial.setParameters({width:i})}_snappingContext(t){return new ct({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new lt(new pt("point",st(!0,!1,this.view.spatialReference))),visualizer:new X})}_unfocusedOffsetWidth(t){return y(t)+B.offsetManipulator.linePaddingPx}_focusedOffsetWidth(t){return y(t)+B.offsetManipulator.focusedLinePaddingPx}_applyConstraint(t){const{dimension:e,geometry:s}=t;if(c(s))return;const a=Pt(s,this.view);if(this._internalAxisChange=!0,c(a))e.axis=t.userSetAxis,e.offsetDirection=t.userSetOffsetDirection;else switch(a){case Ct.Horizontal:e.axis=i.Horizontal;break;case Ct.Vertical:e.axis=i.Vertical,e.offsetDirection=n.Side}this._internalAxisChange=!1}_updateHeadingFromCamera(t){const{dimension:e,geometry:i}=t;if(c(i))return;if(Pt(i,this.view)===Ct.Vertical)return;const{directSegment:n}=i,{renderCoordsHelper:s}=this.view,a=E(F.get(),i,s),o=W(F.get(),i),r=D(F.get(),o,a),{viewForward:p}=this.view.state.camera;P(r,p)>0&&x(r,r,-1);const l=n.eval(.5,F.get());e.heading=s.headingAtPosition(l,r)}get testInfo(){return{getManipulatorsForDimension:t=>{for(const[e,i]of this._computationManipulators.entries())if(t===e.dimension)return i;return null},getComputationForDimension:t=>{for(const e of this._computationManipulators.keys())if(t===e.dimension)return e;return null},stagedDimension:this.stagedDimension}}};t([M({constructOnly:!0})],ht.prototype,"analysis",void 0),t([M({constructOnly:!0})],ht.prototype,"analysisViewData",void 0),t([M({constructOnly:!0})],ht.prototype,"manipulators",void 0),t([M({constructOnly:!0,nonNullable:!0})],ht.prototype,"view",void 0),t([M({readOnly:!0})],ht.prototype,"updating",null),t([M()],ht.prototype,"stagedDimension",void 0),ht=t([v("esri.views.3d.analysis.Dimensioning.LengthDimensionSubTool")],ht);class gt{constructor(t){this.start=t.start,this.end=t.end,this.offset=t.offset,this.heading=t.heading}*values(){yield this.start,yield this.end,yield this.offset,yield this.heading}}function _t(t,e){const{dimensionSegment:i,primaryOffsetAxis:n}=e,s=I(Ot,e),a=Q(s,n,V,Ht),o=O(s);S(a,a,H(Ot,o,o,o)),t.modelTransform=a,t.renderLocation=i.eval(.5,Ot)}function yt(t,e,i,n){const{primaryOffsetAxis:s}=e;x(Mt,s,i.offset>=0?1:-1),I(vt,e),D(vt,vt,Mt);const a=Q(Mt,vt,V,Ht);t.modelTransform=a,t.renderLocation=St(Ot,e,e.dimensionSegment,n)}const Mt=R(),vt=R();function St(t,e,i,n){const{startRenderSpace:s,endRenderSpace:a}=i,o=wt(e,n)?s:a;return C(t,o)}function wt(t,e){const i=W(xt,t),n=E(jt,t,e);return P(i,n)>0}const xt=R(),jt=R();function Dt(){const{color:t,opacity:i}=B.offsetManipulator;return new nt({color:[...e.toUnitRGB(t),i],width:1,renderOccluded:it.OccludeAndTransparent,writeDepth:!1,hasPolygonOffset:!0})}var Ct;function Pt(t,e){const{directSegment:i}=t,{constraintThresholdPx:n}=B,{camera:s}=e.state,a=E(F.get(),t,e.renderCoordsHelper),o=W(F.get(),t),r=x(F.get(),a,P(o,a)),p=j(F.get(),o,r),l=b(p),d=b(r),{startRenderSpace:c,endRenderSpace:m}=i,u=Math.max(s.computeRenderPixelSizeAt(c)*n,s.computeRenderPixelSizeAt(m)*n)**2;return l<u?Ct.Vertical:d<u?Ct.Horizontal:null}!function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(Ct||(Ct={}));const Ot=R(),Ht=w();export{gt as LengthDimensionManipulators,ht as LengthDimensionSubTool};
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import"../../../../geometry.js";import{LengthDimensionAxis as i,LengthDimensionOffsetDirection as n}from"../../../../analysis/dimensionUtils.js";import s from"../../../../analysis/LengthDimension.js";import"../../../../core/has.js";import{HandleOwner as a}from"../../../../core/HandleOwner.js";import o from"../../../../core/Handles.js";import{equals as r}from"../../../../core/lang.js";import{rad2deg as p}from"../../../../core/mathUtils.js";import{isSome as d,applySome as l,isNone as c,destroyMaybe as m,unwrapOr as u}from"../../../../core/maybe.js";import{ignoreAbortErrors as f}from"../../../../core/promiseUtils.js";import{watch as h,sync as g,syncAndInitial as _}from"../../../../core/reactiveUtils.js";import{pt2px as y}from"../../../../core/screenUtils.js";import{property as M}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as v}from"../../../../core/accessorSupport/decorators/subclass.js";import{l as S}from"../../../../chunks/mat4.js";import{c as w}from"../../../../chunks/mat4f64.js";import{g as x,b as D,f as j,c as C,e as P,l as O,s as H,p as b}from"../../../../chunks/vec3.js";import{c as R,Z as V,f as k}from"../../../../chunks/vec3f64.js";import{fromPositionAndNormal as T,create as A,signedDistance as U,normal as z}from"../../../../geometry/support/plane.js";import{sv3d as F}from"../../../../geometry/support/vectorStacks.js";import{clonePoint as G}from"../../../../layers/graphics/hydratedFeatures.js";import{directUp as E,headingFromGeometry as L,directStartToEnd as W,dimensionStartToEnd as I}from"./lengthDimensionUtils.js";import{settings as B}from"./settings.js";import{getRotateHeadingTexture as q}from"../Slice/images/Factory.js";import{Manipulator3D as N}from"../../interactive/Manipulator3D.js";import{createSphereManipulator as Z,createRotateManipulator as J,calculateInputRotationTransform as K,calculateTranslateRotateFromBases as Q}from"../../interactive/manipulatorUtils.js";import{SnappingVisualizer3D as X}from"../../interactive/SnappingVisualizer3D.js";import{screenToMap3D as Y,screenToRenderPlane as $,hideManipulatorWhileDragging as tt}from"../../interactive/editingTools/dragEventPipeline3D.js";import et from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as it}from"../../webgl-engine/lib/Material.js";import{RibbonLineMaterial as nt}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createCoordinateHelper as st}from"../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as at,resetProperties as ot}from"../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as rt}from"../../../interactive/interfaces.js";import{EditGeometry as pt}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as dt}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{acquire as lt}from"../../../interactive/snapping/SceneSnappingManagerPool.js";import{SnappingContext as ct}from"../../../interactive/snapping/SnappingContext.js";import{SnappingPipeline as mt}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as ut}from"../../../interactive/snapping/SnappingOperation.js";import ft from"../../../../geometry/Point.js";let ht=class extends a{constructor(t){super(t),this._stagedDimension=null,this._computationManipulators=new Map,this._computationHandles=new o,this._snappingPipeline=new mt,this._internalAxisChange=!1,this._snappingManagerResult=lt(t.view),this.addHandles(this._snappingManagerResult),this._unfocusedOffsetManipulatorMaterial=jt(),this._focusedOffsetManipulatorMaterial=jt(),this._updateManipulatorStyle(t.analysis.lineWidth)}initialize(){this._snappingOperation=new ut({view:this.view}),this._rotateManipulatorTexture=q(this.view.toolViewManager.textures);const{computations:t}=this.analysisViewData;for(const e of t)this._addComputation(e);this.addHandles([t.on("after-add",(t=>this._addComputation(t.item))),t.on("after-remove",(t=>this._removeComputation(t.item)))]),this.addHandles([h((()=>this._snappingOperation.stagedPoint),(t=>{d(this._stagedDimension)&&(this._stagedDimension.endPoint=l(t,(t=>G(t,new ft))))}),g),h((()=>this._stagedDimension),(()=>{for(const[t,e]of this._computationManipulators)this._updateManipulators(t.geometry,t.dimension,e)}),_),h((()=>this.analysisViewData.selectedComputation),((t,e)=>{for(const i of[t,e])if(d(i)){const t=this._computationManipulators.get(i);this._updateManipulators(i.geometry,i.dimension,t)}}),_),h((()=>this.analysis.lineWidth),(t=>{this._updateManipulatorStyle(t)})),h((()=>{const{selectedComputation:t}=this.analysisViewData;if(c(t))return null;const{axis:e,offsetDirection:i}=t.dimension;return{axis:e,offsetDirection:i,selectedComputation:t}}),((t,e)=>{if(!c(t)&&!c(e)&&t.selectedComputation===e.selectedComputation&&!this._internalAxisChange){const{axis:e,offsetDirection:i,selectedComputation:n}=t;n.userSetAxis=e,n.userSetOffsetDirection=i}}),g),h((()=>{const{_stagedDimension:t}=this,e=this.analysisViewData.computations.at(-1);if(c(t)||c(e)||e.dimension!==t)return null;const{startPoint:i,endPoint:n}=t,{geometry:s}=e;return{startPoint:i,endPoint:n,computation:e,geometry:s}}),(t=>{if(c(t))return;const{computation:e}=t;this._applyConstraint(e),this._updateHeadingFromCamera(e)}),g)])}destroy(){this._snappingOperation=m(this._snappingOperation),this._computationHandles.destroy()}get updating(){return this.updatingHandles.updating||this._snappingManager.updating}get _snappingManager(){return this._snappingManagerResult.snappingManager}removeStaged(){d(this._stagedDimension)&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null)}onDeactivate(){this.removeStaged(),this._snappingManager.doneSnapping()}onClick(t){const{_stagedDimension:e}=this;if(c(e)){const e=this._onUnstagedClick(t);return this.analysis.dimensions.add(e),null}return this._onStagedClick(t),e}onPointerMove({mapPoint:t,pointerType:e}){const i=this._snappingContext(e);this.updatingHandles.addPromise(f(this._snappingOperation.snap(t,this._snappingManager,i)))}onManipulatorSelectionChanged(){if(d(this.analysisViewData.selectedComputation)){this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null)}}_onUnstagedClick({mapPoint:t,pointerType:e}){const i=this._snappingContext(e),n=G(this._snappingManager.update(t,i),new ft),a=new s({startPoint:n,endPoint:null});return this._stagedDimension=a,this._snappingManager.doneSnapping(),a}_onStagedClick({mapPoint:t,pointerType:e}){if(c(this._stagedDimension))return;const i=this._snappingContext(e),n=G(this._snappingManager.update(t,i),new ft);this._stagedDimension.endPoint=n,this._stagedDimension=null,this._snappingManager.doneSnapping()}_addComputation(t){if(this._computationManipulators.has(t))return;const e=this._createPointManipulator(t,{isStart:!0}),i=this._createPointManipulator(t,{isStart:!1}),n=this._createOffsetManipulator(t),s=this._createHeadingManipulator(t),a=new gt({start:e,end:i,offset:n,heading:s});this._setupComputationToManipulatorsSync(t,a),this._computationManipulators.set(t,a),this.manipulators.addMany(Array.from(a.values()))}_removeComputation(t){const e=this._computationManipulators.get(t);if(!c(e)){this._computationHandles.remove(t),this._computationManipulators.delete(t);for(const t of e.values())this.manipulators.remove(t)}}_setupComputationToManipulatorsSync(t,e){const{dimension:i}=t;this._computationHandles.add([h((()=>t.geometry),(t=>{this._updateManipulators(t,i,e)}),{..._,equals:r})],t)}_createPointManipulator(t,i){const{dimension:n}=t,{isStart:s}=i,a=s?"startPoint":"endPoint",o=Z(this.view,e.toUnitRGB(B.pointManipulators.color),B.pointManipulators.opacity);o.available=!1,o.radius=B.pointManipulators.radius,o.metadata=t.dimension,o.collisionPriority=1;const r=at(o,((e,i,s,o)=>{const r=tt(e);i.next(r).next(Y(this.view)).next(this._snappingPipeline.createSnapDragEventPipelineStep({snappingContext:this._snappingContext(o),snappingManager:this._snappingManager,cancel:s,updatingHandles:this.updatingHandles}),this._snappingPipeline.next).next((e=>{const i=G(e.mapEnd,new ft);n[a]=i,this._applyConstraint(t),this._updateHeadingFromCamera(t)})),s.next(r).next(ot(n,[a]))}));return this._computationHandles.add(r,t),o}_createOffsetManipulator(t){const e=[k(-.5,0,0),k(.5,0,0)],{lengthFraction:i}=B.offsetManipulator,n=et.createPolylineGeometry(e.map((t=>x(R(),t,i)))),s=new N({view:this.view,renderObjects:[{geometry:n,material:this._unfocusedOffsetManipulatorMaterial,stateMask:rt.Unfocused|rt.Selected},{geometry:n,material:this._focusedOffsetManipulatorMaterial,stateMask:rt.Focused|rt.Selected}],collisionType:{type:"line",paths:[e]},radius:this._focusedOffsetWidth(this.analysis.lineWidth)/2,focusMultiplier:1,available:!1,autoScaleRenderObjects:!1,worldSized:!0,metadata:t.dimension}),a=at(s,((e,i,n)=>{if(c(t.geometry))return;const{dimensionSegment:s,primaryOffsetAxis:a}=t.geometry,o=D(F.get(),s.endRenderSpace,s.startRenderSpace);j(o,o,a);const r=T(s.startRenderSpace,o,A()),p=T(s.startRenderSpace,a,A()),{dimension:d}=t,l=d.offset;let m=0;const u=tt(e);i.next(u).next($(this.view,r)).next((t=>{"start"===t.action&&(m=U(p,t.renderStart));const e=(U(p,t.renderEnd)-m)*this.view.renderCoordsHelper.unitInMeters;d.offset=l+e})),n.next(u).next(ot(d,["offset"]))}));return this._computationHandles.add(a,t),s}_createHeadingManipulator(t){const e=J(this.view,this._rotateManipulatorTexture.texture);e.metadata=t.dimension;const i=at(e,((e,i,n)=>{const{dimension:s,geometry:a}=t,{renderCoordsHelper:o}=this.view;if(c(a))return;const r=E(F.get(),a,o),d=R(),l=St(R(),a,a.directSegment,o),m=T(l,r,A()),f=u(s.heading,(()=>L(a,o)));i.next($(this.view,m)).next((t=>{"start"===t.action&&C(d,t.renderStart);const e=z(m),i=K(d,t.renderEnd,l,e);s.heading=f-p(i)})),n.next(ot(s,["heading"]))}));return this._computationHandles.add(i,t),e}_updateManipulators(t,e,s){const{start:a,end:o,offset:r,heading:p}=s,l=d(t),m=this.analysisViewData.selectedDimension===e,u=l&&c(this._stagedDimension);for(const d of s.values())d===r?(d.available=u,d.selected=m):d.available=d===p?u&&m&&e.axis===i.Vertical&&e.offsetDirection===n.Side:u&&m;u&&(a.renderLocation=t.directSegment.startRenderSpace,o.renderLocation=t.directSegment.endRenderSpace,_t(r,t),p.available&&yt(p,t,e,this.view.renderCoordsHelper))}_updateManipulatorStyle(t){const e=this._unfocusedOffsetWidth(t),i=this._focusedOffsetWidth(t);for(const{offset:n}of this._computationManipulators.values())n.radius=i/2;this._unfocusedOffsetManipulatorMaterial.setParameters({width:e}),this._focusedOffsetManipulatorMaterial.setParameters({width:i})}_snappingContext(t){return new ct({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new dt(new pt("point",st(!0,!1,this.view.spatialReference))),visualizer:new X})}_unfocusedOffsetWidth(t){return y(t)+B.offsetManipulator.linePaddingPx}_focusedOffsetWidth(t){return y(t)+B.offsetManipulator.focusedLinePaddingPx}_applyConstraint(t){const{dimension:e,geometry:s}=t;if(c(s))return;const a=Pt(s,this.view);if(this._internalAxisChange=!0,c(a))e.axis=t.userSetAxis,e.offsetDirection=t.userSetOffsetDirection;else switch(a){case Ct.Horizontal:e.axis=i.Horizontal;break;case Ct.Vertical:e.axis=i.Vertical,e.offsetDirection=n.Side}this._internalAxisChange=!1}_updateHeadingFromCamera(t){const{dimension:e,geometry:i}=t;if(c(i))return;if(Pt(i,this.view)===Ct.Vertical)return;const{directSegment:n}=i,{renderCoordsHelper:s}=this.view,a=E(F.get(),i,s),o=W(F.get(),i),r=j(F.get(),o,a),{viewForward:p}=this.view.state.camera;P(r,p)>0&&x(r,r,-1);const d=n.eval(.5,F.get());e.heading=s.headingAtPosition(d,r)}get testInfo(){return{getManipulatorsForDimension:t=>{for(const[e,i]of this._computationManipulators.entries())if(t===e.dimension)return i;return null},getComputationForDimension:t=>{for(const e of this._computationManipulators.keys())if(t===e.dimension)return e;return null},stagedDimension:this._stagedDimension}}};t([M({constructOnly:!0})],ht.prototype,"analysis",void 0),t([M({constructOnly:!0})],ht.prototype,"analysisViewData",void 0),t([M({constructOnly:!0})],ht.prototype,"manipulators",void 0),t([M({constructOnly:!0,nonNullable:!0})],ht.prototype,"view",void 0),t([M({readOnly:!0})],ht.prototype,"updating",null),t([M()],ht.prototype,"_stagedDimension",void 0),ht=t([v("esri.views.3d.analysis.Dimensioning.LengthDimensionSubTool")],ht);class gt{constructor(t){this.start=t.start,this.end=t.end,this.offset=t.offset,this.heading=t.heading}*values(){yield this.start,yield this.end,yield this.offset,yield this.heading}}function _t(t,e){const{dimensionSegment:i,primaryOffsetAxis:n}=e,s=I(Ot,e),a=Q(s,n,V,Ht),o=O(s);S(a,a,H(Ot,o,o,o)),t.modelTransform=a,t.renderLocation=i.eval(.5,Ot)}function yt(t,e,i,n){const{primaryOffsetAxis:s}=e;x(Mt,s,i.offset>=0?1:-1),I(vt,e),j(vt,vt,Mt);const a=Q(Mt,vt,V,Ht);t.modelTransform=a,t.renderLocation=St(Ot,e,e.dimensionSegment,n)}const Mt=R(),vt=R();function St(t,e,i,n){const{startRenderSpace:s,endRenderSpace:a}=i,o=wt(e,n)?s:a;return C(t,o)}function wt(t,e){const i=W(xt,t),n=E(Dt,t,e);return P(i,n)>0}const xt=R(),Dt=R();function jt(){const{color:t,opacity:i}=B.offsetManipulator;return new nt({color:[...e.toUnitRGB(t),i],width:1,renderOccluded:it.OccludeAndTransparent,writeDepth:!1,hasPolygonOffset:!0})}var Ct;function Pt(t,e){const{directSegment:i}=t,{constraintThresholdPx:n}=B,{camera:s}=e.state,a=E(F.get(),t,e.renderCoordsHelper),o=W(F.get(),t),r=x(F.get(),a,P(o,a)),p=D(F.get(),o,r),d=b(p),l=b(r),{startRenderSpace:c,endRenderSpace:m}=i,u=Math.max(s.computeRenderPixelSizeAt(c)*n,s.computeRenderPixelSizeAt(m)*n)**2;return d<u?Ct.Vertical:l<u?Ct.Horizontal:null}!function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(Ct||(Ct={}));const Ot=R(),Ht=w();export{gt as LengthDimensionManipulators,ht as LengthDimensionSubTool};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../core/mathUtils.js";import"../../../core/maybe.js";import"../../../chunks/mat3f64.js";import"./CloudsTechniqueConfiguration.js";import"./NoiseTextureAtlasDimensions.js";import"../webgl-engine/core/shaderLibrary/ScreenSpacePass.js";import"../webgl-engine/core/shaderModules/FloatPassUniform.js";import"../webgl-engine/core/shaderModules/interfaces.js";import"../webgl-engine/core/shaderModules/Matrix3DrawUniform.js";import"../webgl-engine/core/shaderModules/ShaderBuilder.js";import"../webgl-engine/core/shaderModules/Texture2DPassUniform.js";export{a as CloudsDrawParameters,C as CloudsPassParameters,c as build}from"../../../chunks/Clouds.glsl.js";
|
|
5
|
+
import"../../../core/mathUtils.js";import"../../../core/maybe.js";import"../../../chunks/mat3f64.js";import"../../../chunks/vec2.js";import"../../../chunks/vec2f64.js";import"./CloudsTechniqueConfiguration.js";import"./NoiseTextureAtlasDimensions.js";import"../webgl-engine/core/shaderLibrary/ScreenSpacePass.js";import"../webgl-engine/core/shaderModules/Float2PassUniform.js";import"../webgl-engine/core/shaderModules/FloatPassUniform.js";import"../webgl-engine/core/shaderModules/interfaces.js";import"../webgl-engine/core/shaderModules/Matrix3DrawUniform.js";import"../webgl-engine/core/shaderModules/ShaderBuilder.js";import"../webgl-engine/core/shaderModules/Texture2DPassUniform.js";export{a as CloudsDrawParameters,C as CloudsPassParameters,c as build}from"../../../chunks/Clouds.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import{releaseMaybe as t,disposeMaybe as o,isNone as s}from"../../../core/maybe.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{CloudsCompositionTechnique as n}from"./CloudsCompositionTechnique.js";import{weatherfadingNeedsRender as a}from"./weatherUtils.js";import{NoParameters as p}from"../webgl-engine/core/shaderModules/interfaces.js";import{createQuadVAO as m}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as u}from"../../webgl/enums.js";let d=class extends r{constructor(e){super(e),this._technique=new n(e),this._vao=m(e.rctx)}destroy(){this._technique=t(this._technique),this._vao=o(this._vao)}render(e){const r=e.bindParameters.weatherParameter;if(s(this._vao)||s(r.cloudsFadingComposition.data))return;if(!this._technique.compiled)return void this.requestRender();const t=e.rctx.bindTechnique(this._technique,h,e.bindParameters);e.rctx.bindVAO(this._vao),t.assertCompatibleVertexAttributeLocations(this._vao),e.rctx.drawArrays(u.TRIANGLE_STRIP,0,4),a(r)&&this.requestRender()}};e([i({constructOnly:!0})],d.prototype,"rctx",void 0),e([i({constructOnly:!0})],d.prototype,"viewingMode",void 0),e([i({constructOnly:!0})],d.prototype,"planetRadius",void 0),e([i({constructOnly:!0})],d.prototype,"requestRender",void 0),d=e([c("esri.views.3d.environment.CloudsComposition")],d);const h=new p;export{d as CloudsComposition};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{c as t}from"../../../chunks/mat4f64.js";import{c as
|
|
5
|
+
import{c as t}from"../../../chunks/mat4f64.js";import{c as s}from"../../../chunks/vec3f64.js";import{CloudsTextureChannels as i,CloudsRenderingStages as a}from"./CloudsData.js";import{SceneLighting as r}from"../webgl-engine/lighting/SceneLighting.js";class o{constructor(){this.cloudsFadingComposition=new e,this.lightingFogFading=new n}}class e{constructor(){this.readChannels=i.RG,this.renderingStage=a.FINISHED,this.startTime=0,this.startTimeHeightFade=0,this.cameraPositionLastFrame=s(),this.isCameraPositionFinal=!0,this.parallax={anchorPointClouds:s(),cloudsHeight:1e5,radiusCurvatureCorrectionFactor:0,transform:t()},this.parallaxNew={anchorPointClouds:s(),cloudsHeight:1e5,radiusCurvatureCorrectionFactor:0,transform:t()},this.crossFade={enabled:!1,factor:0,distanceThresholdFactor:.3},this.fadeInOut={stage:c.FINISHED,factor:0,distanceThresholdFactor:.6},this.fadeIn={stage:h.FINISHED,factor:0,distanceThresholdFactor:2},this.fadeInOutHeight={stage:F.FINISHED,factor:-1}}}class n{constructor(){this.isWeatherFading=!1,this.fadingFactor=0,this.oldWeatherType="sunny",this.lightingOld=new r,this.lightingNew=new r}}var h,c,F;!function(t){t[t.FINISHED=0]="FINISHED",t[t.CHANGE_ANCHOR=1]="CHANGE_ANCHOR",t[t.FADE_IN=2]="FADE_IN"}(h||(h={})),function(t){t[t.FINISHED=0]="FINISHED",t[t.FADE_OUT=1]="FADE_OUT",t[t.SWITCH=2]="SWITCH",t[t.FADE_IN=3]="FADE_IN"}(c||(c={})),function(t){t[t.FINISHED=0]="FINISHED",t[t.HEIGHT_FADE=1]="HEIGHT_FADE"}(F||(F={}));export{e as CloudsFadingComposition,F as FadeHeightStages,c as FadeInOutStages,h as FadeInStages,n as WeatherFading,o 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import s from"../../../core/Handles.js";import{lerp as i}from"../../../core/mathUtils.js";import{isSome as r,releaseMaybe as o,disposeMaybe as a,destroyMaybe as n,isNone as h}from"../../../core/maybe.js";import{watch as u,initial as c}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import{f as p}from"../../../chunks/mat3.js";import{v as l}from"../../../chunks/mat4.js";import{c as _}from"../../../chunks/mat4f64.js";import{f}from"../../../chunks/vec2f64.js";import{f
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import s from"../../../core/Handles.js";import{lerp as i}from"../../../core/mathUtils.js";import{isSome as r,releaseMaybe as o,disposeMaybe as a,destroyMaybe as n,isNone as h}from"../../../core/maybe.js";import{watch as u,initial as c}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import{f as p}from"../../../chunks/mat3.js";import{v as l}from"../../../chunks/mat4.js";import{c as _}from"../../../chunks/mat4f64.js";import{f as g}from"../../../chunks/vec2f64.js";import{f,z as T}from"../../../chunks/vec3f32.js";import{getReferenceEllipsoid as w}from"../../../geometry/projectionEllipsoid.js";import{C,a as v}from"../../../chunks/Clouds.glsl.js";import{FadeInOutStages as y,FadeHeightStages as x}from"./CloudsCompositionParameters.js";import{CloudsTextureChannels as P,CloudsRenderingStages as b}from"./CloudsData.js";import{cloudPresets as S}from"./CloudsPresets.js";import{CloudsTechnique as j}from"./CloudsTechnique.js";import{CloudsTechniqueConfiguration as E}from"./CloudsTechniqueConfiguration.js";import{NoiseTextureAtlas as I}from"./NoiseTextureAtlas.js";import{BindParameters as M}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as z}from"../webgl-engine/lib/glUtil3D.js";import{TaskPriority as D}from"../../support/Scheduler.js";import{TextureType as N,PixelFormat as U,PixelType as A,TextureWrapMode as F,TextureSamplingMode as R,TargetType as q}from"../../webgl/enums.js";import{FramebufferObject as H}from"../../webgl/FramebufferObject.js";let B=class extends t{constructor(e){super(e),this._frameTask=null,this._handles=new s,this._techniques=new Array,this._techniqueConfiguration=new E,this._passParameters=new C,this._bindParameters=new M(null,null,null),this._drawParameters=new v,this._weatherTile=g(0,0),this._weatherTileCount=128,this._faceIndex=0,this.coverage=i(W.coverage[0],W.coverage[1],.5),this.density=i(W.density[0],W.density[1],.5),this.absorption=i(W.absorption[0],W.absorption[1],.5),this.cloudSize=i(W.cloudSize[0],W.cloudSize[1],.5),this.detailSize=i(W.detailSize[0],W.detailSize[1],.5),this.smoothness=i(W.smoothness[0],W.smoothness[1],.5),this.cloudHeight=i(W.cloudHeight[0],W.cloudHeight[1],.5),this.raymarchingStepType=W.raymarchingStepType,this._viewMatrix=_(),this.running=!1}_getTechnique(e){const t=1-this.context.renderContext.bindParameters.weatherParameter.cloudsFadingComposition.readChannels,s=t===P.RG?2*e:2*e+1,i=this._techniques[s];return i||(this._techniqueConfiguration.writeTextureChannels=t,this._techniqueConfiguration.steps=e,this._techniques[s]=new j({rctx:this.context.renderContext.rctx,viewingMode:this.view.state.viewingMode},this._techniqueConfiguration),this._techniques[s])}_getWeatherTile(){const e=this.view.camera.position.latitude,t=this.view.camera.position.longitude;let s=g((e+90)/180,(t+180)/360);const i=Math.floor(this._weatherTileCount*Math.abs(2*s[0]-1));s=g(Math.floor(2*this._weatherTileCount*s[0]),Math.floor(4*(this._weatherTileCount-i)*s[1]));let o=0,a=0;if(r(this.view.environment)&&"virtual"!==this.view.environment.lighting.type&&r(this.view.environment.lighting.date)){const e=new Date(this.view.environment.lighting.date);e.setUTCHours(this.view.environment.lighting.date.getUTCHours()+this.view.environment.lighting.displayUTCOffset),o=31*e.getUTCMonth()+e.getUTCDate(),a=e.getUTCFullYear()}return s[0]=(s[0]+o)%(2*this._weatherTileCount),s[1]=(s[1]+a%100)%(4*this._weatherTileCount),s}initialize(){this._vao=z(this.context.renderContext.rctx);const e=w(this.view.spatialReference);this._passParameters.cloudRadius=.5*e.radius,this.setDirty(),this._weatherTile=this._getWeatherTile(),this._frameTask=this.view.resourceController.scheduler.registerTask(D.CLOUDS_GENERATOR,this),this._handles.add(this._frameTask),this._handles.add(u((()=>[this.coverage,this.density,this.absorption,this.cloudSize,this.detailSize,this.smoothness,this.cloudHeight,this.raymarchingStepType]),(()=>this.setDirty()),c))}destroy(){this._handles.destroy(),this._techniques.forEach((e=>o(e))),this._frameBufferCube=a(this._frameBufferCube),this._techniques.length=0,this._vao=a(this._vao),this._passParameters.noiseTexture=n(this._passParameters.noiseTexture)}_ensureNoiseTexture(){if(h(this._passParameters.noiseTexture)){const e=this.context;this._passParameters.noiseTexture=new I({context:e}),this._passParameters.noiseTexture.updateWeatherMap(this._weatherTile)}return r(this._passParameters.noiseTexture.textureAtlas)}ensureWeatherTile(){const e=this._getWeatherTile();r(this._passParameters.noiseTexture)&&r(this.context)&&this._passParameters.noiseTexture.updateWeatherMap(e),e[0]===this._weatherTile[0]&&e[1]===this._weatherTile[1]||(this._weatherTile=e,this.setDirty())}_ensureFrameBufferCube(e){if(h(this._frameBufferCube)){const t={target:N.TEXTURE_CUBE_MAP,pixelFormat:U.RGBA,dataType:A.UNSIGNED_BYTE,wrapMode:F.CLAMP_TO_EDGE,samplingMode:R.LINEAR,hasMipmap:!1,width:e,height:e};this._frameBufferCube=new H(this.context.renderContext.rctx,{colorTarget:q.CUBEMAP,width:e,height:e},t)}return this._frameBufferCube}get cubeMap(){return this._frameBufferCube}fadingDoNotGenerate(e){return e.cloudsFadingComposition.fadeInOut.stage===y.FADE_OUT||e.cloudsFadingComposition.fadeInOutHeight.stage!==x.FINISHED||e.cloudsFadingComposition.renderingStage===b.FADING_TEXTURE_CHANNELS}applyPreset(e,t){const s=e.median,r=e=>{const r=i(e[0],e[1],s);return t<.5?i(e[0],r,2*t):i(r,e[1],2*(t-.5))};this.coverage=r(e.coverage),this.density=r(e.density),this.absorption=r(e.absorption),this.cloudSize=r(e.cloudSize),this.detailSize=r(e.detailSize),this.smoothness=r(e.smoothness),this.cloudHeight=r(e.cloudHeight),this.raymarchingStepType=e.raymarchingStepType}setDirty(){this.running=!0}runTask(e){if(0===this.coverage||h(this._vao))return void(this.running=!1);const t=this._getTechnique(this.raymarchingStepType);if(!t.compiled)return;if(!this.context.renderContext.bindParameters.weatherParameter.cloudsFadingComposition.isCameraPositionFinal||this.fadingDoNotGenerate(this.context.renderContext.bindParameters.weatherParameter))return;if(this.ensureWeatherTile(),!this._ensureNoiseTexture())return;this.context.renderContext.bindParameters.weatherParameter.cloudsFadingComposition.renderingStage=b.RENDERING,this._passParameters.absorption=this.absorption,this._passParameters.density=this.density,this._passParameters.cloudSize=this.cloudSize,this._passParameters.detailSize=this.detailSize,this._passParameters.smoothness=this.smoothness,this._passParameters.cloudHeight=this.cloudHeight,this._passParameters.coverage=this.coverage;const s=this.context.renderContext.rctx,i=s.bindTechnique(t,this._passParameters,this._bindParameters);s.bindVAO(this._vao),i.assertCompatibleVertexAttributeLocations(this._vao);const r=s.getViewport(),o=t.configuration.cubeMapSize;s.setViewport(0,0,o,o);const a=this._ensureFrameBufferCube(o);s.bindFramebuffer(a);const n=k[this._faceIndex],u=O[this._faceIndex];l(this._viewMatrix,G,n,u),p(this._drawParameters.viewMatrix,this._viewMatrix);const c=N.TEXTURE_CUBE_MAP_POSITIVE_X+this._faceIndex;a.setColorTextureTarget(c),i.bindDraw(this._drawParameters,this._bindParameters,this._passParameters),s.gl.drawArrays(s.gl.TRIANGLE_STRIP,0,4),s.gl.flush(),s.setViewport(r.x,r.y,r.width,r.height),this.requestRender(),e.madeProgress(),4===this._faceIndex?(this.running=!1,this._faceIndex=0,this.context.renderContext.bindParameters.weatherParameter.cloudsFadingComposition.renderingStage=b.FINISHED_RENDERING):this._faceIndex++}};e([d({constructOnly:!0})],B.prototype,"context",void 0),e([d({constructOnly:!0})],B.prototype,"view",void 0),e([d({constructOnly:!0})],B.prototype,"requestRender",void 0),e([d()],B.prototype,"_frameTask",void 0),e([d()],B.prototype,"coverage",void 0),e([d()],B.prototype,"density",void 0),e([d()],B.prototype,"absorption",void 0),e([d()],B.prototype,"cloudSize",void 0),e([d()],B.prototype,"detailSize",void 0),e([d()],B.prototype,"smoothness",void 0),e([d()],B.prototype,"cloudHeight",void 0),e([d()],B.prototype,"raymarchingStepType",void 0),e([d()],B.prototype,"running",void 0),B=e([m("esri.views.3d.environment.CloudsGenerator")],B);const k=[f(1,0,0),f(-1,0,0),f(0,1,0),f(0,-1,0),f(0,0,1)],O=[f(0,1,0),f(0,1,0),f(0,0,-1),f(0,0,1),f(0,1,0)],G=T(),W=S.sunny;export{B as CloudsGenerator};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import s from"../../../core/Handles.js";import{lerp as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import s from"../../../core/Handles.js";import{lerp as r}from"../../../core/mathUtils.js";import{destroyMaybe as i,isSome as o,isNone as n}from"../../../core/maybe.js";import{when as a,syncAndInitial as h,watch as p,initial as l}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import{l as _}from"../../../chunks/vec3.js";import{getReferenceEllipsoid as c}from"../../../geometry/projectionEllipsoid.js";import{isMoon as u,isEarth as w}from"../../../geometry/support/spatialReferenceUtils.js";import{AtmosphereType as y}from"./AtmosphereType.js";import{ChapmanAtmosphere as g}from"./ChapmanAtmosphere.js";import{CloudsComposition as v}from"./CloudsComposition.js";import{isReadyCloudsData as f}from"./CloudsData.js";import{CloudsGenerator as R}from"./CloudsGenerator.js";import{cloudPresets as b}from"./CloudsPresets.js";import{Fog as N}from"./Fog.js";import{PanoramicAtmosphere as E}from"./PanoramicAtmosphere.js";import{Precipitation as j}from"./Precipitation.js";import C from"./SimpleAtmosphere.js";import{Stars as T}from"./Stars.js";import{weatherHeightLimit as x}from"./weather.js";import{ShaderOutput as A}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderSlot as P}from"../webgl-engine/lib/RenderSlot.js";var O;const S=[P.POSTPROCESSING_ENVIRONMENT_OPAQUE,P.POSTPROCESSING_ENVIRONMENT_TRANSPARENT];let M,U=O=class extends t{constructor(e){super(e),this._handles=new s,this._context=null,this._atmosphere=null}initialize(){this.view._stage.addRenderPlugin(S,this)}destroy(){null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._handles=i(this._handles),this._set("view",null)}get atmosphereType(){return o(this._atmosphere)?this._atmosphere.type:y.None}get canRender(){return!!this.view.basemapTerrain?.renderer.canRender||"global"!==this.view.viewingMode}get needsLinearDepth(){return o(this._atmosphere)&&this._atmosphere.type===y.Realistic}updateAnimation(e){return!!o(this._precipitation)&&this._precipitation.update(e)}get updating(){return o(this._stars)&&this._stars.updating||o(this._clouds)&&this._clouds.running}get weatherVisible(){return _(this.view.state.camera.eye)-c(this.view.spatialReference).radius<=x}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,s=this._get("_stars");return!t||n(this._context)?(i(s),null):o(s)?s:new T({view:e,requestRender:()=>this._setNeedsRender()})}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||n(this._context))return i(e),null;const t=this.view,s=this._context;return o(e)&&e.context===s?e:(i(e),new j({context:s,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||n(this._context))return i(e),null;if(o(e))return e;const t=this.view,s=this._context;return i(e),new R({context:s,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||n(this._context))return i(e),null;const t=this.view.state.viewingMode,s=this._context.renderContext.rctx,r=c(this.view.spatialReference).radius;return o(e)&&e.viewingMode===t&&e.planetRadius===r?e:(i(e),new v({rctx:s,viewingMode:t,planetRadius:r,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||n(this._context))return i(e),null;if(o(e))return e;const t=this.view,s=this._context;return i(e),new N({context:s,view:t})}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,this._handles.add([a((()=>this.view?.basemapTerrain),(()=>this._updateBasemapTerrain()),h),p((()=>({viewingMode:this.view.viewingMode,atmosphereEnabled:this.view.environment.atmosphereEnabled,atmosphereQuality:this.view.environment.atmosphere.quality})),(()=>this._updateAtmosphere()),h),p((()=>this._stars),(()=>this._setNeedsRender())),p((()=>this._clouds),(()=>this._updateWeather(this._weatherUpdateParameters)),l),p((()=>this._precipitation),(()=>this._setNeedsRender())),p((()=>this._fog),(()=>this._updateFog(this._weatherUpdateParameters)),l),p((()=>this._weatherUpdateParameters),(e=>{this._updateWeather(e),this._updateFog(e)}),h)])}uninitializeRenderContext(){this._context=null,this._atmosphere=i(this._atmosphere),this._set("_stars",i(this._stars)),this._set("_precipitation",i(this._precipitation)),this._set("_clouds",i(this._clouds)),this._set("_cloudsComposition",i(this._cloudsComposition)),this._set("_fog",i(this._fog))}prepareRender(e){e.bindParameters.weatherParameter.cloudsFadingComposition.data=f(this._clouds)?this._clouds:null}render(e){if(e.output===A.Color)switch(e.bindParameters.slot){case P.POSTPROCESSING_ENVIRONMENT_OPAQUE:o(this._stars)&&this._stars.render(e),o(this._atmosphere)&&(this._atmosphere.render(e),o(this._cloudsComposition)&&o(e.bindParameters.weatherParameter.cloudsFadingComposition.data)&&(this.weatherVisible&&o(this._clouds)&&this._clouds.ensureWeatherTile(),this._cloudsComposition.render(e)));break;case P.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(o(this._atmosphere)){const t=this.weatherEnabled?this.view.environment.weather.type:"disabled";if(this._atmosphere.renderHaze(e,"rainy"===t),o(this._fog)){const s="foggy"===t||"rainy"===t||"snowy"===t;(s||this._selectAtmosphereType()!==y.Realistic)&&this._fog.render(e,s,"rainy"===t)}if(o(this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return n(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}}_updateWeather(e){n(e)||n(this._clouds)||(this._clouds.applyPreset(b[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){o(this._context)&&this._context.requestRender()}_updateFog(e){if(!n(this._fog)&&!n(e))switch(e.type){case"foggy":this._fog.strength=r(3e-5,.005,e.weatherAdjustment**3),this._setNeedsRender();break;case"rainy":case"snowy":this._fog.strength=r(4e-6,2e-4,e.effect**3),this._setNeedsRender();break;default:this._fog.strength=4e-6,this._setNeedsRender()}}_updateAtmosphere(){const e=this._selectAtmosphereType();if(this.atmosphereType===e)return;const t=this._getAtmosphereClass();if(!t)return o(this._atmosphere)&&(this._atmosphere.destroy(),this._atmosphere=null,this._setNeedsRender()),void this._updateBasemapTerrain();o(this._context)&&(i(this._atmosphere),this._atmosphere=new t(this.view),this._atmosphere.initializeRenderContext(this._context),this._setNeedsRender(),this._updateBasemapTerrain())}_getAtmosphereClass(){switch(this._selectAtmosphereType()){case y.None:return null;case y.Realistic:return g;case y.Panoramic:return E;case y.Simple:return C;default:return}}_selectAtmosphereType(){const e=this.view.get("environment.atmosphereEnabled"),t=this.view.get("environment.atmosphere.quality"),s=this.view.viewingMode;return!e||null==t||u(this.view.spatialReference)?y.None:"local"===s?y.Panoramic:"high"===t&&o(this._context)&&g.isSupported(this._context)&&w(this.view.spatialReference)?y.Realistic:y.Simple}_updateBasemapTerrain(){this.view.basemapTerrain&&(this.view.basemapTerrain.velvetOverground=o(this._atmosphere)&&this.atmosphereType===y.Simple)}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType(),stubGetAtmosphereClass:e=>{M=O.prototype._getAtmosphereClass,O.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{O.prototype._getAtmosphereClass=M}}}};e([d({constructOnly:!0})],U.prototype,"view",void 0),e([d({type:Boolean,readOnly:!0})],U.prototype,"updating",null),e([d({readOnly:!0})],U.prototype,"weatherVisible",null),e([d()],U.prototype,"_context",void 0),e([d({readOnly:!0})],U.prototype,"_stars",null),e([d({readOnly:!0})],U.prototype,"_precipitation",null),e([d({readOnly:!0})],U.prototype,"_clouds",null),e([d({readOnly:!0})],U.prototype,"_cloudsComposition",null),e([d({readOnly:!0})],U.prototype,"_fog",null),e([d({readOnly:!0})],U.prototype,"weatherEnabled",null),e([d({readOnly:!0})],U.prototype,"_precipitationEnabled",null),e([d({readOnly:!0})],U.prototype,"_weatherUpdateParameters",null),U=O=e([m("esri.views.3d.environment.EnvironmentRenderer")],U);export{U as EnvironmentRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{lerp as r}from"../../../core/mathUtils.js";import{releaseMaybe as i,disposeMaybe as s,isNone as n,isSome as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{lerp as r}from"../../../core/mathUtils.js";import{releaseMaybe as i,disposeMaybe as s,isNone as n,isSome as a}from"../../../core/maybe.js";import{secondsFromMilliseconds as o}from"../../../core/time.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{WatchUpdatingTracking as p}from"../../../core/support/WatchUpdatingTracking.js";import{getReferenceEllipsoid as u}from"../../../geometry/projectionEllipsoid.js";import{PrecipitationPassParameters as m,PrecipitationTechnique as d,attributeLocations as _}from"./PrecipitationTechnique.js";import{PrecipitationTechniqueConfiguration as f,PrecipitationType as l}from"./PrecipitationTechniqueConfiguration.js";import{glLayout as T}from"../support/buffer/glUtil.js";import{newLayout as g}from"../support/buffer/InterleavedLayout.js";import{AnimationTimer as y}from"../webgl-engine/lib/AnimationTimer.js";import{VertexArrayObject as w}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as b}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as j}from"../../webgl/BufferObject.js";import{PrimitiveType as q,Usage as I}from"../../webgl/enums.js";import{bindVertexBufferLayout as P,unbindVertexBufferLayout as A}from"../../webgl/Util.js";let v=class extends t{constructor(e){super(e),this._numParticles=25e4,this._rainSpeed=.1,this._snowSpeed=.01,this._passParameters=new m,this._animation=new y,this._updatingTracking=new p,this._passParameters.time=0,this._passParameters.radius=u(e.view.spatialReference).radius,this._shaderTechniqueRepository=e.context.shaderTechniqueRepository}destroy(){this._updatingTracking.destroy(),this._numParticles=0,this._snowTechniqueCached=i(this._snowTechniqueCached),this._rainTechniqueCached=i(this._rainTechniqueCached),this._vao=s(this._vao),this._instanceIdBuffer=s(this._instanceIdBuffer)}get updating(){return this._updatingTracking.updating}get _rainTechnique(){if(n(this._rainTechniqueCached)){const e=new f;e.type=l.Rain,this._rainTechniqueCached=this._shaderTechniqueRepository.acquire(d,e)}return this._rainTechniqueCached}get _snowTechnique(){if(n(this._snowTechniqueCached)){const e=new f;e.type=l.Snow,this._snowTechniqueCached=this._shaderTechniqueRepository.acquire(d,e)}return this._snowTechniqueCached}update(e){return this._animation.advance(e)}render(e,t,i){const s="rainy"===i?this._rainTechnique:this._snowTechnique;if(!s.compiled)return void this.context.requestRender();const c=e.rctx;if(this._ensureResources(c),n(s)||n(this._vao)||n(this._instanceIdBuffer))return;if(a(e.bindParameters.weatherParameter.cloudsFadingComposition.data)&&(this._passParameters.opacity=1-e.bindParameters.weatherParameter.cloudsFadingComposition.fadeInOutHeight.factor),this._passParameters.opacity<=0)return;const h=.35;t=t<.5?r(0,h,2*t):r(h,1,2*(t-.5)),this._passParameters.time=("rainy"===i?this._rainSpeed:this._snowSpeed)*o(this._animation.time)%1e5;const p=c.bindTechnique(s,this._passParameters,e.bindParameters);c.bindVAO(this._vao),p.assertCompatibleVertexAttributeLocations(this._vao),P(c,_,this._instanceIdBuffer,R,0),c.capabilities.instancing.drawArraysInstanced(q.TRIANGLES,0,3,this._numParticles*t),A(c,_,this._instanceIdBuffer,R)}_ensureResources(e){n(this._vao)&&(this._vao=this._createVertexArrayObject(e)),n(this._instanceIdBuffer)&&(this._instanceIdBuffer=this._createInstanceIndices(e))}_createInstanceIndices(e){const t=[];for(let r=0;r<this._numParticles;r++)t.push(r);return j.createVertex(e,I.STATIC_DRAW,new Float32Array(t))}_createVertexArrayObject(e){const t=new Float32Array([-1,0,1,1,0,-1,1,0,1]);return new w(e,_,{geometry:T(C)},{geometry:j.createVertex(e,I.STATIC_DRAW,t)})}};e([c({constructOnly:!0})],v.prototype,"context",void 0),e([c({constructOnly:!0})],v.prototype,"view",void 0),e([c({readOnly:!0})],v.prototype,"updating",null),e([c()],v.prototype,"_updatingTracking",void 0),v=e([h("esri.views.3d.environment.Precipitation")],v);const C=g().vec3f(b.POSITION),R=T(g().f32(b.INSTANCEFEATUREATTRIBUTE),1);export{v as Precipitation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import r from"../../../core/Evented.js";import i from"../../../core/Handles.js";import{destroyMaybe as n,isSome as s,isNone as o,mapOr as a}from"../../../core/maybe.js";import{after as h}from"../../../core/promiseUtils.js";import{watch as c,sync as d,syncAndInitial as l}from"../../../core/reactiveUtils.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{s as u,g as m,c as f,h as g}from"../../../chunks/vec3.js";import{c as P,f as v}from"../../../chunks/vec3f64.js";import{b,f as w}from"../../../chunks/vec4f64.js";import{canProjectToWGS84ComparableLonLat as C,projectPointToWGS84ComparableLonLat as y}from"../../../geometry/projection.js";import{isEarth as U}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as T}from"../../ViewingMode.js";import{EnvironmentRenderer as R}from"./EnvironmentRenderer.js";import{positionToTimezoneInfo as S}from"../support/earthUtils.js";import{computeColorAndIntensity as M,computeVirtualLightDirection as H,ColorAndIntensity as W,computeShadowsEnabled as G}from"../support/sunUtils.js";import{MainLight as j,AmbientLight as k,FillLight as L}from"../webgl-engine/lighting/Lightsources.js";import E from"../../../webscene/background/ColorBackground.js";let Q=class extends r.EventedAccessor{constructor(){super(),this._referencePointUpdateDelay=200,this._referencePointUpdateInterval=3e3,this._referencePointUpdateDistThreshold=1e6,this._referencePosUpdateQuery=null,this._referencePosMapCoordsRequested=null,this._viewHandles=new i,this._preserveAbsoluteDateTime=!1,this._trackingEnabled=!1,this._referencePosResetPreserveAbsoluteTime=!1,this._referencePosUpdateTimer=null,this._referencePosMapCoords=null,this._mainLight=new j,this._ambientLight=new k,this._moonLight=new L,this.disableQueries=!1,this._disableWeather=!1,this._renderer=null,this._referencePosWGS84Comparable=null,this._resetReferencePosition()}destroy(){this.disconnectView(),this._viewHandles.destroy()}get _view(){return this._renderer?.view}get updating(){return!((this.disableQueries||!this._referencePosUpdateQuery&&!this._referencePosMapCoordsRequested)&&!this._renderer?.updating)}get weatherEnabled(){return this._view?.environment.atmosphereEnabled&&!this._disableWeather&&this._view?.state?.viewingMode===T.Global&&U(this._view.spatialReference)}get weatherVisible(){return this.weatherEnabled&&this._renderer?.weatherVisible}get referencePositionWGS84Comparable(){return this._referencePosWGS84Comparable}connectView(e){if(this._renderer)return;this._renderer=new R({view:e});const t=()=>this._updateRenderParameters(),r=()=>this._cameraHandler(),i=()=>this._updateLighting();this._viewHandles.add([c((()=>e.environment.lighting),(e=>this._updateLightingHandler(e)),d),c((()=>"virtual"!==e.environment.lighting.type?e.environment.lighting.date:null),(e=>this._lightingDateHandler(e)),d),c((()=>e.stationary),(()=>this._interactingStationaryHandler())),c((()=>e.environment.lighting.directShadowsEnabled),t,d),c((()=>e.environment.lighting.ambientOcclusionEnabled),t,d),c((()=>e.environment.lighting.waterReflectionEnabled),t,d),c((()=>e.environment.background?.color),t,d),c((()=>e.spatialReference),(()=>this._resetReferencePosition(!0)),d),c((()=>e.environment.weather.type),i,d),c((()=>this.weatherEnabled),i,d),c((()=>e.viewingMode),(()=>this._resetReferencePosition(!0)),l),c((()=>"virtual"!==e.environment.lighting.type&&e.environment.lighting.cameraTrackingEnabled),(e=>this._updateCameraTracking(e)),l),c((()=>e.state.camera),r,l),c((()=>this.disableQueries),r)]),this._updateRenderParameters(),this._updateLighting(),this._cameraHandler(),this.notifyChange("updating")}disconnectView(){this._viewHandles.removeAll(),this._resetReferencePosition(),this._renderer=n(this._renderer)}_updateLightingHandler(e){this._updateCameraTracking("virtual"!==e.type&&e.cameraTrackingEnabled),this._lightingDateHandler("virtual"!==e.type?e.date:null),this._updateRenderParameters()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{const e=this._view.environment.lighting;"virtual"!==e?.type&&(e.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){const t=this._view.environment.lighting;if("virtual"!==t?.type){if(e){if(!t.positionTimezoneInfo.autoUpdated){this._preserveAbsoluteDateTime=!0;const r=this._view.spatialReference;if(!C(r)){const e=this._view.camera.position;if(!this._referencePosMapCoords||!this._referencePosMapCoords.equals(e))return void this._requestReferencePositionUpdate(e)}if(this._preupdateTracking(e),s(this._referencePosWGS84Comparable)){const e=S(this._referencePosWGS84Comparable,V);s(e)&&(t.autoUpdate(null,e),this._trackingEnabled&&(t.positionTimezoneInfo.autoUpdated=!0))}}this._updateLighting(e)}}else this._updateLighting()}_preupdateTracking(e){!this._trackingEnabled&&"virtual"!==this._view.environment.lighting.type&&this._view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){const t=this._view;if(!t.ready)return;const r=t.stateManager.camera;r&&(this._cameraHandlerClientSide(r,e)||this._cameraHandlerServerSide(r))}_cameraHandlerClientSide(e,t){const r=U(this._view.spatialReference);if(r&&!C(this._view.spatialReference))return"virtual"===this._view.environment.lighting.type&&this._updateLighting(),!1;const i=e.position;return o(this._referencePosWGS84Comparable)&&(this._referencePosWGS84Comparable=P()),r?y(i,this._referencePosWGS84Comparable):u(this._referencePosWGS84Comparable,i.longitude,i.latitude,i.z),this.notifyChange("referencePositionWGS84Comparable"),this._autoUpdateTimezone(this._referencePosWGS84Comparable,t)||this._updateLighting(t),!0}_cameraHandlerServerSide(e){const t=e.position;(!this._referencePosMapCoords||this._referencePosMapCoordsRequested||this._exceedsReferencePosDistThreshold(t))&&this._requestReferencePositionUpdate(t,!0),this._view.mapCoordsHelper&&this._referencePosWGS84Comparable&&(this._referencePosWGS84Comparable[2]=t.z*this._view.mapCoordsHelper.unitInMeters,this._referencePosChanged())}_interactingStationaryHandler(){this._view.stationary&&this._executePendingReferencePositionUpdate()}_updateLighting(e){const t=this._view,r=e||("virtual"!==t.environment.lighting.type?t.environment.lighting.date:null),i=this._referencePosWGS84Comparable,n=s(i)?D:q,o=this.weatherVisible?t.environment.weather.type:"disabled";s(i)?M(r,i,t.state.viewingMode,o,t.state.camera,t.environment.lighting.type,n):"virtual"===t.environment.lighting.type&&H(t.state.camera,t.state.viewingMode,n.direct.directionToLightSource);const a=this._mainLight,h=n.direct;m(a.intensity,h.color,h.intensity*Math.PI),f(a.direction,h.directionToLightSource),a.specularStrength=n.specularStrength,a.environmentStrength=n.environmentStrength;const c=this._ambientLight;m(c.intensity,n.ambient.color,n.ambient.intensity);const d=this._moonLight;g(d.intensity,I,z,n.globalFactor);const l=(1-.5*n.globalFactor)*(1-.4*n.noonFactor*(1-n.globalFactor));m(d.intensity,d.intensity,l),f(d.direction,h.directionToLightSource),t._stage.renderView.updateLightSources([a,c,d],n.noonFactor,n.globalFactor),this._updateRenderParameters()}_autoUpdateTimezone(e,t=null){if("virtual"===this._view.environment.lighting.type||!this._view.environment.lighting.cameraTrackingEnabled||o(e))return!1;const r=A;r.setTime((t||this._view.environment.lighting.date).getTime());const i=S(e,V);if(o(i))return!1;let n=this._view.environment.lighting.positionTimezoneInfo;if(n.autoUpdated){if(n.hours===i.hours&&n.minutes===i.minutes&&n.seconds===i.seconds)return!1}else n=i;const s=r.getUTCHours()-(i.hours-n.hours),a=r.getUTCMinutes()-(i.minutes-n.minutes),h=r.getUTCSeconds()-(i.seconds-n.seconds);return r.setUTCHours(s),r.setUTCMinutes(a),r.setUTCSeconds(h),!t&&this._view.environment.lighting.autoUpdate(r,i)}_updateRenderParameters(){const e=this._view._stage;if(!e)return;const r=a(this._referencePosWGS84Comparable,!0,(e=>G(e[2],this._view.state.viewingMode))),i=this._view.environment.background,n=i instanceof E?{type:"color",color:b(t.toUnitRGBA(i.color))}:{type:"color",color:w(0,0,0,1)};e.renderView.setRenderParameters({shadowMap:this._view.environment.lighting.directShadowsEnabled&&r,background:n,environment:this._view.environment,weatherVisible:this._view.environmentManager.weatherVisible})}_resetReferencePosition(e=!1){this._cancelReferencePosUpdates(),this._referencePosMapCoords=null,this._referencePosMapCoordsRequested=null,this._referencePosResetPreserveAbsoluteTime=null,this._referencePosWGS84Comparable=null,this.notifyChange("updating"),e&&this._cameraHandler()}_requestReferencePositionUpdate(e,t=!1){if(!this.disableQueries&&(this._referencePosMapCoordsRequested?this._referencePosMapCoordsRequested.copy(e):this._referencePosMapCoordsRequested=e.clone(),this._referencePosResetPreserveAbsoluteTime=!!t,!this._referencePosUpdateQuery&&!this._referencePosUpdateTimer&&this._view.stationary)){const e=this._referencePosUpdateQuery=h(this._referencePointUpdateDelay).then((()=>{if(this._referencePosUpdateQuery===e){const t=()=>this._referencePosUpdateQuery!==e;return this._doReferencePositionUpdateQuery(t)}})).catch((e=>{"mapcoordshelper:missing-geometry-service"===e.name&&(this.disableQueries=!0)})).then((()=>{this._referencePosUpdateQuery===e&&(this._referencePosUpdateQuery=null,this._referencePosUpdateTimer||this._executePendingReferencePositionUpdate(),this.notifyChange("updating"))})),t=this._referencePosUpdateTimer=h(this._referencePointUpdateInterval).then((()=>{this._referencePosUpdateTimer===t&&(this._referencePosUpdateTimer=null,this._referencePosUpdateQuery||this._executePendingReferencePositionUpdate())}));this.notifyChange("updating")}}async _doReferencePositionUpdateQuery(e){this._referencePosResetPreserveAbsoluteTime&&(this._preserveAbsoluteDateTime=!1),this._referencePosMapCoords?this._referencePosMapCoords.copy(this._referencePosMapCoordsRequested):this._referencePosMapCoords=this._referencePosMapCoordsRequested.clone(),this._referencePosResetPreserveAbsoluteTime=null,this._referencePosMapCoordsRequested=null;const t=await this._view.mapCoordsHelper.toGeographic(this._referencePosMapCoords);if(!e()&&!isNaN(t[0])&&!isNaN(t[1])){const e=this._referencePosMapCoords.z*this._view.mapCoordsHelper.unitInMeters;this._referencePosWGS84Comparable?(this._referencePosWGS84Comparable[0]=t[0],this._referencePosWGS84Comparable[1]=t[1],this._referencePosWGS84Comparable[2]=e):this._referencePosWGS84Comparable=[t[0],t[1],e],this._referencePosChanged()}}_executePendingReferencePositionUpdate(){const e=this._referencePosMapCoordsRequested;e&&this._requestReferencePositionUpdate(e,this._referencePosResetPreserveAbsoluteTime)}_referencePosChanged(){this._preserveAbsoluteDateTime?this._updateLighting():this._autoUpdateTimezone(this._referencePosWGS84Comparable)||this._updateLighting(),this.notifyChange("referencePositionWGS84Comparable")}_exceedsReferencePosDistThreshold(e){if(this._referencePosMapCoords){let t=this._referencePosMapCoords.distance(e);return this._view.mapCoordsHelper&&(t*=this._view.mapCoordsHelper.unitInMeters),t>this._referencePointUpdateDistThreshold}return!0}_cancelReferencePosUpdates(){const e=!!this._referencePosUpdateQuery;return this._referencePosUpdateQuery=null,this._referencePosUpdateTimer=null,e}get test(){const e=this;return{get renderer(){return e._renderer},set referencePointUpdateInterval(t){e._referencePointUpdateInterval=t},set referencePointUpdateDistThreshold(t){e._referencePointUpdateDistThreshold=t},set referencePosUpdateTimer(t){e._referencePosUpdateTimer=t},set referencePointUpdateDelay(t){e._referencePointUpdateDelay=t},set disableWeather(t){e._disableWeather=t}}}};e([p({type:Boolean,readOnly:!0})],Q.prototype,"updating",null),e([p()],Q.prototype,"disableQueries",void 0),e([p()],Q.prototype,"_disableWeather",void 0),e([p()],Q.prototype,"weatherEnabled",null),e([p()],Q.prototype,"weatherVisible",null),e([p()],Q.prototype,"referencePositionWGS84Comparable",null),e([p()],Q.prototype,"_renderer",void 0),e([p()],Q.prototype,"_referencePosWGS84Comparable",void 0),Q=e([_("esri.views.3d.environment.SceneViewEnvironmentManager")],Q);const D=new W,q=new W,A=new Date,V={hours:0,minutes:0,seconds:0},I=v(.22,.22,.33),z=v(.22,.22,.22);export{Q as SceneViewEnvironmentManager};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import r from"../../../core/Evented.js";import i from"../../../core/Handles.js";import{destroyMaybe as n,isSome as s,isNone as o,mapOr as a}from"../../../core/maybe.js";import{after as h}from"../../../core/promiseUtils.js";import{watch as d,sync as c,syncAndInitial as l}from"../../../core/reactiveUtils.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{s as u,g as m,c as g,h as f}from"../../../chunks/vec3.js";import{c as v,f as P}from"../../../chunks/vec3f64.js";import{b,f as w}from"../../../chunks/vec4f64.js";import{canProjectToWGS84ComparableLonLat as y,projectPointToWGS84ComparableLonLat as C}from"../../../geometry/projection.js";import{isEarth as U}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as T}from"../../ViewingMode.js";import{EnvironmentRenderer as R}from"./EnvironmentRenderer.js";import{positionToTimezoneInfo as S}from"../support/earthUtils.js";import{computeColorAndIntensity as W,computeVirtualLightDirection as M,ColorAndIntensity as H,computeShadowsEnabled as G}from"../support/sunUtils.js";import{MainLight as j,AmbientLight as k,FillLight as E}from"../webgl-engine/lighting/Lightsources.js";import L from"../../../webscene/background/ColorBackground.js";let Q=class extends r.EventedAccessor{constructor(){super(),this._referencePointUpdateDelay=200,this._referencePointUpdateInterval=3e3,this._referencePointUpdateDistThreshold=1e6,this._referencePosUpdateQuery=null,this._referencePosMapCoordsRequested=null,this._viewHandles=new i,this._preserveAbsoluteDateTime=!1,this._trackingEnabled=!1,this._referencePosResetPreserveAbsoluteTime=!1,this._referencePosUpdateTimer=null,this._referencePosMapCoords=null,this._mainLight=new j,this._ambientLight=new k,this._moonLight=new E,this._oldWeatherType="sunny",this._isWeatherFading=!1,this.disableQueries=!1,this._disableWeather=!1,this._renderer=null,this._referencePosWGS84Comparable=null,this._resetReferencePosition()}destroy(){this.disconnectView(),this._viewHandles.destroy()}get _view(){return this._renderer?.view}get updating(){return!((this.disableQueries||!this._referencePosUpdateQuery&&!this._referencePosMapCoordsRequested)&&!this._renderer?.updating)}get weatherEnabled(){return this._view?.environment.atmosphereEnabled&&!this._disableWeather&&this._view?.state?.viewingMode===T.Global&&U(this._view.spatialReference)}get weatherVisible(){return this.weatherEnabled&&this._renderer?.weatherVisible}get referencePositionWGS84Comparable(){return this._referencePosWGS84Comparable}connectView(e){if(this._renderer)return;this._renderer=new R({view:e});const t=()=>this._updateRenderParameters(),r=()=>this._cameraHandler(),i=()=>this._updateLighting();this._viewHandles.add([d((()=>e.environment.lighting),(e=>this._updateLightingHandler(e)),c),d((()=>"virtual"!==e.environment.lighting.type?e.environment.lighting.date:null),(e=>this._lightingDateHandler(e)),c),d((()=>e.stationary),(()=>this._interactingStationaryHandler())),d((()=>e.environment.lighting.directShadowsEnabled),t,c),d((()=>e.environment.lighting.ambientOcclusionEnabled),t,c),d((()=>e.environment.lighting.waterReflectionEnabled),t,c),d((()=>e.environment.background?.color),t,c),d((()=>e.spatialReference),(()=>this._resetReferencePosition(!0)),c),d((()=>e.environment.weather.type),i,c),d((()=>this.weatherEnabled),i,c),d((()=>e.viewingMode),(()=>this._resetReferencePosition(!0)),l),d((()=>"virtual"!==e.environment.lighting.type&&e.environment.lighting.cameraTrackingEnabled),(e=>this._updateCameraTracking(e)),l),d((()=>e.state.camera),r,l),d((()=>this.disableQueries),r)]),this._updateRenderParameters(),this._updateLighting(),this._cameraHandler(),this.notifyChange("updating")}disconnectView(){this._viewHandles.removeAll(),this._resetReferencePosition(),this._renderer=n(this._renderer)}_updateLightingHandler(e){this._updateCameraTracking("virtual"!==e.type&&e.cameraTrackingEnabled),this._lightingDateHandler("virtual"!==e.type?e.date:null),this._updateRenderParameters()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{const e=this._view.environment.lighting;"virtual"!==e?.type&&(e.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){const t=this._view.environment.lighting;if("virtual"!==t?.type){if(e){if(!t.positionTimezoneInfo.autoUpdated){this._preserveAbsoluteDateTime=!0;const r=this._view.spatialReference;if(!y(r)){const e=this._view.camera.position;if(!this._referencePosMapCoords||!this._referencePosMapCoords.equals(e))return void this._requestReferencePositionUpdate(e)}if(this._preupdateTracking(e),s(this._referencePosWGS84Comparable)){const e=S(this._referencePosWGS84Comparable,V);s(e)&&(t.autoUpdate(null,e),this._trackingEnabled&&(t.positionTimezoneInfo.autoUpdated=!0))}}this._updateLighting(e)}}else this._updateLighting()}_preupdateTracking(e){!this._trackingEnabled&&"virtual"!==this._view.environment.lighting.type&&this._view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){const t=this._view;if(!t.ready)return;const r=t.stateManager.camera;r&&(this._cameraHandlerClientSide(r,e)||this._cameraHandlerServerSide(r))}_cameraHandlerClientSide(e,t){const r=U(this._view.spatialReference);if(r&&!y(this._view.spatialReference))return"virtual"===this._view.environment.lighting.type&&this._updateLighting(),!1;const i=e.position;return o(this._referencePosWGS84Comparable)&&(this._referencePosWGS84Comparable=v()),r?C(i,this._referencePosWGS84Comparable):u(this._referencePosWGS84Comparable,i.longitude,i.latitude,i.z),this.notifyChange("referencePositionWGS84Comparable"),this._autoUpdateTimezone(this._referencePosWGS84Comparable,t)||this._updateLighting(t),!0}_cameraHandlerServerSide(e){const t=e.position;(!this._referencePosMapCoords||this._referencePosMapCoordsRequested||this._exceedsReferencePosDistThreshold(t))&&this._requestReferencePositionUpdate(t,!0),this._view.mapCoordsHelper&&this._referencePosWGS84Comparable&&(this._referencePosWGS84Comparable[2]=t.z*this._view.mapCoordsHelper.unitInMeters,this._referencePosChanged())}_interactingStationaryHandler(){this._view.stationary&&this._executePendingReferencePositionUpdate()}_updateLighting(e){this.weatherEnabled||(this._oldWeatherType="sunny"),this._oldWeatherType||(this._oldWeatherType=this._view.environment.weather.type),this._isWeatherFading=!(this._oldWeatherType===this._view.environment.weather.type);const t=this._view,r=e||("virtual"!==t.environment.lighting.type?t.environment.lighting.date:null),i=this._referencePosWGS84Comparable,n=s(i)?D:q,o=this.weatherVisible?t.environment.weather.type:"disabled";s(i)?W(r,i,t.state.viewingMode,o,t.state.camera,t.environment.lighting.type,n):"virtual"===t.environment.lighting.type&&M(t.state.camera,t.state.viewingMode,n.direct.directionToLightSource);const a=this._mainLight,h=n.direct;m(a.intensity,h.color,h.intensity*Math.PI),g(a.direction,h.directionToLightSource),a.specularStrength=n.specularStrength,a.environmentStrength=n.environmentStrength;const d=this._ambientLight;m(d.intensity,n.ambient.color,n.ambient.intensity);const c=this._moonLight;f(c.intensity,I,F,n.globalFactor);const l=(1-.5*n.globalFactor)*(1-.4*n.noonFactor*(1-n.globalFactor));m(c.intensity,c.intensity,l),g(c.direction,h.directionToLightSource),t._stage.renderView.updateLightSources([a,d,c],n.noonFactor,n.globalFactor,this._isWeatherFading),this._updateRenderParameters(),this._oldWeatherType=this._view.environment.weather.type}_autoUpdateTimezone(e,t=null){if("virtual"===this._view.environment.lighting.type||!this._view.environment.lighting.cameraTrackingEnabled||o(e))return!1;const r=A;r.setTime((t||this._view.environment.lighting.date).getTime());const i=S(e,V);if(o(i))return!1;let n=this._view.environment.lighting.positionTimezoneInfo;if(n.autoUpdated){if(n.hours===i.hours&&n.minutes===i.minutes&&n.seconds===i.seconds)return!1}else n=i;const s=r.getUTCHours()-(i.hours-n.hours),a=r.getUTCMinutes()-(i.minutes-n.minutes),h=r.getUTCSeconds()-(i.seconds-n.seconds);return r.setUTCHours(s),r.setUTCMinutes(a),r.setUTCSeconds(h),!t&&this._view.environment.lighting.autoUpdate(r,i)}_updateRenderParameters(){const e=this._view._stage;if(!e)return;const r=a(this._referencePosWGS84Comparable,!0,(e=>G(e[2],this._view.state.viewingMode))),i=this._view.environment.background,n=i instanceof L?{type:"color",color:b(t.toUnitRGBA(i.color))}:{type:"color",color:w(0,0,0,1)};e.renderView.setRenderParameters({isWeatherFading:this._isWeatherFading,shadowMap:this._view.environment.lighting.directShadowsEnabled&&r,background:n,environment:this._view.environment,oldWeatherType:this._oldWeatherType,weatherVisible:this._view.environmentManager.weatherVisible})}_resetReferencePosition(e=!1){this._cancelReferencePosUpdates(),this._referencePosMapCoords=null,this._referencePosMapCoordsRequested=null,this._referencePosResetPreserveAbsoluteTime=null,this._referencePosWGS84Comparable=null,this.notifyChange("updating"),e&&this._cameraHandler()}_requestReferencePositionUpdate(e,t=!1){if(!this.disableQueries&&(this._referencePosMapCoordsRequested?this._referencePosMapCoordsRequested.copy(e):this._referencePosMapCoordsRequested=e.clone(),this._referencePosResetPreserveAbsoluteTime=!!t,!this._referencePosUpdateQuery&&!this._referencePosUpdateTimer&&this._view.stationary)){const e=this._referencePosUpdateQuery=h(this._referencePointUpdateDelay).then((()=>{if(this._referencePosUpdateQuery===e){const t=()=>this._referencePosUpdateQuery!==e;return this._doReferencePositionUpdateQuery(t)}})).catch((e=>{"mapcoordshelper:missing-geometry-service"===e.name&&(this.disableQueries=!0)})).then((()=>{this._referencePosUpdateQuery===e&&(this._referencePosUpdateQuery=null,this._referencePosUpdateTimer||this._executePendingReferencePositionUpdate(),this.notifyChange("updating"))})),t=this._referencePosUpdateTimer=h(this._referencePointUpdateInterval).then((()=>{this._referencePosUpdateTimer===t&&(this._referencePosUpdateTimer=null,this._referencePosUpdateQuery||this._executePendingReferencePositionUpdate())}));this.notifyChange("updating")}}async _doReferencePositionUpdateQuery(e){this._referencePosResetPreserveAbsoluteTime&&(this._preserveAbsoluteDateTime=!1),this._referencePosMapCoords?this._referencePosMapCoords.copy(this._referencePosMapCoordsRequested):this._referencePosMapCoords=this._referencePosMapCoordsRequested.clone(),this._referencePosResetPreserveAbsoluteTime=null,this._referencePosMapCoordsRequested=null;const t=await this._view.mapCoordsHelper.toGeographic(this._referencePosMapCoords);if(!e()&&!isNaN(t[0])&&!isNaN(t[1])){const e=this._referencePosMapCoords.z*this._view.mapCoordsHelper.unitInMeters;this._referencePosWGS84Comparable?(this._referencePosWGS84Comparable[0]=t[0],this._referencePosWGS84Comparable[1]=t[1],this._referencePosWGS84Comparable[2]=e):this._referencePosWGS84Comparable=[t[0],t[1],e],this._referencePosChanged()}}_executePendingReferencePositionUpdate(){const e=this._referencePosMapCoordsRequested;e&&this._requestReferencePositionUpdate(e,this._referencePosResetPreserveAbsoluteTime)}_referencePosChanged(){this._preserveAbsoluteDateTime?this._updateLighting():this._autoUpdateTimezone(this._referencePosWGS84Comparable)||this._updateLighting(),this.notifyChange("referencePositionWGS84Comparable")}_exceedsReferencePosDistThreshold(e){if(this._referencePosMapCoords){let t=this._referencePosMapCoords.distance(e);return this._view.mapCoordsHelper&&(t*=this._view.mapCoordsHelper.unitInMeters),t>this._referencePointUpdateDistThreshold}return!0}_cancelReferencePosUpdates(){const e=!!this._referencePosUpdateQuery;return this._referencePosUpdateQuery=null,this._referencePosUpdateTimer=null,e}get test(){const e=this;return{get renderer(){return e._renderer},set referencePointUpdateInterval(t){e._referencePointUpdateInterval=t},set referencePointUpdateDistThreshold(t){e._referencePointUpdateDistThreshold=t},set referencePosUpdateTimer(t){e._referencePosUpdateTimer=t},set referencePointUpdateDelay(t){e._referencePointUpdateDelay=t},set disableWeather(t){e._disableWeather=t}}}};e([p({type:Boolean,readOnly:!0})],Q.prototype,"updating",null),e([p()],Q.prototype,"disableQueries",void 0),e([p()],Q.prototype,"_disableWeather",void 0),e([p()],Q.prototype,"weatherEnabled",null),e([p()],Q.prototype,"weatherVisible",null),e([p()],Q.prototype,"referencePositionWGS84Comparable",null),e([p()],Q.prototype,"_renderer",void 0),e([p()],Q.prototype,"_referencePosWGS84Comparable",void 0),Q=e([_("esri.views.3d.environment.SceneViewEnvironmentManager")],Q);const D=new H,q=new H,A=new Date,V={hours:0,minutes:0,seconds:0},I=P(.22,.22,.33),F=P(.22,.22,.22);export{Q as SceneViewEnvironmentManager};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{clamp as a}from"../../../core/mathUtils.js";import{e as t}from"../../../chunks/mat4.js";import{c as o}from"../../../chunks/mat4f64.js";import{l as e,E as n,n as i,g as r,c as s,b as g}from"../../../chunks/vec3.js";import{f as d,c}from"../../../chunks/vec3f64.js";import{create as F,fromPoints as f,axis as l}from"../../../geometry/support/axisAngleDegrees.js";import{FadeInStages as I,FadeInOutStages as h,FadeHeightStages as m}from"./CloudsCompositionParameters.js";import{CloudsRenderingStages as u,ensureClouds as C}from"./CloudsData.js";import{weatherHeightLimit as N}from"./weather.js";function E(t){const o=t.cloudsFadingComposition,e=performance.now(),n=o.parallax.anchorPointClouds;o.fadeIn.stage===I.FINISHED&&(o.fadeIn.factor=1,s(n,W),o.fadeIn.stage=I.CHANGE_ANCHOR,o.crossFade.enabled=!1,o.fadeInOut.stage=h.FINISHED),o.fadeIn.stage===I.CHANGE_ANCHOR&&o.isCameraPositionFinal&&C(o.data)&&o.renderingStage!==u.RENDERING&&(s(n,W),o.fadeIn.stage=I.FADE_IN,o.startTime=e,o.renderingStage=u.SWITCH_CHANNELS),o.fadeIn.factor>0&&o.fadeIn.stage===I.FADE_IN?o.fadeIn.factor=a(1-(e-o.startTime)/x,0,1):o.fadeIn.factor<=0&&o.fadeIn.stage===I.FADE_IN&&(o.fadeIn.stage=I.FINISHED,o.fadeIn.factor=0,!0===t.lightingFogFading.isWeatherFading&&(t.lightingFogFading.isWeatherFading=!1))}function H(t){const o=t.cloudsFadingComposition,e=performance.now(),{fadeInOut:n,crossFade:i}=o;n.stage===h.FINISHED&&(o.startTime=e,n.factor=0,n.stage=h.FADE_OUT),n.factor<1&&n.stage===h.FADE_OUT?n.factor=a((e-o.startTime)/b,0,1):(n.factor>=1&&n.stage===h.FADE_OUT&&(n.factor=1,s(o.parallax.anchorPointClouds,W)),n.factor>=1&&n.stage===h.FADE_OUT&&o.isCameraPositionFinal&&(n.factor=1,n.stage=h.SWITCH,o.crossFade.enabled=!1,i.factor=1),C(o.data)&&n.stage===h.SWITCH&&o.renderingStage!==u.RENDERING&&(o.startTime=e,n.factor=1,n.stage=h.FADE_IN,s(o.parallax.anchorPointClouds,W),o.crossFade.enabled=!1,i.factor=1,o.renderingStage=u.SWITCH_CHANNELS),n.factor>0&&n.stage===h.FADE_IN?n.factor=a(1-(e-o.startTime)/x,0,1):n.factor<=0&&n.stage===h.FADE_IN&&(n.stage=h.FINISHED,n.factor=0,!0===t.lightingFogFading.isWeatherFading&&(t.lightingFogFading.isWeatherFading=!1)))}function p(t){const o=t.cloudsFadingComposition,e=performance.now(),{crossFade:n}=o,i=o.parallax.anchorPointClouds;o.crossFade.enabled||(s(o.parallaxNew.anchorPointClouds,W),o.startTime=e,n.factor=0,o.crossFade.enabled=!0),n.factor<1&&o.crossFade.enabled?n.factor=a((e-o.startTime)/L,0,1):n.factor>=1&&o.crossFade.enabled&&(o.crossFade.enabled=!1,n.factor=1,s(i,o.parallaxNew.anchorPointClouds),o.renderingStage===u.FADING_TEXTURE_CHANNELS&&(o.renderingStage=u.SWITCH_CHANNELS),!0===t.lightingFogFading.isWeatherFading&&(t.lightingFogFading.isWeatherFading=!1))}function S(t,o){const e=t.cloudsFadingComposition,n=performance.now(),i=e.fadeInOutHeight,r=(n-(i.stage===m.FINISHED?n:e.startTimeHeightFade))/R;i.factor+=o?-r:r,e.startTimeHeightFade=n,i.factor=a(i.factor,0,1),i.stage=m.HEIGHT_FADE}function D(t){t.cloudsFadingComposition.fadeIn.stage!==I.FADE_IN?t.cloudsFadingComposition.fadeInOut.stage!==h.FADE_IN?t.cloudsFadingComposition.crossFade.enabled?t.lightingFogFading.fadingFactor=a(t.cloudsFadingComposition.crossFade.factor,0,1):t.lightingFogFading.fadingFactor=0:t.lightingFogFading.fadingFactor=1-Math.max(a(t.cloudsFadingComposition.fadeInOut.factor,0,1)):t.lightingFogFading.fadingFactor=1-Math.max(a(t.cloudsFadingComposition.fadeIn.factor,0,1))}function T(a,d,c,F){const T=a.cloudsFadingComposition;T.renderingStage===u.FINISHED_RENDERING&&(T.renderingStage=u.FADING_TEXTURE_CHANNELS);const{parallax:A}=T;T.fadeInOutHeight.factor<0&&(T.fadeInOutHeight.factor=e(d)-F>N?1:0),T.isCameraPositionFinal=n(T.cameraPositionLastFrame,d),i(W,d),r(W,W,F),0===A.anchorPointClouds[0]&&0===A.anchorPointClouds[1]&&0===A.anchorPointClouds[2]&&s(A.anchorPointClouds,W);const _=e(g(w,A.anchorPointClouds,W));let x=!0;_>T.fadeIn.distanceThresholdFactor*A.cloudsHeight||T.fadeIn.stage!==I.FINISHED?E(a):_>T.fadeInOut.distanceThresholdFactor*A.cloudsHeight||T.fadeInOut.stage!==h.FINISHED?H(a):(_>T.crossFade.distanceThresholdFactor*A.cloudsHeight&&!c||T.crossFade.enabled)&&C(T.data)||T.renderingStage===u.FADING_TEXTURE_CHANNELS?p(a):x=!1;const b=e(d),L=b-F;if((L>1.7*N||L<-N)&&T.fadeInOutHeight.factor<1?T.fadeInOutHeight.factor=1:(L>N||L<-.35*N)&&T.fadeInOutHeight.factor<1?S(a,!1):L<N&&L>-.35*N&&T.fadeInOutHeight.factor>0?S(a,!0):T.fadeInOutHeight.stage=m.FINISHED,T.renderingStage===u.SWITCH_CHANNELS&&(T.readChannels=1-T.readChannels,T.renderingStage=u.FINISHED),a.lightingFogFading.isWeatherFading&&D(a),A.radiusCurvatureCorrectionFactor=.84*Math.sqrt(Math.max(b*b-F*F,0))/b,f(O,A.anchorPointClouds,P),A.transform=o(),t(A.transform,A.transform,P[3],l(P)),x){const{parallaxNew:a}=T;f(O,a.anchorPointClouds,P),a.transform=o(),t(a.transform,a.transform,P[3],l(P))}s(T.cameraPositionLastFrame,d)}function A(a){return a.cloudsFadingComposition.crossFade.enabled||a.cloudsFadingComposition.fadeInOut.stage!==h.FINISHED||a.cloudsFadingComposition.fadeIn.stage!==I.FINISHED||a.cloudsFadingComposition.fadeInOutHeight.stage!==m.FINISHED||a.cloudsFadingComposition.renderingStage!==u.FINISHED}function _(a){if(!a.weatherParameter.lightingFogFading.isWeatherFading)return;const t=a.weatherParameter.lightingFogFading.lightingOld,o=a.weatherParameter.lightingFogFading.lightingNew,e=a.weatherParameter.lightingFogFading.fadingFactor;a.lighting.setLerpLighting(t,o,e)}const O=d(0,0,1),P=F(),W=c(),w=c(),x=500,b=250,L=650,R=500;export{_ as lerpLightingFadingParameters,T as setWeatherFadingParallaxParameters,A as weatherfadingNeedsRender};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{destroyMaybe as t,isNone as s,get as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{destroyMaybe as t,isNone as s,get as i}from"../../../core/maybe.js";import{initial as o,whenOnce as n}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{hydrateGraphic as p}from"../../../layers/graphics/hydratedFeatures.js";import{FeatureTileController3D as c}from"../../../layers/graphics/controllers/FeatureTileController3D.js";import h from"../../../rest/support/Query.js";import{elevationAlignPointsInFeatures as u}from"./graphics/elevationAlignPointsInFeatures.js";import d from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as y}from"./graphics/QueryEngine.js";import{HeatmapFeatureProcessor as g}from"./support/HeatmapFeatureProcessor.js";import{toViewIfLocal as m}from"./support/projectExtentUtils.js";import{UpdatePolicy as f}from"../webgl-engine/lib/basicInterfaces.js";import{TaskPriority as E}from"../../support/Scheduler.js";const b=b=>{let v=class extends b{constructor(){super(...arguments),this.controller=null,this.updatePolicy=f.SYNC,this.suspendResumeExtentMode="computed",this.slicePlaneEnabled=!1,this.fullExtentInLocalViewSpatialReference=null,this.suspendResumeExtent=null,this._controllerCreated=!1,this.clippingExtent=null,this.supportsHeightUnitConversion=!0,this._pendingController=null,this.queryEngine=null}initialize(){const e=this.layer;if("isTable"in e&&e.isTable)return void this.addResolvingPromise(Promise.reject(new r("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e})));this.addResolvingPromise(this._validateGeometryType()),this.updatingHandles.add((()=>this.layer.renderer),(e=>this._recreateProcessor(e)),o),this.addResolvingPromise((async()=>{const e=await m(this);this.fullExtentInLocalViewSpatialReference=e,await this._initializeController()})()),this.updatingHandles.add((()=>this.updatePolicy),(e=>this.processor.preferredUpdatePolicy=e));const t=()=>this.processor.featureStore;this.queryEngine=new y({context:{spatialReference:this.view.spatialReference,layer:this.layer,scheduler:this.view.resourceController.scheduler,get featureStore(){return t()},hasZ:this.hasZ,hasM:this.hasM},priority:E.FEATURE_QUERY_ENGINE}),this.notifyChange("updating")}destroy(){this._destroyPendingController(),this.controller=t(this.controller),this._set("processor",t(this.processor)),this.queryEngine=t(this.queryEngine),this.loadedGraphics=null}_destroyPendingController(){this._pendingController=t(this._pendingController)}get legendEnabled(){return this.canResume()&&this.processor?.legendEnabled}get graphics3DProcessor(){return"graphics-3d"===this.processor?.type?this.processor:null}get heatmapProcessor(){return"heatmap"===this.processor?.type?this.processor:null}getHit(e){let r=null;return this.loadedGraphics?.forEach((t=>{t.uid===e&&(r=p(t,this.layer))})),r?{type:"graphic",graphic:r,layer:r.layer}:null}whenGraphicBounds(e,r){return this.processor?.whenGraphicBounds(e,r)}computeAttachmentOrigin(e,r){return this.processor?.computeAttachmentOrigin(e,r)}async elevationAlignPointsInFeatures(e,t){const i=this.graphics3DProcessor;if(s(i))throw new r("featurelayerview3d:missing-processor","A Graphics3D processor is needed to resolve graphics elevation.");return u(this.view,this.layer,(e=>i.graphics3DGraphicsByObjectID?.get(e)),e,t)}queryFeatures(e,r){return this.queryEngine.executeQuery(this._ensureQuery(e),i(r,"signal"))}queryObjectIds(e,r){return this.queryEngine.executeQueryForIds(this._ensureQuery(e),i(r,"signal"))}queryFeatureCount(e,r){return this.queryEngine.executeQueryForCount(this._ensureQuery(e),i(r,"signal"))}queryExtent(e,r){return this.queryEngine.executeQueryForExtent(this._ensureQuery(e),i(r,"signal"))}_ensureQuery(e){return s(e)?this.createQuery():h.from(e)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}maskOccludee(e){return this.processor.maskOccludee(e)}canResume(){return super.canResume()&&!this.processor?.scaleVisibilitySuspended}getSuspendInfo(){const e=super.getSuspendInfo();return this.processor?{...e,...this.processor.suspendInfo}:e}isUpdating(){return!(!this.processor||this.processor.destroyed)&&!(this._controllerCreated&&!this.controller?.updating&&this.view?.basemapTerrain?.ready&&!this.processor.updating)}async _initializeController(){const e=this.createController();this._pendingController=e,await e.when(),this._setControllerWhenInitialized(e)}async _setControllerWhenInitialized(e){try{await this.when()}catch(r){}this._controllerCreated=!0,this.notifyChange("updating"),this.isResolved()&&!this.destroyed?(await n((()=>this.view?.basemapTerrain?.ready)),this.beforeSetController(e),this._pendingController=null,this.controller=e,this.loadedGraphics=e.graphics,this.notifyChange("updating")):this._destroyPendingController()}_updateClippingExtent(e){if(this.clippingExtent=e,!this.controller)return!1;switch(this.controller.type){case"stream":return!1;case"feature-tile-3d":return this.controller.extent=e,!0}}async _validateGeometryType(){switch(this.layer.geometryType){case"multipatch":case"multipoint":throw new r("featurelayerview3d:unsupported-geometry-type","Unsupported geometry type ${geometryType}",{geometryType:this.layer.geometryType})}}_recreateProcessor(e){const r="heatmap"===e?.type,t="heatmap"===this.processor?.type,s=this.processor;if(s&&r===t)return;const i=r?new g({owner:this}):new d({owner:this,frustumVisibilityEnabled:!0,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentEnabled:!0,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!0,preferredUpdatePolicy:this.updatePolicy,updateClippingExtent:e=>this._updateClippingExtent(e)});this._set("processor",i),s?.destroy(),this.queryEngine?.clear(),this.addResolvingPromise(i.initializePromise)}_getResourceInfo(){const e=this.controller instanceof c?this.controller:null;return{displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:e?.maximumNumberOfFeatures??-1,totalNumberOfFeatures:e?.serviceDataCount??-1,nodes:0,...this.processor.performanceInfo}}get performanceInfo(){return this._getResourceInfo()}};return e([a()],v.prototype,"loadedGraphics",void 0),e([a()],v.prototype,"suspended",void 0),e([a({readOnly:!0})],v.prototype,"legendEnabled",null),e([a()],v.prototype,"updating",void 0),e([a()],v.prototype,"controller",void 0),e([a()],v.prototype,"processor",void 0),e([a({readOnly:!0})],v.prototype,"updatePolicy",void 0),e([a({readOnly:!0})],v.prototype,"suspendResumeExtentMode",void 0),e([a({type:Boolean})],v.prototype,"slicePlaneEnabled",void 0),e([a({readOnly:!0})],v.prototype,"suspendInfo",void 0),e([a()],v.prototype,"graphics3DProcessor",null),e([a()],v.prototype,"heatmapProcessor",null),v=e([l("esri.views.3d.layers.FeatureLikeLayerView3D")],v),v};export{b as FeatureLikeLayerView3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{destroyMaybe as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import s from"../../../core/Error.js";import{destroyMaybe as r,isSome as i,isNone as t}from"../../../core/maybe.js";import{when as o}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerView3D as p}from"./LayerView3D.js";import{elevationAlignPointsInFeatures as c}from"./graphics/elevationAlignPointsInFeatures.js";import{GraphicsProcessor as l}from"./graphics/GraphicsProcessor.js";import{toViewIfLocal as h}from"./support/projectExtentUtils.js";import{UpdatePolicy as u}from"../webgl-engine/lib/basicInterfaces.js";import d from"../../layers/LayerView.js";let m=class extends(p(d)){constructor(){super(...arguments),this.type="graphics-3d",this.slicePlaneEnabled=!1,this.fullExtentInLocalViewSpatialReference=null}initialize(){this._set("processor",new l({owner:this,scaleVisibilityEnabled:!0,frustumVisibilityEnabled:!0})),this.addResolvingPromise(this.processor.initializePromise),this.handles.add(this.layer.on("graphic-update",(e=>this.processor.graphicsCore.graphicUpdateHandler(e)))),this.addResolvingPromise(h(this).then((e=>this.fullExtentInLocalViewSpatialReference=e))),this.layer.internal?this.notifyChange("updating"):this.handles.add(o((()=>this.view?.basemapTerrain?.ready),(()=>()=>this.notifyChange("updating")),{once:!0}))}destroy(){this.handles.removeAll(),this.updatingHandles.removeAll(),this._set("processor",r(this.processor))}get loadedGraphics(){return this.layer.graphics}get legendEnabled(){return this.canResume()&&!this.processor?.frustumVisibilitySuspended}getSuspendInfo(){const e=super.getSuspendInfo();return e.outsideScaleRange=this.processor?.scaleVisibilitySuspended??!1,e.outsideOfView=this.processor?.frustumVisibilitySuspended??!1,e}async fetchPopupFeatures(e,s){return i(s)?s.clientGraphics:null}getHit(e){return this.processor.getHit(e)}whenGraphicBounds(e,s){return this.processor.whenGraphicBounds(e,s)}computeAttachmentOrigin(e,s){return this.processor?.computeAttachmentOrigin(e,s)}getSymbolLayerSize(e,s){return this.processor.getSymbolLayerSize(e,s)}queryGraphics(){return Promise.resolve(this.loadedGraphics)}maskOccludee(e){return this.processor.maskOccludee(e)}highlight(e){return this.processor.highlight(e)}async elevationAlignPointsInFeatures(e,r){const{processor:i}=this;if(t(i))throw new s("graphicslayerview3d:missing-processor","A Graphics3D processor is needed to resolve graphics elevation.");return c(this.view,this.layer,(e=>i.graphics3DGraphics.get(e)),e,r)}get updatePolicy(){return this.processor?.graphicsCore.effectiveUpdatePolicy||u.SYNC}canResume(){return super.canResume()&&!this.processor?.scaleVisibilitySuspended}isUpdating(){return!(!this.processor?.updating&&(this.layer.internal||this.view?.basemapTerrain?.ready))}get performanceInfo(){return{displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:-1,totalNumberOfFeatures:-1,nodes:0,core:null,updating:this.updating,elevationUpdating:this.processor?.elevationAlignment.updating??!1,visibilityFrustum:!this.processor?.frustumVisibilitySuspended}}};e([a()],m.prototype,"loadedGraphics",null),e([a({readOnly:!0})],m.prototype,"legendEnabled",null),e([a()],m.prototype,"layer",void 0),e([a({readOnly:!0})],m.prototype,"processor",void 0),e([a({type:Boolean})],m.prototype,"slicePlaneEnabled",void 0),m=e([n("esri.views.3d.layers.GraphicsLayerView3D")],m);const g=m;export{g as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{isNone as o}from"../../../../core/maybe.js";import{throwIfAborted as e}from"../../../../core/promiseUtils.js";import{makeDehydratedPoint as r}from"../../../../layers/graphics/dehydratedFeatures.js";import{SampleElevationInfo as t,evaluateElevationInfoAtPoint as n}from"./elevationAlignmentUtils.js";import{ElevationContext as s}from"./ElevationContext.js";import{extractExpressionInfo as i,createContext as f}from"./featureExpressionInfoUtils.js";async function a(a,p,m,l,c){const{elevationProvider:u,renderCoordsHelper:d,spatialReference:j}=a,x=r(0,0,0,j),y=new t,v=new s,{elevationInfo:h}=p,I=i(h,!0),E=await f(I,j,c);e(c),v.setFromElevationInfo(h);const b=[];for(const{objectId:e,points:r}of l){const t="number"==typeof e?m(e):null;if(o(t))for(const o of r)b.push(o[2]);else{v.updateFeatureExpressionInfoContext(E,t.graphic,p);for(const{x:o,y:e,z:t}of r)x.x=o,x.y=e,x.z=t,n(x,u,v,d,y),b.push(y.z)}}return b}export{a as elevationAlignPointsInFeatures};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{isSome as r,disposeMaybe as s,isNone as n}from"../../../core/maybe.js";import o from"../../../core/ObjectPool.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{I as h}from"../../../chunks/mat4f64.js";import{b as d,s as c,e as u}from"../../../chunks/vec3.js";import{Z as p,f as _,c as g}from"../../../chunks/vec3f64.js";import{Z as f}from"../../../chunks/vec4f64.js";import{create as m,set as b}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as T}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as y}from"../../ViewingMode.js";import{TextureUpdate as R}from"./interfaces.js";import{LayerClass as v}from"./LayerClass.js";import{OverlaySource as O}from"./Overlay.js";import{overlayRenderOccludedFlag as x}from"./OverlayRenderer.js";import{clearCaches as C}from"./PatchGeometry.js";import{PatchRenderData as D}from"./PatchRenderData.js";import{RenderOrder as P}from"./RenderOrder.js";import{ScaleRangeQueries as q}from"./ScaleRangeQueries.js";import{ENABLE_TERRAIN_INTERNAL_CHECKS as S}from"./terrainUtils.js";import{TileRenderer as E}from"./TileRenderer.js";import{TileUpdate as A}from"./TileUpdate.js";import{IteratorPreorder as N,sortTiles as w,compareTiles as j}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as G,ComponentIntersectionData as I}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as L}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as F}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as U}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as k}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{RenderRequestType as B}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as z}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as M}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as H,StoreResults as V}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as Q}from"../webgl-engine/lib/Material.js";import{RenderSlot as W}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as Y}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as X}from"../webgl-engine/lib/VertexAttribute.js";import{TERRAIN_ID as Z,getVerticalOffsetTerrain as K}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as J}from"../webgl-engine/materials/DrawParameters.js";import{intersectAabbInvDirBefore as $,intersectTriangles as ee}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as te}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ie}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{ClearBufferBit as re,PrimitiveType as se}from"../../webgl/enums.js";const ne=7,oe=10,ae=m();let le=class extends i{constructor(e){super(e),this.type=H.TERRAIN,this.isGround=!0,this._tileSize=256,this._techniqueConfiguration=new ie,this._passParameters=new U,this._rctx=null,this._isTransparent=!1,this._scaleRangeQueries=new q,this._renderDataPool=new o(D),this._patchGroups=new Map,this._patchGroupsDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new N,this._highestVisibleLODTile=null,this._visible=!0,this._opaque=!0,this._velvetOverground=!0,this._castShadows=!0,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.needsHighlight=!1,this.renderOccludedFlags=Q.Occlude}get _isGlobal(){return this._stage.viewingMode===y.Global}get shading(){return this._techniqueConfiguration.shading}set shading(e){this._techniqueConfiguration.shading=e}initialize(){const e=[W.OPAQUE_TERRAIN,W.TRANSPARENT_TERRAIN,W.OCCLUDED_TERRAIN];this._stage.addRenderPlugin(e,this)}destroy(){this._stage.removeRenderPlugin(this),C()}get canRender(){return this._visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set opaque(e){this._opaque!==e&&(this._opaque=e,this.setNeedsRender())}get opaque(){return this._opaque&&!this._techniqueConfiguration.hasSlicePlane}get needsLinearDepth(){return this._overlayRenderer.hasWater}set isTransparent(e){this._isTransparent!==e&&(this._isTransparent=e,this.setNeedsRender())}get isTransparent(){return this._isTransparent}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()}set velvetOverground(e){this._velvetOverground!==e&&(this._velvetOverground=e,this.setNeedsRender())}get layerUid(){return Z}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())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setNeedsHighlight(e){this.needsHighlight=e,this.setNeedsRender()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?x:Q.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,r(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,A.TEXTURE_FADING)}queryVisibleLevelRange(e,t,i,r){this._scaleRangeQueries.queryVisibleLevelRange(e,t,i,r),this.setNeedsRender()}updateTileTexture(e,t){r(this._tileRenderer)&&(this._tileRenderer.updateTileTexture(e,t===A.TEXTURE_FADING?R.FADING:R.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[v.ELEVATION])i.pendingUpdates&=~A.GEOMETRY;e.resetPendingUpdate(A.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=oe-ne,i=Math.max(0,Math.floor((e.level-t)/ne)*ne);if(this._isGlobal&&0===i)return p;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}setVisibility(e){this._visible=e,this.setDirty()}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=B.UPDATE){this._patchGroupsDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=B.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=B.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._rctx=e.renderContext.rctx,this._techniqueRepository=e.shaderTechniqueRepository,this._tileRenderer=new E(this._rctx,this._tileSize,this._techniqueRepository),this.updateTileBackground(),this._emptyTex=z(this._rctx)}uninitializeRenderContext(){this._emptyTex=s(this._emptyTex),this._tileRenderer=s(this._tileRenderer)}intersect(e,t,i,s){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&!this._opaque)return;const o=de,a=ce;d(o,s,i),c(a,1/o[0],1/o[1],1/o[2]);const l=e.results.min,p=e.results.max,_=e.results.ground,g=e.options.store===V.MIN,f=!!e.results.ground.target,m=K(e.verticalOffset),y=e.tolerance;let R,v=g&&r(l.dist)?l.dist:1/0;const O=c=>{const f=c.renderData;if(!f?.vao)return;const O=f.geometryInfo;b(ae,O.boundingBox);const x=f.localOrigin;r(m)&&(m.localOrigin=x,m.applyToAabb(ae));const C=ae;if(ue[0]=i[0]-x[0],ue[1]=i[1]-x[1],ue[2]=i[2]-x[2],!$(C,ue,a,y,v))return;const D=(e,t,i)=>{e.set(this.type,c,t,i,h),v=g&&r(l.dist)?l.dist:1/0},P=(a,h)=>{if(r(h)&&a>=0&&(e.options.backfacesTerrain||u(h,o)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(i,s,a))){if((null==_.dist||a<_.dist)&&D(_,a,h),e.options.isFiltered)return;e.options.store===V.ALL&&(n(R)?(R=M(e.ray),D(R,a,h),e.results.all.push(R)):a<R.dist&&D(R,a,h)),(null==l.dist||a<l.dist)&&D(l,a,h),e.options.store!==V.MIN&&(null==p.dist||a>p.dist)&&D(p,a,h)}},q=pe;d(q,s,x);const S=O.indices,E=O.vertexAttributes,A={data:E.getField(X.POSITION,T).typedBuffer,size:3,stride:E.stride/4},N=O.indexCount/3;if(n(m)&&N>G){const e=c.renderData;n(e.intersectionData)&&(e.intersectionData=new I(S,0,N,A)),e.intersectionData.intersectRay({r0:ue,r1:q},P)}else ee(ue,q,0,N,S,A,null,m,P)},x=this._rootTiles;if(r(x)){(()=>{const t=this._tileIterator;t.reset(x);const s=e.options.invisibleTerrain;for(;!t.done;){const e=t.next();!(e.visible||s&&e.intersectsClippingArea)||!r(m)&&!e.intersectsRay(i,o,y,v)||f&&this._useStencilForTile(e)?t.skipSubtree():O(e)}})()}}prepareTechnique(e){if(e.bindParameters.slot===W.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&x))return null}else{const t=this.opaque?W.OPAQUE_TERRAIN:W.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}switch(e.output){case L.Color:{this._techniqueConfiguration.hasScreenSpaceReflections=e.bindParameters.ssr.enabled,this._techniqueConfiguration.hasCloudsReflections=r(e.bindParameters.clouds.data),this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=e.bindParameters.ssaoHelper.ready,this._techniqueConfiguration.overlayMode=this._overlayRenderer.isEmpty()?F.Disabled:this._overlayRenderer.hasWater?F.EnabledWithWater:F.Enabled;const t=e.bindParameters.slot===W.OCCLUDED_TERRAIN?O.Occluded:O.ColorAndWater;return this._updateTechnique(L.Color,t===O.Occluded)}case L.Shadow:case L.ShadowExludeHighlight:return this._castShadows&&1===e.bindParameters.lighting.globalFactor?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(L.Shadow,!1)):null;case L.Depth:return this.isTransparent&&this._overlayRenderer.isEmpty()?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(L.Depth,!1));case L.Normal:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(L.Normal,!1);case L.ObjectAndLayerIdColor:return this._updateTechnique(L.ObjectAndLayerIdColor,!1);case L.Highlight:return this.needsHighlight?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(L.Highlight,!1)):null}return null}render(e,t){const i=1===e.bindParameters.lighting.globalFactor;switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case L.Color:{const i=e.bindParameters.slot===W.OCCLUDED_TERRAIN?O.Occluded:O.ColorAndWater;this._renderMaterialPass(e,t,i);break}case L.Shadow:case L.ShadowExludeHighlight:this._castShadows&&i&&this._renderAuxiliaryPass(e,t,O.None);break;case L.Depth:this.isTransparent&&this._overlayRenderer.isEmpty()||this._renderAuxiliaryPass(e,t,O.None);break;case L.Normal:this._renderAuxiliaryPass(e,t,O.None);break;case L.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,O.ObjectAndLayerIdColor);break;case L.Highlight:this.needsHighlight&&(this._renderAuxiliaryPass(e,t,O.Highlight),e.rctx.clearSafe(re.DEPTH_BUFFER_BIT))}this._scaleRangeQueries.hasPendingQueries()&&this.setNeedsRender()}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlaySource=i,r.bindTechnique(t,this._passParameters,e.bindParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this._scaleRangeQueries.prepareQueries(),this.opaque?this._renderPatchGroups(e,t,i):e.offscreenRenderingHelper.renderToTargets((()=>this._renderPatchGroups(e,t,i)),e.offscreenRenderingHelper.tmpColor,e.offscreenRenderingHelper.mainDepth,[0,0,0,0]),this._scaleRangeQueries.processQueries()}_renderAuxiliaryPass(e,t,i){const r=e.rctx;this._passParameters.overlaySource=i,r.bindTechnique(t,this._passParameters,e.bindParameters),this._renderPatchGroupsAuxiliary(e,t,i)}updateTileBackground(e=null){if(n(this._tileRenderer))return;const i=this._tileRenderer;let s=null;if(r(e)){const i=t.toUnitRGBA(e);s=_(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(s),this._allTiles.forAll((e=>i.updateTileTexture(e,R.FADING))),this._techniqueConfiguration.tileBlendInput=i.backgroundIsGrid?k.GridComposite:r(i.backgroundColor)?k.ColorComposite:k.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchGroupsDirty&&(this._highestVisibleLODTile=null,this._rebuildPatchGroups(),this._patchGroupsDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==P.NONE){const e=Array.from(this._patchGroups.values());e.forEach((e=>w(this.renderOrder,e,this._stencilEnabledLayerExtents))),e.sort(((e,t)=>j(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(!n(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(),i=e.renderData;if(!i||e.visible)if(e.rendered){if(i){const r=this._patchGroups.get(i.localOrigin)||new Array;this._patchGroups.set(i.localOrigin,r),r.push(e),(!this._highestVisibleLODTile||e.vlevel>this._highestVisibleLODTile.vlevel)&&(this._highestVisibleLODTile=e),t.skipSubtree()}}else this._numTilesCulled++;else this._numTilesCulled++,t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderPatchGroupsAuxiliary(e,t,i){const r=this._stencilEnabledLayerExtents.length>0;this._patchGroups.forEach((s=>{const n=s[0].renderData.localOrigin;t.program.bindDraw(new J(n),e.bindParameters,this._passParameters);for(let o=0;o<s.length;o++)this._renderPatch(e,t,s[o],se.TRIANGLES,r,i)})),e.rctx.bindVAO(null)}_renderPatchGroups(e,t,i){const s=e.rctx,o=e.bindParameters.camera,a=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=Y(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:o.fovY})}const l=this._stencilEnabledLayerExtents.length>0,h=i===O.Occluded;h&&(a.bindTexture("tex",this._emptyTex),a.setUniform1f("blend",1),a.setUniform4fv("texOffsetAndScale",f));const d=r(this._tileRenderer)&&r(this._tileRenderer.backgroundColor)?this._tileRenderer.backgroundColor:p;this._techniqueConfiguration.tileBlendInput===k.ColorComposite&&a.setUniform3fv("backgroundColor",d);const c=this.wireframe?se.LINES:se.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&a.bindTexture("texNext",this._emptyTex),this._patchGroups.forEach((s=>{const o=s[0].renderData.localOrigin;t.program.bindDraw(new J(o),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(let d=0;d<s.length;d++){const o=s[d],u=o.renderData.textureReference;if(!n(u)){if(!h){this._scaleRangeQueries.scaleQueriesForTile(o),a.setUniform4fv("texOffsetAndScale",u.offsetAndScale),a.bindTexture("tex",u.texture.texture);const e=o.renderData.textureFadeFactor,t=e<1?o.renderData.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&r(t)&&e<1?(a.setUniform1f("fadeFactor",e),a.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),a.setUniform3fv("nextTexOpacities",t.opacities),a.bindTexture("texNext",t.texture.texture)):a.setUniform1f("fadeFactor",1),o.renderData.textureIsFading&&this.setNeedsRender(),a.setUniform3fv("textureOpacities",u.opacities)}this._renderPatch(e,t,o,c,l,i),o.renderOrder=this._numTilesRendered,this._numTilesRendered++}}})),s.bindVAO(null)}_renderPatch(e,t,i,r,s,o){const a=i.renderData,l=a.vao,h=l.indexBuffer;if(n(h))return void(S&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const d=t.program;o!==O.None&&this._bindOverlayPatchData(d,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),t.bindPipelineState(e.rctx,e.bindParameters.slot));const c=a.geometryInfo.indexCount;e.rctx.bindVAO(l),d.assertCompatibleVertexAttributeLocations(l),e.rctx.drawElements(r,c,h.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,e===L.Color&&(this._techniqueConfiguration.atmosphere=this._isGlobal&&this._velvetOverground),this._techniqueConfiguration.renderOccluded=t,this._techniqueConfiguration.stencilEnabled=!1,this._shaderTechnique=this._techniqueRepository.releaseAndAcquire(te,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this._tileRenderer}}};e([a({constructOnly:!0})],le.prototype,"_overlayRenderer",void 0),e([a({constructOnly:!0})],le.prototype,"_stage",void 0),e([a({readOnly:!0})],le.prototype,"_isGlobal",null),e([a({constructOnly:!0})],le.prototype,"_allTiles",void 0),e([a({constructOnly:!0})],le.prototype,"_ellipsoidRadius",void 0),e([a({value:!1})],le.prototype,"renderingDisabled",null),e([a()],le.prototype,"renderPatchBorders",null),e([a()],le.prototype,"visualizeNormals",null),e([a()],le.prototype,"cullBackFaces",null),e([a({value:P.FRONT_TO_BACK})],le.prototype,"renderOrder",null),e([a()],le.prototype,"wireframe",null),le=e([l("esri.views.3d.terrain.TerrainRenderer")],le);const he=le,de=g(),ce=g(),ue=g(),pe=g();export{he as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{isSome as r,disposeMaybe as s,isNone as n}from"../../../core/maybe.js";import a from"../../../core/ObjectPool.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{I as h}from"../../../chunks/mat4f64.js";import{b as d,s as c,e as u}from"../../../chunks/vec3.js";import{Z as p,f as _,c as g}from"../../../chunks/vec3f64.js";import{Z as f}from"../../../chunks/vec4f64.js";import{create as m,set as b}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as T}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as y}from"../../ViewingMode.js";import{TextureUpdate as R}from"./interfaces.js";import{LayerClass as v}from"./LayerClass.js";import{OverlaySource as O}from"./Overlay.js";import{overlayRenderOccludedFlag as C}from"./OverlayRenderer.js";import{clearCaches as x}from"./PatchGeometry.js";import{PatchRenderData as D}from"./PatchRenderData.js";import{RenderOrder as P}from"./RenderOrder.js";import{ScaleRangeQueries as q}from"./ScaleRangeQueries.js";import{ENABLE_TERRAIN_INTERNAL_CHECKS as S}from"./terrainUtils.js";import{TileRenderer as E}from"./TileRenderer.js";import{TileUpdate as A}from"./TileUpdate.js";import{IteratorPreorder as N,sortTiles as w,compareTiles as j}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as G,ComponentIntersectionData as I}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as L}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as F}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as U}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as k}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{RenderRequestType as B}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as z}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as M}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as H,StoreResults as V}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as Q}from"../webgl-engine/lib/Material.js";import{RenderSlot as W}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as Y}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as X}from"../webgl-engine/lib/VertexAttribute.js";import{TERRAIN_ID as Z,getVerticalOffsetTerrain as K}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as J}from"../webgl-engine/materials/DrawParameters.js";import{intersectAabbInvDirBefore as $,intersectTriangles as ee}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as te}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ie}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{ClearBufferBit as re,PrimitiveType as se}from"../../webgl/enums.js";const ne=7,ae=10,oe=m();let le=class extends i{constructor(e){super(e),this.type=H.TERRAIN,this.isGround=!0,this._tileSize=256,this._techniqueConfiguration=new ie,this._passParameters=new U,this._rctx=null,this._isTransparent=!1,this._scaleRangeQueries=new q,this._renderDataPool=new a(D),this._patchGroups=new Map,this._patchGroupsDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new N,this._highestVisibleLODTile=null,this._visible=!0,this._opaque=!0,this._velvetOverground=!0,this._castShadows=!0,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.needsHighlight=!1,this.renderOccludedFlags=Q.Occlude}get _isGlobal(){return this._stage.viewingMode===y.Global}get shading(){return this._techniqueConfiguration.shading}set shading(e){this._techniqueConfiguration.shading=e}initialize(){const e=[W.OPAQUE_TERRAIN,W.TRANSPARENT_TERRAIN,W.OCCLUDED_TERRAIN];this._stage.addRenderPlugin(e,this)}destroy(){this._stage.removeRenderPlugin(this),x()}get canRender(){return this._visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set opaque(e){this._opaque!==e&&(this._opaque=e,this.setNeedsRender())}get opaque(){return this._opaque&&!this._techniqueConfiguration.hasSlicePlane}get needsLinearDepth(){return this._overlayRenderer.hasWater}set isTransparent(e){this._isTransparent!==e&&(this._isTransparent=e,this.setNeedsRender())}get isTransparent(){return this._isTransparent}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()}set velvetOverground(e){this._velvetOverground!==e&&(this._velvetOverground=e,this.setNeedsRender())}get layerUid(){return Z}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())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setNeedsHighlight(e){this.needsHighlight=e,this.setNeedsRender()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?C:Q.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,r(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,A.TEXTURE_FADING)}queryVisibleLevelRange(e,t,i,r){this._scaleRangeQueries.queryVisibleLevelRange(e,t,i,r),this.setNeedsRender()}updateTileTexture(e,t){r(this._tileRenderer)&&(this._tileRenderer.updateTileTexture(e,t===A.TEXTURE_FADING?R.FADING:R.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[v.ELEVATION])i.pendingUpdates&=~A.GEOMETRY;e.resetPendingUpdate(A.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=ae-ne,i=Math.max(0,Math.floor((e.level-t)/ne)*ne);if(this._isGlobal&&0===i)return p;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}setVisibility(e){this._visible=e,this.setDirty()}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=B.UPDATE){this._patchGroupsDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=B.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=B.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._rctx=e.renderContext.rctx,this._techniqueRepository=e.shaderTechniqueRepository,this._tileRenderer=new E(this._rctx,this._tileSize,this._techniqueRepository),this.updateTileBackground(),this._emptyTex=z(this._rctx)}uninitializeRenderContext(){this._emptyTex=s(this._emptyTex),this._tileRenderer=s(this._tileRenderer)}intersect(e,t,i,s){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&!this._opaque)return;const a=de,o=ce;d(a,s,i),c(o,1/a[0],1/a[1],1/a[2]);const l=e.results.min,p=e.results.max,_=e.results.ground,g=e.options.store===V.MIN,f=!!e.results.ground.target,m=K(e.verticalOffset),y=e.tolerance;let R,v=g&&r(l.dist)?l.dist:1/0;const O=c=>{const f=c.renderData;if(!f?.vao)return;const O=f.geometryInfo;b(oe,O.boundingBox);const C=f.localOrigin;r(m)&&(m.localOrigin=C,m.applyToAabb(oe));const x=oe;if(ue[0]=i[0]-C[0],ue[1]=i[1]-C[1],ue[2]=i[2]-C[2],!$(x,ue,o,y,v))return;const D=(e,t,i)=>{e.set(this.type,c,t,i,h),v=g&&r(l.dist)?l.dist:1/0},P=(o,h)=>{if(r(h)&&o>=0&&(e.options.backfacesTerrain||u(h,a)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(i,s,o))){if((null==_.dist||o<_.dist)&&D(_,o,h),e.options.isFiltered)return;e.options.store===V.ALL&&(n(R)?(R=M(e.ray),D(R,o,h),e.results.all.push(R)):o<R.dist&&D(R,o,h)),(null==l.dist||o<l.dist)&&D(l,o,h),e.options.store!==V.MIN&&(null==p.dist||o>p.dist)&&D(p,o,h)}},q=pe;d(q,s,C);const S=O.indices,E=O.vertexAttributes,A={data:E.getField(X.POSITION,T).typedBuffer,size:3,stride:E.stride/4},N=O.indexCount/3;if(n(m)&&N>G){const e=c.renderData;n(e.intersectionData)&&(e.intersectionData=new I(S,0,N,A)),e.intersectionData.intersectRay({r0:ue,r1:q},P)}else ee(ue,q,0,N,S,A,null,m,P)},C=this._rootTiles;if(r(C)){(()=>{const t=this._tileIterator;t.reset(C);const s=e.options.invisibleTerrain;for(;!t.done;){const e=t.next();!(e.visible||s&&e.intersectsClippingArea)||!r(m)&&!e.intersectsRay(i,a,y,v)||f&&this._useStencilForTile(e)?t.skipSubtree():O(e)}})()}}prepareTechnique(e){if(e.bindParameters.slot===W.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&C))return null}else{const t=this.opaque?W.OPAQUE_TERRAIN:W.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}switch(e.output){case L.Color:{this._techniqueConfiguration.hasScreenSpaceReflections=e.bindParameters.ssr.enabled,this._techniqueConfiguration.hasCloudsReflections=r(e.bindParameters.weatherParameter.cloudsFadingComposition.data),this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=e.bindParameters.ssaoHelper.ready,this._techniqueConfiguration.overlayMode=this._overlayRenderer.isEmpty()?F.Disabled:this._overlayRenderer.hasWater?F.EnabledWithWater:F.Enabled;const t=e.bindParameters.slot===W.OCCLUDED_TERRAIN?O.Occluded:O.ColorAndWater;return this._updateTechnique(L.Color,t===O.Occluded)}case L.Shadow:case L.ShadowExludeHighlight:return this._castShadows&&1===e.bindParameters.lighting.globalFactor?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(L.Shadow,!1)):null;case L.Depth:return this.isTransparent&&this._overlayRenderer.isEmpty()?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(L.Depth,!1));case L.Normal:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(L.Normal,!1);case L.ObjectAndLayerIdColor:return this._updateTechnique(L.ObjectAndLayerIdColor,!1);case L.Highlight:return this.needsHighlight?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(L.Highlight,!1)):null}return null}render(e,t){const i=1===e.bindParameters.lighting.globalFactor;switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case L.Color:{const i=e.bindParameters.slot===W.OCCLUDED_TERRAIN?O.Occluded:O.ColorAndWater;this._renderMaterialPass(e,t,i);break}case L.Shadow:case L.ShadowExludeHighlight:this._castShadows&&i&&this._renderAuxiliaryPass(e,t,O.None);break;case L.Depth:this.isTransparent&&this._overlayRenderer.isEmpty()||this._renderAuxiliaryPass(e,t,O.None);break;case L.Normal:this._renderAuxiliaryPass(e,t,O.None);break;case L.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,O.ObjectAndLayerIdColor);break;case L.Highlight:this.needsHighlight&&(this._renderAuxiliaryPass(e,t,O.Highlight),e.rctx.clearSafe(re.DEPTH_BUFFER_BIT))}this._scaleRangeQueries.hasPendingQueries()&&this.setNeedsRender()}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlaySource=i,r.bindTechnique(t,this._passParameters,e.bindParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this._scaleRangeQueries.prepareQueries(),this.opaque?this._renderPatchGroups(e,t,i):e.offscreenRenderingHelper.renderToTargets((()=>this._renderPatchGroups(e,t,i)),e.offscreenRenderingHelper.tmpColor,e.offscreenRenderingHelper.mainDepth,[0,0,0,0]),this._scaleRangeQueries.processQueries()}_renderAuxiliaryPass(e,t,i){const r=e.rctx;this._passParameters.overlaySource=i,r.bindTechnique(t,this._passParameters,e.bindParameters),this._renderPatchGroupsAuxiliary(e,t,i)}updateTileBackground(e=null){if(n(this._tileRenderer))return;const i=this._tileRenderer;let s=null;if(r(e)){const i=t.toUnitRGBA(e);s=_(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(s),this._allTiles.forAll((e=>i.updateTileTexture(e,R.FADING))),this._techniqueConfiguration.tileBlendInput=i.backgroundIsGrid?k.GridComposite:r(i.backgroundColor)?k.ColorComposite:k.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchGroupsDirty&&(this._highestVisibleLODTile=null,this._rebuildPatchGroups(),this._patchGroupsDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==P.NONE){const e=Array.from(this._patchGroups.values());e.forEach((e=>w(this.renderOrder,e,this._stencilEnabledLayerExtents))),e.sort(((e,t)=>j(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(!n(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(),i=e.renderData;if(!i||e.visible)if(e.rendered){if(i){const r=this._patchGroups.get(i.localOrigin)||new Array;this._patchGroups.set(i.localOrigin,r),r.push(e),(!this._highestVisibleLODTile||e.vlevel>this._highestVisibleLODTile.vlevel)&&(this._highestVisibleLODTile=e),t.skipSubtree()}}else this._numTilesCulled++;else this._numTilesCulled++,t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderPatchGroupsAuxiliary(e,t,i){const r=this._stencilEnabledLayerExtents.length>0;this._patchGroups.forEach((s=>{const n=s[0].renderData.localOrigin;t.program.bindDraw(new J(n),e.bindParameters,this._passParameters);for(let a=0;a<s.length;a++)this._renderPatch(e,t,s[a],se.TRIANGLES,r,i)})),e.rctx.bindVAO(null)}_renderPatchGroups(e,t,i){const s=e.rctx,a=e.bindParameters.camera,o=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=Y(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:a.fovY})}const l=this._stencilEnabledLayerExtents.length>0,h=i===O.Occluded;h&&(o.bindTexture("tex",this._emptyTex),o.setUniform1f("blend",1),o.setUniform4fv("texOffsetAndScale",f));const d=r(this._tileRenderer)&&r(this._tileRenderer.backgroundColor)?this._tileRenderer.backgroundColor:p;this._techniqueConfiguration.tileBlendInput===k.ColorComposite&&o.setUniform3fv("backgroundColor",d);const c=this.wireframe?se.LINES:se.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&o.bindTexture("texNext",this._emptyTex),this._patchGroups.forEach((s=>{const a=s[0].renderData.localOrigin;t.program.bindDraw(new J(a),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(let d=0;d<s.length;d++){const a=s[d],u=a.renderData.textureReference;if(!n(u)){if(!h){this._scaleRangeQueries.scaleQueriesForTile(a),o.setUniform4fv("texOffsetAndScale",u.offsetAndScale),o.bindTexture("tex",u.texture.texture);const e=a.renderData.textureFadeFactor,t=e<1?a.renderData.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&r(t)&&e<1?(o.setUniform1f("fadeFactor",e),o.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),o.setUniform3fv("nextTexOpacities",t.opacities),o.bindTexture("texNext",t.texture.texture)):o.setUniform1f("fadeFactor",1),a.renderData.textureIsFading&&this.setNeedsRender(),o.setUniform3fv("textureOpacities",u.opacities)}this._renderPatch(e,t,a,c,l,i),a.renderOrder=this._numTilesRendered,this._numTilesRendered++}}})),s.bindVAO(null)}_renderPatch(e,t,i,r,s,a){const o=i.renderData,l=o.vao,h=l.indexBuffer;if(n(h))return void(S&&console.error("Rendered tile with no indices: ",i.lij," : ",o));const d=t.program;a!==O.None&&this._bindOverlayPatchData(d,o.overlay),s&&(t.useStencil=this._useStencilForTile(i),t.bindPipelineState(e.rctx,e.bindParameters.slot));const c=o.geometryInfo.indexCount;e.rctx.bindVAO(l),d.assertCompatibleVertexAttributeLocations(l),e.rctx.drawElements(r,c,h.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,e===L.Color&&(this._techniqueConfiguration.atmosphere=this._isGlobal&&this._velvetOverground),this._techniqueConfiguration.renderOccluded=t,this._techniqueConfiguration.stencilEnabled=!1,this._shaderTechnique=this._techniqueRepository.releaseAndAcquire(te,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this._tileRenderer}}};e([o({constructOnly:!0})],le.prototype,"_overlayRenderer",void 0),e([o({constructOnly:!0})],le.prototype,"_stage",void 0),e([o({readOnly:!0})],le.prototype,"_isGlobal",null),e([o({constructOnly:!0})],le.prototype,"_allTiles",void 0),e([o({constructOnly:!0})],le.prototype,"_ellipsoidRadius",void 0),e([o({value:!1})],le.prototype,"renderingDisabled",null),e([o()],le.prototype,"renderPatchBorders",null),e([o()],le.prototype,"visualizeNormals",null),e([o()],le.prototype,"cullBackFaces",null),e([o({value:P.FRONT_TO_BACK})],le.prototype,"renderOrder",null),e([o()],le.prototype,"wireframe",null),le=e([l("esri.views.3d.terrain.TerrainRenderer")],le);const he=le,de=g(),ce=g(),ue=g(),pe=g();export{he as default};
|