@arcgis/core 4.34.0-next.25 → 4.34.0-next.26
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/applications/Components/imageryUtils.d.ts +3 -0
- package/applications/Components/imageryUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/03ee4d63aa8de44958ab.js +1 -0
- package/assets/esri/core/workers/chunks/{453e536f566d80a9863b.js → 21a8ae88cfa644a30058.js} +1 -1
- package/assets/esri/core/workers/chunks/2c2128201c80a1b1aeb6.js +1 -0
- package/assets/esri/core/workers/chunks/{5a9b27f2b343cd5b0852.js → 2d3679289b34b7da6bf4.js} +1 -1
- package/assets/esri/core/workers/chunks/{07613c89255bdab6b7c6.js → 4de6c479df609398dee0.js} +1 -1
- package/assets/esri/core/workers/chunks/6b6ab092f578b20c8e56.js +1 -0
- package/assets/esri/core/workers/chunks/7359652de3d7f969a712.js +1 -0
- package/assets/esri/core/workers/chunks/{d81260303a11d3fbe940.js → 7b736885278af9676f3a.js} +1 -1
- package/assets/esri/core/workers/chunks/8161b0a674ef9bf536a2.js +1 -0
- package/assets/esri/core/workers/chunks/908ec8165d567f052155.js +1 -0
- package/assets/esri/core/workers/chunks/{97324f030738fc0d456b.js → 9182fe69b9863e1de714.js} +1 -1
- package/assets/esri/core/workers/chunks/91e6030a2845f5404e82.js +1 -0
- package/assets/esri/core/workers/chunks/9d85e20a3d6ca1161c26.js +1 -0
- package/assets/esri/core/workers/chunks/a19689f8d1ef48fd2159.js +1 -0
- package/assets/esri/core/workers/chunks/a8f37681f8f6feebbd50.js +1 -0
- package/assets/esri/core/workers/chunks/{92737419b66894799a34.js → aeedc543320ee307d14a.js} +1 -1
- package/assets/esri/core/workers/chunks/{29ae5723fa35aa73ff9b.js → b3794c513a13facc98d3.js} +1 -1
- package/assets/esri/core/workers/chunks/{9a78cb291c966f8ddda6.js → c6c0263fbcf2ca245c1b.js} +2 -2
- package/assets/esri/core/workers/chunks/c6c3e703b18e1bb7113a.js +1 -0
- package/assets/esri/core/workers/chunks/f5ee10a8afb7f70833bb.js +346 -0
- package/assets/esri/core/workers/chunks/{4f14e78d0560050c1a81.js → fa7243f080bcf6444929.js} +1 -1
- package/config.js +1 -1
- package/core/PooledArray.js +1 -1
- package/core/heapSort.js +5 -0
- package/core/mathUtils.js +1 -1
- package/interfaces.d.ts +55 -0
- package/kernel.js +1 -1
- package/layers/support/RasterJobHandler.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/rasterDatasets/pixelReader.js +1 -1
- package/layers/support/rasterFunctions/pixelUtils.js +1 -1
- package/layers/support/rasterFunctions/stretchUtils.js +1 -1
- package/package.json +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/support/spikeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/ParentChildStage.js +1 -1
- package/views/2d/engine/webgl/FeatureTile.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/tiling/FeatureTileSubscriptionManager.js +1 -1
- package/views/3d/layers/graphics/DeconflictAABR.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- 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/terrain/Overlay.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/assets/esri/core/workers/chunks/4b68b6985430c42316b7.js +0 -1
- package/assets/esri/core/workers/chunks/60aeb7a5ccd8bc71be02.js +0 -1
- package/assets/esri/core/workers/chunks/6a1cf6b0ffdf6080b5c4.js +0 -1
- package/assets/esri/core/workers/chunks/7d0c4e1518a6a63a3f87.js +0 -1
- package/assets/esri/core/workers/chunks/c19421707257fc93acb9.js +0 -1
- package/assets/esri/core/workers/chunks/c56b05a8be498b6f3ee7.js +0 -1
- package/assets/esri/core/workers/chunks/cafcb46d723d38b377a9.js +0 -1
- package/assets/esri/core/workers/chunks/cb81d448ed6bad205346.js +0 -1
- package/assets/esri/core/workers/chunks/d08a523b548e892e1222.js +0 -1
- package/assets/esri/core/workers/chunks/d9a23fb0c6c936d5e8ec.js +0 -1
- package/assets/esri/core/workers/chunks/e8e993fb8697b8f3e0c7.js +0 -346
- package/assets/esri/core/workers/chunks/fb785bc38323cce6e549.js +0 -1
- package/core/HeapSort.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import s from"./TileKey.js";function e(s,e){const i=new Set;for(const t of s instanceof Set?s.values():s.keys())e.has(t)||i.add(t);return i}class i{constructor(s,e,i){const t=i?s.getTileCoverage(i,0,!0,"closest"):null,
|
|
5
|
+
import s from"./TileKey.js";function e(s,e){const i=new Set;for(const t of s instanceof Set?s.values():s.keys())e.has(t)||i.add(t);return i}class i{constructor(s,e,i){this.target=new Map,this.previous=new Map;const t=i?s.getTileCoverage(i,0,!0,"closest"):null,r=s.getTileCoverage(e,0,!0,"closest");if(this.target.clear(),this.previous.clear(),t)for(const o of t.keys())this.previous.set(o.id,o);if(r)for(const o of r.keys())this.target.set(o.id,o)}*values(){yield*this.target.values(),yield*this.previous.values()}*keys(){yield*this.target.keys(),yield*this.previous.keys()}}class t{constructor(s){this.version=s}}class r{constructor(s){this._subscriptions=new Map,this._visible=new Set,this._version=0,this._strategy="eager",this._config=s}destroy(){}get coverage(){return this._coverage}get subscriptions(){return new Set(this._subscriptions.keys())}setVisibilityStrategy(s){this._strategy=s}suspend(){this._suspendedCoverage=this._coverage,this._coverage=null,this._updateSubscriptions()}resume(){null==this._coverage&&(this._coverage=this._suspendedCoverage,this._suspendedCoverage=null,this._updateSubscriptions())}update(s,e){return this._version=(this._version+1)%Number.MAX_SAFE_INTEGER,this._coverage=new i(this._config.tileInfoView,s,e),this._updateSubscriptions(),new Set(this._visible)}updateVisibility(){const s=this._updateVisibility();return this._visible=s,this._visible}_updateSubscriptions(){if(!this._coverage)return;const s=this._updateVisibility(),i=new Set(this._coverage.keys()),r=e(this._subscriptions,s),o=e(i,this._subscriptions),n=e(r,i);this._visible=s;for(const e of o.values())this._subscriptions.set(e,new t(this._version));for(const e of n.values())this._subscriptions.delete(e);(o.size||n.size)&&this._sendUpdateSubscriptions(o,n)}_sendUpdateSubscriptions(s,e){const i=Array.from(s.values()).map(s=>({tileId:s,version:this._subscriptions.get(s).version}));this._config.updateSubscriptions({subscribe:i,unsubscribe:Array.from(e.values())})}_updateVisibility(){if(!this._coverage)return new Set;switch(this._strategy){case"eager":return this._updateVisibilityEager(this._coverage);case"target-defer":return this._updateVisibilityTargetDefer(this._coverage)}}_updateVisibilityEager(s){const e=new Set;for(const i of s.values()){if(this._config.isDone(i)){e.add(i.id);continue}if(this._addVisibleParent(e,i))continue;this._addVisibleChildren(e,i)||e.add(i.id)}return e}_updateVisibilityTargetDefer(s){const e=new Set,i=Array.from(s.target.values());if(!i.some(s=>!this._config.isDone(s))){for(const s of i)e.add(s.id);return e}for(const t of s.values()){if(this._addVisibleParent(e,t))continue;this._addVisibleChildren(e,t)||e.add(t.id)}return e}_addVisibleParent(e,i){let t=!1;for(const r of this._visible.values()){new s(r).containsChild(i)&&(e.add(r),t=!0)}return t}_addVisibleChildren(e,i){let t=!1;for(const r of this._visible.values()){const o=new s(r);i.containsChild(o)&&(e.add(r),t=!0)}return t}}export{r as FeatureTileSubscriptionManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import i
|
|
5
|
+
import{iterableSort as i}from"../../../../core/heapSort.js";import s from"../../../../core/PooledArray.js";import{intersects as t}from"../../../../geometry/support/aaBoundingRect.js";import{drawPoly as n,drawAccelerationStruct as c}from"./deconflictorDebug.js";class e{constructor(i,s,t){this._setVisibility=i,this._canConflict=s,this._compare=t,this.done=!1,this._items=new Array,this._accBinsNumX=15,this._accBinsNumY=20,this._accBinsSizeX=0,this._accBinsSizeY=0,this._accBins=null}destroy(){this._generator=null,this._accBins=null,this._items.length=0}reset(i,s){this._initBins(i,s),this._items.length=0,this.done=!1,this._generator=null}add(i){this._items.push(i)}run(i){this._generator??=this._run(i),this.done=!!this._generator.next(i).done}*_run(i){yield*this._sort(i),yield*this._deconflict(i),c(()=>({bins:this._accBins,numX:this._accBinsNumX,numY:this._accBinsNumY,sizeX:this._accBinsSizeX,sizeY:this._accBinsSizeY,numTests:0,numVisible:this._items.length}))}*_sort(s){for(const t of i(this._items,0,this._items.length,this._compare))s.madeProgress(),s.done&&(s=yield)}_isConflicted(i){let s=!0;return this._forEachBin(i.aabr,n=>(s=!1,n.some(s=>this._canConflict(s,i)&&t(s.aabr,i.aabr))))||s}*_deconflict(i){for(const s of this._items){i.done&&(i=yield);const t=!this._isConflicted(s);this._setVisibility(s,t),n(s.aabr,t),t&&this._addToBins(s),i.madeProgress()}}_initBins(i,t){if(null==this._accBins){this._accBins=[];for(let i=0;i<this._accBinsNumX;i++){this._accBins.push([]);const i=this._accBins[this._accBins.length-1];for(let t=0;t<this._accBinsNumY;t++)i.push(new s)}}else for(let s=0;s<this._accBinsNumX;s++)for(let i=0;i<this._accBinsNumY;i++)this._accBins[s][i].clear();this._accBinsSizeX=i/this._accBinsNumX,this._accBinsSizeY=t/this._accBinsNumY}_addToBins(i){this._forEachBin(i.aabr,s=>s.push(i))}_forEachBin(i,s){if(!this._accBins)return!1;const t=Math.max(Math.floor(i[0]/this._accBinsSizeX),0),n=Math.max(Math.floor(i[1]/this._accBinsSizeY),0),c=Math.min(Math.floor(i[2]/this._accBinsSizeX),this._accBinsNumX-1),e=Math.min(Math.floor(i[3]/this._accBinsSizeY),this._accBinsNumY-1);for(let h=t;h<=c;h++)for(let i=n;i<=e;i++)if(s(this._accBins[h][i]))return!0;return!1}}export{e as DeconflictAABR};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{d as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as l,create as c,intersectsClippingArea as h,empty as p,expandWithAABB as m}from"../../../../geometry/support/aaBoundingBox.js";import{empty as u,create as d,expandPointInPlace as g}from"../../../../geometry/support/aaBoundingRect.js";import{newFloatArray as y,floatSubArray as f}from"../../../../geometry/support/FloatArray.js";import{perVertexElevationAligner as v}from"./ElevationAligners.js";import{SymbolUpdateType as x,elevationModeChangeUpdateType as _,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as w}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as D}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as j}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as S,createWaterGeometry as C,PolygonCreationDataBase as G}from"./polygonUtils.js";import{geometryToRenderInfo as E,geometryToRenderInfoDraped as L}from"../../support/renderInfoUtils/polygon.js";import{Object3D as A}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as P,WaterMaterial as T}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as R}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const U=["polyline","polygon","extent"];class B extends j{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:x.RECREATE,staysOnTheGround:x.NONE,onTheGroundChanged:x.RECREATE}}constructor(e,t,r,o){super(e,t,r,o)}async doLoad(){}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const t=new P,r=e.toUnitRGBA(this.symbolLayer.color);r[3]*=this._getLayerOpacity(),t.color=r,t.transparent=r[3]<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?I(this.symbolLayer.waveDirection):i(0,0);const o=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,n=R[o];t.waveStrength=n.waveStrength,t.waveTextureRepeat=n.textureRepeat,t.waveVelocity=n.waveVelocity,t.flowStrength=n.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new T(t,this._context)}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this.symbolLayer.color.a*this._getLayerOpacity(),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerElevationInfoChanged(e,t,r){const o=this._elevationContext.mode,i=_(B.elevationModeChangeTypes,r,o);if(i!==x.UPDATE)return i;const n=b(o);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>n)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}get needsDrivenTransparentPass(){return!1}_createAs3DShape(e,t,r){const o=S(e.geometry);if(null==o)return null;const i=E(o,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=i.position.length/3,s=y(2*n);M(s,i.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new N(i,s,this._context.layerViewUid,e.uid);if(a.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,o.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new A({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new D(this,l,null,v,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=b(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,o=e.uvCoords;for(const{count:i,index:n,position:s,mapPositions:a,holeIndices:c}of t){if(null!=this._context.clippingExtent&&(l(a,k),!h(k,this._context.clippingExtent)))continue;const t=r(a,c,3);if(0===t.length)continue;const p=f(o,
|
|
5
|
+
import e from"../../../../Color.js";import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{d as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as l,create as c,intersectsClippingArea as h,empty as p,expandWithAABB as m}from"../../../../geometry/support/aaBoundingBox.js";import{empty as u,create as d,expandPointInPlace as g}from"../../../../geometry/support/aaBoundingRect.js";import{newFloatArray as y,floatSubArray as f}from"../../../../geometry/support/FloatArray.js";import{perVertexElevationAligner as v}from"./ElevationAligners.js";import{SymbolUpdateType as x,elevationModeChangeUpdateType as _,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as w}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as D}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as j}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as S,createWaterGeometry as C,PolygonCreationDataBase as G}from"./polygonUtils.js";import{geometryToRenderInfo as E,geometryToRenderInfoDraped as L}from"../../support/renderInfoUtils/polygon.js";import{Object3D as A}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as P,WaterMaterial as T}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as R}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const U=["polyline","polygon","extent"];class B extends j{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:x.RECREATE,staysOnTheGround:x.NONE,onTheGroundChanged:x.RECREATE}}constructor(e,t,r,o){super(e,t,r,o)}async doLoad(){}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const t=new P,r=e.toUnitRGBA(this.symbolLayer.color);r[3]*=this._getLayerOpacity(),t.color=r,t.transparent=r[3]<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?I(this.symbolLayer.waveDirection):i(0,0);const o=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,n=R[o];t.waveStrength=n.waveStrength,t.waveTextureRepeat=n.textureRepeat,t.waveVelocity=n.waveVelocity,t.flowStrength=n.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new T(t,this._context)}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this.symbolLayer.color.a*this._getLayerOpacity(),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerElevationInfoChanged(e,t,r){const o=this._elevationContext.mode,i=_(B.elevationModeChangeTypes,r,o);if(i!==x.UPDATE)return i;const n=b(o);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>n)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}get needsDrivenTransparentPass(){return!1}_createAs3DShape(e,t,r){const o=S(e.geometry);if(null==o)return null;const i=E(o,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=i.position.length/3,s=y(2*n);M(s,i.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new N(i,s,this._context.layerViewUid,e.uid);if(a.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,o.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new A({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new D(this,l,null,v,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=b(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,o=e.uvCoords;for(const{count:i,index:n,position:s,mapPositions:a,holeIndices:c}of t){if(null!=this._context.clippingExtent&&(l(a,k),!h(k,this._context.clippingExtent)))continue;const t=r(a,c,3);if(0===t.length)continue;const p=f(o,2*n,2*i),m=C({material:this._materials[0],indices:t,mapPositions:a,attributeData:{position:s,uv0:p}},e.objectAndLayerIdColor);e.outGeometries.push(m)}}_createAsOverlay(e){const t=S(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=L(t,this._context.overlaySR),o=r.position.length/3,i=y(2*o);M(i,r.position,o,this._context.overlaySR);const n=new F(r,i,this._context.layerViewUid,e.uid);return n.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=p(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new w(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const t=e.uvCoords,o=e.renderData.polygons;for(const{position:i,holeIndices:n,index:s,count:a}of o){if(l(i,k),!h(k,this._context.clippingExtent))continue;m(e.outBoundingBox,k);const o=r(i,n,3);if(0===o.length)continue;const c=f(t,2*s,2*a),p=C({material:this._materials[0],indices:o,attributeData:{position:i,uv0:c}},e.objectAndLayerIdColor);e.outGeometries.push(new O(p,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function I(e){const t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function M(e,r,i,n){const a=t(n);u(W);for(let t=0;t<i;t++)o(z,r[3*t],r[3*t+1]),g(W,z);s(W,W,a);const l=W[0]%B.unitSizeOfTexture,c=W[1]%B.unitSizeOfTexture;V[0]=W[0]-l,V[1]=W[1]-c;for(let t=0;t<i;t++)e[2*t]=(r[3*t]*a-V[0])/B.unitSizeOfTexture,e[2*t+1]=(r[3*t+1]*a-V[1])/B.unitSizeOfTexture}const V=n(),W=d(),z=n(),k=c();class N extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}class F extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}export{B as Graphics3DWaterSymbolLayer,I as headingVectorFromAngle};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as t,everyMap as s}from"../../../core/MapUtils.js";import{disposeMaybe as i}from"../../../core/maybe.js";import n from"../../../core/PooledArray.js";import{watch as o,on as a,syncAndInitial as h,initial as l}from"../../../core/reactiveUtils.js";import{someSet as d}from"../../../core/SetUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{ortho as p,fromTranslation as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{i as _}from"../../../chunks/vec32.js";import{ones as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DrapeTargetType as f,DrapeSourceType as y,DrapedRenderGroup as R}from"../layers/interfaces.js";import{debugFlags as b}from"../support/debugFlags.js";import{OverlayIndex as T}from"./interfaces.js";import{Overlay as x}from"./Overlay.js";import{OverlayContent as D}from"./OverlayContent.js";import{OverlayRenderTargets as w}from"./OverlayRenderTargets.js";import v from"../webgl/RenderCamera.js";import{ShaderOutput as O}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as C}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as S}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as E}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as P,renderHighlightBuffer as j}from"../webgl-engine/effects/highlight/Highlight.js";import{RenderRequestType as A}from"../webgl-engine/lib/basicInterfaces.js";import{GLMaterialRepository as M}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as W}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderOccludedFlag as I}from"../webgl-engine/lib/Material.js";import{OITPass as N}from"../webgl-engine/lib/OITPass.js";import{RenderContext as q,defaultRenderOccludedMask as L}from"../webgl-engine/lib/RenderContext.js";import{RenderSlot as V}from"../webgl-engine/lib/RenderSlot.js";import{ShadowMap as F}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as H}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as U}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{Update as k}from"../webgl-engine/lib/Update.js";import{UpdatePolicy as G}from"../webgl-engine/lib/UpdatePolicy.js";import{AmbientLight as B}from"../webgl-engine/lighting/Lightsources.js";import{O as z}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as Y}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as X,noBudget as K}from"../../support/Scheduler.js";import{FramebufferBit as J,TextureSamplingMode as Q}from"../../webgl/enums.js";import{Texture as Z}from"../../webgl/Texture.js";import{TextureDescriptor as $}from"../../webgl/TextureDescriptor.js";let ee=class extends E{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new z,this.hasHighlights=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new n,this._passParameters=new S,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new v,this.events=new r,this.longitudeCyclical=null,this.produces=new Map([[V.DRAPED_MATERIAL,e=>e!==O.Highlight||this.hasHighlights],[V.DRAPED_WATER,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1}initialize(){const e=this._view,r=e.stage,t=r.renderer.fboCache,{waterTextures:s,techniques:i}=r.renderView;this._renderContext=new q(this._rctx,new F(t,e.state.viewingMode),i),this.addHandles([o(()=>s.updating,()=>this.events.emit("content-changed"),h),o(()=>this.spatialReference,e=>this._localOriginFactory=new W(e),h),a(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),o(()=>P(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,l),o(()=>e.state.highlights,r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap},l),e.resourceController.scheduler.registerTask(X.OVERLAY_RENDERER,this)]);const{_bindParameters:n,_camera:d}=this;d.near=1,d.far=1e4,d.relativeElevation=null,n.slot=V.DRAPED_MATERIAL,n.mainDepth=null,n.camera=d,n.oitPass=N.NONE,n.updateLighting([new B(m())],0,0,k.Immediate)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=i(this._passParameters.texture),this.disposeOverlays(),this._renderContext=null,this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new M(this._view.stage.renderView.textures,this._techniques,()=>{this.notifyChange("rendersOccludedDraped"),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(Y)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e)}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(o(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&d(e,e=>e.drapeTargetType===f.WithoutRasterImage)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=d(e,e=>e.drapeSourceType===y.Features),this._hasDrapedRasterSource=d(e,e=>e.drapeSourceType===y.RasterImage)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new w(this._stage.renderer.fboCache),this._overlays=[new x,new x]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(A.UPDATE),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return e===D.ColorNoRasterImage&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource}getTexture(e){return this._useOverlayColorInsteadOfColorNoRasterImage(e)?this._renderTargets?.getTexture(D.Color):this._renderTargets?.getTexture(e)}get running(){return this.updating}runTask(e){this._processDrapeSources(e,()=>!0)}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges()&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers(),e.madeProgress()),this.compact(e),s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this.hasHighlights=t(this._renderers,e=>e.hasHighlights),this.notifyChange("rendersOccludedDraped"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return t(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(K,e=>e.updatePolicy===G.SYNC)}get isEmpty(){return!b.OVERLAY_DRAW_DEBUG_TEXTURE&&s(this._renderers,e=>e.isEmpty)}get hasWater(){const e=t(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}get rendersOccludedDraped(){const e=this._renderContext.renderOccludedMask;this._renderContext.renderOccludedMask=ie,++this._techniques.precompiling;const r=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._renderContext.renderOccludedMask=e,r}renders(e){if(b.OVERLAY_DRAW_DEBUG_TEXTURE&&e!==D.Occluded&&e!==D.Highlight)return!0;if(!this._overlays)return!1;const r=this._overlays[T.INNER];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._renderContext.output;this._renderContext.output=this._renderTargets?.targets.find(r=>r.content===e)?.output??O.Color,++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._renderContext.output=t,s}get mode(){return this.isEmpty?C.Disabled:this.hasWater&&this.renders(D.WaterNormal)?C.EnabledWithWater:this._renderTargets?.getTexture(D.Color)?C.Enabled:C.Disabled}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(A.BACKGROUND),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(t.content===D.ColorNoRasterImage&&!this._needsColorWithoutRasterImage)continue;const e=t.output;this._renderContext.output=e,r.slot=e===O.Normal?V.DRAPED_WATER:V.DRAPED_MATERIAL,e===O.Highlight&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null),t.content===D.Occluded&&(this._renderContext.renderOccludedMask=ie),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{t.content===D.ColorNoRasterImage&&e.drapeSourceType===y.RasterImage||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=L,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccludees;for(const s of this._renderTargets.targets){if(r===A.BACKGROUND&&s.content!==D.WaterNormal||s.content===D.ColorNoRasterImage&&!this._needsColorWithoutRasterImage||s.content===D.Occluded&&t)continue;const e=this._drawTarget(T.INNER,s),i=this._drawTarget(T.OUTER,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n}=r;if(this.isEmpty||n===O.Normal&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:o,_camera:a,_renderContext:h,_bindParameters:l}=this;if(a.pixelRatio=t.pixelRatio*i,h.output=n,l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,l.slot=n===O.Normal?V.DRAPED_WATER:V.DRAPED_MATERIAL,r.content===D.Occluded&&(h.renderOccludedMask=ie),!this.renders(r.content))return h.renderOccludedMask=L,!1;const{resolution:d}=t,c=e===T.INNER,u=c?0:d;if(o.setViewport(u,0,d,d),this._bindTargetFBO(r),c)if(r.output!==O.Highlight)o.setClearColor(0,0,0,0),o.clear(J.COLOR);else{const{gl:e}=o;e.clearBufferuiv(e.COLOR,0,[0,0,0,0])}if(b.OVERLAY_DRAW_DEBUG_TEXTURE&&r.content!==D.Occluded&&r.content!==D.Highlight){this._techniques.precompile(H,ne);const r=this._techniques.get(H,ne);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,te[e]),o.bindTechnique(r,l,this._passParameters),o.screen.draw()}if(r.output===O.Highlight){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),j(o,t,{width:s,height:s},l,()=>this._renderAllGeometry(e,r),u)}else this._renderAllGeometry(e,r);return o.bindFramebuffer(null),h.renderOccludedMask=L,!0}get allSourcesOccludees(){const e=s(this._renderers,e=>e.hasOnlyOccludees);return this._renderers?.size>0&&e}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(r.content===D.ColorNoRasterImage&&i.drapeSourceType===y.RasterImage)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&r.output===O.Color&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(Y);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(J.COLOR),s}get _resolution(){return this._overlays?.[T.INNER].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers,r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer),n=i>=0,o=s.renderGroup??(n?R.MapLayer:R.ViewLayer),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new re(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],p(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),g(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(_(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new $(e);i.samplingMode=Q.NEAREST,this._passParameters.texture=new Z(this._rctx,i,t)}get test(){}};e([c()],ee.prototype,"hasHighlights",void 0),e([c()],ee.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([c({constructOnly:!0})],ee.prototype,"parent",void 0),e([c({readOnly:!0})],ee.prototype,"_techniques",null),e([c({type:Boolean,readOnly:!0})],ee.prototype,"updating",null),e([c()],ee.prototype,"isEmpty",null),e([c({readOnly:!0})],ee.prototype,"rendersOccludedDraped",null),ee=e([u("esri.views.3d.terrain.OverlayRenderer")],ee);class re{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const te=[[1,.5,.5],[.5,.5,1]],se=-2,ie=I.OccludeAndTransparent,ne=new U;ne.hasAlpha=!0;export{ee as OverlayRenderer,se as drapedZ,ie as overlayRenderOccludedFlag};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as t,everyMap as s}from"../../../core/MapUtils.js";import{disposeMaybe as i}from"../../../core/maybe.js";import n from"../../../core/PooledArray.js";import{watch as o,on as a,syncAndInitial as h,initial as l}from"../../../core/reactiveUtils.js";import{someSet as d}from"../../../core/SetUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{ortho as p,fromTranslation as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{i as _}from"../../../chunks/vec32.js";import{ones as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DrapeTargetType as f,DrapeSourceType as y,DrapedRenderGroup as R}from"../layers/interfaces.js";import{debugFlags as b}from"../support/debugFlags.js";import{OverlayIndex as T}from"./interfaces.js";import{Overlay as x}from"./Overlay.js";import{OverlayContent as D}from"./OverlayContent.js";import{OverlayRenderTargets as w}from"./OverlayRenderTargets.js";import v from"../webgl/RenderCamera.js";import{ShaderOutput as O}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as C}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as S}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as E}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as P,renderHighlightBuffer as j}from"../webgl-engine/effects/highlight/Highlight.js";import{RenderRequestType as A}from"../webgl-engine/lib/basicInterfaces.js";import{GLMaterialRepository as M}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as W}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderOccludedFlag as I}from"../webgl-engine/lib/Material.js";import{OITPass as N}from"../webgl-engine/lib/OITPass.js";import{RenderContext as q,defaultRenderOccludedMask as L}from"../webgl-engine/lib/RenderContext.js";import{RenderSlot as V}from"../webgl-engine/lib/RenderSlot.js";import{ShadowMap as F}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as H}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as U}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{Update as k}from"../webgl-engine/lib/Update.js";import{UpdatePolicy as G}from"../webgl-engine/lib/UpdatePolicy.js";import{AmbientLight as B}from"../webgl-engine/lighting/Lightsources.js";import{O as z}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as Y}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as X,noBudget as K}from"../../support/Scheduler.js";import{FramebufferBit as J,TextureSamplingMode as Q}from"../../webgl/enums.js";import{Texture as Z}from"../../webgl/Texture.js";import{TextureDescriptor as $}from"../../webgl/TextureDescriptor.js";let ee=class extends E{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new z,this.hasHighlights=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new n,this._passParameters=new S,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new v,this.events=new r,this.longitudeCyclical=null,this.produces=new Map([[V.DRAPED_MATERIAL,e=>e!==O.Highlight||this.hasHighlights],[V.DRAPED_WATER,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1}initialize(){const e=this._view,r=e.stage,t=r.renderer.fboCache,{waterTextures:s,techniques:i}=r.renderView;this._renderContext=new q(this._rctx,new F(t,e.state.viewingMode),i),this.addHandles([o(()=>s.updating,()=>this.events.emit("content-changed"),h),o(()=>this.spatialReference,e=>this._localOriginFactory=new W(e),h),a(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),o(()=>P(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,l),o(()=>e.state.highlights,r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap},l),e.resourceController.scheduler.registerTask(X.OVERLAY_RENDERER,this)]);const{_bindParameters:n,_camera:d}=this;d.near=1,d.far=1e4,d.relativeElevation=null,n.slot=V.DRAPED_MATERIAL,n.mainDepth=null,n.camera=d,n.oitPass=N.NONE,n.updateLighting([new B(m())],0,0,k.Immediate)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=i(this._passParameters.texture),this.disposeOverlays(),this._renderContext=null,this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new M(this._view.stage.renderView.textures,this._techniques,()=>{this.notifyChange("rendersOccludedDraped"),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(Y)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e)}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(o(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&d(e,e=>e.drapeTargetType===f.WithoutRasterImage)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=d(e,e=>e.drapeSourceType===y.Features),this._hasDrapedRasterSource=d(e,e=>e.drapeSourceType===y.RasterImage)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new w(this._stage.renderer.fboCache),this._overlays=[new x,new x]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(A.UPDATE),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return e===D.ColorNoRasterImage&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource}getTexture(e){return this._useOverlayColorInsteadOfColorNoRasterImage(e)?this._renderTargets?.getTexture(D.Color):this._renderTargets?.getTexture(e)}get running(){return this.updating}runTask(e){this._processDrapeSources(e,()=>!0)}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges()&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers(),e.madeProgress()),this.compact(e),s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this.hasHighlights=t(this._renderers,e=>e.hasHighlights),this.notifyChange("rendersOccludedDraped"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return t(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(K,e=>e.updatePolicy===G.SYNC)}get isEmpty(){return!b.OVERLAY_DRAW_DEBUG_TEXTURE&&s(this._renderers,e=>e.isEmpty)}get hasWater(){const e=t(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}get rendersOccludedDraped(){const e=this._renderContext.renderOccludedMask;this._renderContext.renderOccludedMask=ie,++this._techniques.precompiling;const r=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._renderContext.renderOccludedMask=e,r}renders(e){if(b.OVERLAY_DRAW_DEBUG_TEXTURE&&e!==D.Occluded&&e!==D.Highlight)return!0;if(!this._overlays)return!1;const r=this._overlays[T.INNER];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._renderContext.output;this._renderContext.output=this._renderTargets?.targets.find(r=>r.content===e)?.output??O.Color,++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._renderContext.output=t,s}get mode(){return this.isEmpty?C.Disabled:this.hasWater&&this.renders(D.WaterNormal)?C.EnabledWithWater:this._renderTargets?.getTexture(D.Color)?C.Enabled:C.Disabled}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(A.BACKGROUND),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(t.content===D.ColorNoRasterImage&&!this._needsColorWithoutRasterImage)continue;const e=t.output;this._renderContext.output=e,r.slot=e===O.Normal?V.DRAPED_WATER:V.DRAPED_MATERIAL,e===O.Highlight&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null),t.content===D.Occluded&&(this._renderContext.renderOccludedMask=ie),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{t.content===D.ColorNoRasterImage&&e.drapeSourceType===y.RasterImage||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=L,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(r===A.BACKGROUND&&s.content!==D.WaterNormal||s.content===D.ColorNoRasterImage&&!this._needsColorWithoutRasterImage||s.content===D.Occluded&&t)continue;const e=this._drawTarget(T.INNER,s),i=this._drawTarget(T.OUTER,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n}=r;if(this.isEmpty||n===O.Normal&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:o,_camera:a,_renderContext:h,_bindParameters:l}=this;if(a.pixelRatio=t.pixelRatio*i,h.output=n,l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,l.slot=n===O.Normal?V.DRAPED_WATER:V.DRAPED_MATERIAL,r.content===D.Occluded&&(h.renderOccludedMask=ie),!this.renders(r.content))return h.renderOccludedMask=L,!1;const{resolution:d}=t,c=e===T.INNER,u=c?0:d;if(o.setViewport(u,0,d,d),this._bindTargetFBO(r),c)if(r.output!==O.Highlight)o.setClearColor(0,0,0,0),o.clear(J.COLOR);else{const{gl:e}=o;e.clearBufferuiv(e.COLOR,0,[0,0,0,0])}if(b.OVERLAY_DRAW_DEBUG_TEXTURE&&r.content!==D.Occluded&&r.content!==D.Highlight){this._techniques.precompile(H,ne);const r=this._techniques.get(H,ne);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,te[e]),o.bindTechnique(r,l,this._passParameters),o.screen.draw()}if(r.output===O.Highlight){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),j(o,t,{width:s,height:s},l,()=>this._renderAllGeometry(e,r),u)}else this._renderAllGeometry(e,r);return o.bindFramebuffer(null),h.renderOccludedMask=L,!0}get allSourcesOccluders(){const e=s(this._renderers,e=>e.hasOnlyOccluders);return this._renderers?.size>0&&e}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(r.content===D.ColorNoRasterImage&&i.drapeSourceType===y.RasterImage)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&r.output===O.Color&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(Y);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(J.COLOR),s}get _resolution(){return this._overlays?.[T.INNER].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers,r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer),n=i>=0,o=s.renderGroup??(n?R.MapLayer:R.ViewLayer),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new re(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],p(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),g(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(_(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new $(e);i.samplingMode=Q.NEAREST,this._passParameters.texture=new Z(this._rctx,i,t)}get test(){}};e([c()],ee.prototype,"hasHighlights",void 0),e([c()],ee.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([c({constructOnly:!0})],ee.prototype,"parent",void 0),e([c({readOnly:!0})],ee.prototype,"_techniques",null),e([c({type:Boolean,readOnly:!0})],ee.prototype,"updating",null),e([c()],ee.prototype,"isEmpty",null),e([c({readOnly:!0})],ee.prototype,"rendersOccludedDraped",null),ee=e([u("esri.views.3d.terrain.OverlayRenderer")],ee);class re{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const te=[[1,.5,.5],[.5,.5,1]],se=-2,ie=I.OccludeAndTransparent,ne=new U;ne.hasAlpha=!0;export{ee as OverlayRenderer,se as drapedZ,ie as overlayRenderOccludedFlag};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{d as c,i as d,e as h}from"../../../chunks/vec32.js";import{ZEROS as u,create as g,fromValues as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as _,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as m,set as b}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as T}from"../../ViewingMode.js";import{TextureUpdate as O}from"./interfaces.js";import{LayerClass as R}from"./LayerClass.js";import{OverlayContent as x}from"./OverlayContent.js";import{overlayRenderOccludedFlag as v}from"./OverlayRenderer.js";import{PatchRenderData as w}from"./PatchRenderData.js";import{RenderOrder as D}from"./RenderOrder.js";import{TerrainAttributesCache as P}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as S}from"./terrainUtils.js";import{TileRenderer as C}from"./TileRenderer.js";import{TileUpdate as E}from"./TileUpdate.js";import{IteratorPreorder as j,sortTiles as A,compareTiles as N}from"./tileUtils.js";import{TransparencyMode as B}from"./TransparencyMode.js";import{componentMinimalSizeForIntersectionData as I,ComponentIntersectionData as U}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as G}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{TileBlendInput as F}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncRenderPlugin as q,ConsumesDepth as M,ConsumesNone as L}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as k}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as z}from"../webgl-engine/lib/basicInterfaces.js";import{StoreResults as V}from"../webgl-engine/lib/IntersectorInterfaces.js";import{IntersectorResult as H}from"../webgl-engine/lib/IntersectorResult.js";import{IntersectorType as Y}from"../webgl-engine/lib/IntersectorType.js";import{RenderOccludedFlag as Q}from"../webgl-engine/lib/Material.js";import{intersectAabbInvDirBefore as W,MeshIntersectionOptions as X,intersectTriangles as K}from"../webgl-engine/lib/RayIntersections.js";import{RenderSlot as Z}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as J}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as $}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as ee,getVerticalOffsetTerrain as te}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as ie}from"../webgl-engine/materials/DrawParameters.js";import{T as re}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as se}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ne}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as ae}from"../../webgl/enums.js";const oe=7,le=10,ce=m();let de=class extends q{get _isGlobal(){return this._stage.viewingMode===T.Global}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a,o){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this._compressionTracker=a,this.type=Y.TERRAIN,this.isGround=!0,this._passParameters=new re,this._drawParameters=new ie,this._renderDataPool=new s(w),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new j,this._castShadows=!1,this._inViewshed=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=Q.Occlude,this.produces=new Map([[Z.OPAQUE_TERRAIN,()=>this._produces()&&this.transparency===B.Opaque],[Z.TRANSPARENT_TERRAIN,()=>this._produces()&&(this.transparency===B.Transparent||this.transparency===B.InvisibleWithDraped)],[Z.OCCLUDED_GROUND,()=>this._produces()&&this.renderOccludedFlags===v]]),this._tileSize=256,this._configuration=new ne(t.viewingMode===T.Global),this._tileTextureCache=new r((e,t)=>o.newCache(e,t),"TileTexture"),this.tileGeometryCache=new P(o)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n(()=>this._overlayRenderer.rendersOccludedDraped,e=>{this.renderOccludedFlags=e?v:Q.Occlude,this.setNeedsRender()},a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?M:L}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerViewUid(){return ee}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,E.TEXTURE_FADING)}reuseTextureFromParent(e){const t=e.parent;if(!t)return!1;const i=_(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===E.TEXTURE_FADING?O.FADING:O.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[R.ELEVATION])i.pendingUpdates&=~E.GEOMETRY;e.resetPendingUpdate(E.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&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=le-oe,i=Math.max(0,Math.floor((e.level-t)/oe)*oe);if(this._isGlobal&&0===i)return u;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=z.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=z.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=z.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new C(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==B.Opaque)return;const s=he,n=ue;c(s,r,i),d(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,u=e.options.store===V.MIN,g=!!e.results.ground.target,p=te(e.verticalOffset),_=e.tolerance;let f,m=u&&null!=a.distance?a.distance:1/0;const T=e.options,O=T.normalRequired||!T.backfacesTerrain,R=new X(!1,O),x=d=>{const g=d.renderData;if(!g?.vao)return;const x=g.geometry;b(ce,x.boundingBox);const v=g.localOrigin;null!=p&&(p.localOrigin=v,p.applyToAabb(ce));const w=ce;if(ge[0]=i[0]-v[0],ge[1]=i[1]-v[1],ge[2]=i[2]-v[2],!W(w,ge,n,_,m))return;const D=(e,t,i)=>{e.set(this.type,d,t,i),m=u&&null!=a.distance?a.distance:1/0},P=(n,c,d)=>{if((!O||null!=d)&&n>=0&&(T.backfacesTerrain||h(d,s)<0)&&(T.invisibleTerrain||!T.selectionMode||null==t||t(i,r,n))){if((null==l.distance||n<l.distance)&&D(l,n,d),T.isFiltered)return;T.store===V.ALL&&(null==f?(f=new H(e.ray),D(f,n,d),e.results.all.push(f)):n<f.distance&&D(f,n,d)),(null==a.distance||n<a.distance)&&D(a,n,d),T.store!==V.MIN&&(null==o.distance||n>o.distance)&&D(o,n,d)}},S=pe;c(S,r,v);const{indices:C,indexCount:E}=x,j=x.vertexAttributes,A=j.getField($.POSITION,y),N=new k(A.typedBuffer,3,j.stride/4),B=E/3;if(!p&&B>I){const e=d.renderData;null==e.intersectionData&&(e.intersectionData=new U(C,0,B,N)),e.intersectionData.intersectRay(ge,S,R,P)}else K(ge,S,0,B,C,N,p,R,P)},v=this._rootTiles;if(null!=v){(()=>{const t=this._tileIterator;t.reset(v);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==p&&!e.intersectsRay(i,s,_,m)||g&&this._useStencilForTile(e)?t.skipSubtree():x(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}acquireTechniques(e){const t=!!has("enable-feature:terrain-shadows")&&e.bind.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bind.viewshedEnabled;if(this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),e.bind.slot===Z.OCCLUDED_GROUND){if(0===(e.renderOccludedMask&v))return null}else{const t=this.transparency===B.Opaque?Z.OPAQUE_TERRAIN:Z.TRANSPARENT_TERRAIN;if(e.bind.slot!==t)return null}if(this.transparency===B.Invisible)return null;const r=this._configuration;switch(r.screenSpaceReflections=r.cloudReflections=r.receiveShadows=r.receiveAmbientOcclusion=r.renderOccluded=r.hasHighlightMixTexture=!1,r.overlayMode=this._overlayRenderer.mode,e.output){case G.Color:case G.ColorEmission:{r.screenSpaceReflections=null!=e.bind.ssr.lastFrameColor,r.cloudReflections=null!=e.bind.clouds.data,r.receiveShadows=e.bind.shadowMap.ready;const t=e.bind.slot===Z.OCCLUDED_GROUND;return r.renderOccluded=t,r.receiveAmbientOcclusion=!t&&null!=e.bind.ssao,this._acquireTechnique(e.output)}case G.Shadow:case G.ShadowExcludeHighlight:return this._castShadows?this._acquireTechnique(G.Shadow):null;case G.ViewshedShadow:return this._inViewshed?this._acquireTechnique(G.ViewshedShadow):null;case G.Depth:case G.Normal:return this._acquireTechnique(e.output);case G.ObjectAndLayerIdColor:return this._acquireTechnique(G.ObjectAndLayerIdColor);case G.Highlight:return r.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(G.Highlight):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case G.Color:case G.ColorEmission:{const i=e.bind.slot!==Z.OCCLUDED_GROUND||e.bind.overlay?.allSourcesOccludees?x.Color:x.Occluded;this._renderMaterialPass(e,t,i);break}case G.Depth:case G.Normal:this._renderAuxiliaryPass(e,t,x.Color,this._visiblePatchesByOrigin);break;case G.Highlight:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(x.Highlight)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,x.Highlight,this._visiblePatchesByOrigin);break}case G.Shadow:case G.ShadowExcludeHighlight:case G.ViewshedShadow:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case G.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,x.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=p(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll(e=>i.updateTileTexture(e,O.FADING)),this._configuration.tileBlendInput=i.backgroundIsGrid?F.GridComposite:null!=i.backgroundColor?F.ColorComposite:F.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==D.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)A(this.renderOrder,i,t);e.sort((e,t)=>N(e[0],t[0],this.renderOrder)),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.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){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bind,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach(r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],ae.TRIANGLES,n,i)}),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bind,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bind.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=J(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=e.bind.slot===Z.OCCLUDED_GROUND;o&&(n.bindTexture("tex",r.emptyTexture),n.setUniform3fv("textureOpacities",u),n.setUniform4fv("texOffsetAndScale",f));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:u;this._configuration.tileBlendInput===F.ColorComposite&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?ae.LINES:ae.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",r.emptyTexture);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const r=h[0].renderData.localOrigin;this._drawParameters.origin=r,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const s of h){const r=s.renderData,l=r.textureReference;if(null!=l){if(!o){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,c,a,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(S&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const d=a.geometry.indexCount;e.rctx.bindVAO(o),c.assertCompatibleVertexAttributeLocations(o),e.rctx.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(se,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([o({readOnly:!0})],de.prototype,"_isGlobal",null),e([o()],de.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],de.prototype,"renderingDisabled",null),e([o({value:!0})],de.prototype,"visible",null),e([o()],de.prototype,"renderPatchBorders",null),e([o()],de.prototype,"visualizeNormals",null),e([o()],de.prototype,"cullBackFaces",null),e([o({value:D.FRONT_TO_BACK})],de.prototype,"renderOrder",null),e([o()],de.prototype,"wireframe",null),de=e([l("esri.views.3d.terrain.TerrainRenderer")],de);const he=g(),ue=g(),ge=g(),pe=g();export{de as TerrainRenderer};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{d as c,i as d,e as h}from"../../../chunks/vec32.js";import{ZEROS as u,create as g,fromValues as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as _,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as m,set as b}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as T}from"../../ViewingMode.js";import{TextureUpdate as O}from"./interfaces.js";import{LayerClass as R}from"./LayerClass.js";import{OverlayContent as x}from"./OverlayContent.js";import{overlayRenderOccludedFlag as v}from"./OverlayRenderer.js";import{PatchRenderData as w}from"./PatchRenderData.js";import{RenderOrder as D}from"./RenderOrder.js";import{TerrainAttributesCache as P}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as S}from"./terrainUtils.js";import{TileRenderer as C}from"./TileRenderer.js";import{TileUpdate as E}from"./TileUpdate.js";import{IteratorPreorder as j,sortTiles as A,compareTiles as N}from"./tileUtils.js";import{TransparencyMode as B}from"./TransparencyMode.js";import{componentMinimalSizeForIntersectionData as I,ComponentIntersectionData as U}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as G}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{TileBlendInput as F}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncRenderPlugin as q,ConsumesDepth as M,ConsumesNone as L}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as k}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as z}from"../webgl-engine/lib/basicInterfaces.js";import{StoreResults as V}from"../webgl-engine/lib/IntersectorInterfaces.js";import{IntersectorResult as H}from"../webgl-engine/lib/IntersectorResult.js";import{IntersectorType as Y}from"../webgl-engine/lib/IntersectorType.js";import{RenderOccludedFlag as Q}from"../webgl-engine/lib/Material.js";import{intersectAabbInvDirBefore as W,MeshIntersectionOptions as X,intersectTriangles as K}from"../webgl-engine/lib/RayIntersections.js";import{RenderSlot as Z}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as J}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as $}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as ee,getVerticalOffsetTerrain as te}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as ie}from"../webgl-engine/materials/DrawParameters.js";import{T as re}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as se}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ne}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as ae}from"../../webgl/enums.js";const oe=7,le=10,ce=m();let de=class extends q{get _isGlobal(){return this._stage.viewingMode===T.Global}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a,o){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this._compressionTracker=a,this.type=Y.TERRAIN,this.isGround=!0,this._passParameters=new re,this._drawParameters=new ie,this._renderDataPool=new s(w),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new j,this._castShadows=!1,this._inViewshed=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=Q.Occlude,this.produces=new Map([[Z.OPAQUE_TERRAIN,()=>this._produces()&&this.transparency===B.Opaque],[Z.TRANSPARENT_TERRAIN,()=>this._produces()&&(this.transparency===B.Transparent||this.transparency===B.InvisibleWithDraped)],[Z.OCCLUDED_GROUND,()=>this._produces()&&this.renderOccludedFlags===v]]),this._tileSize=256,this._configuration=new ne(t.viewingMode===T.Global),this._tileTextureCache=new r((e,t)=>o.newCache(e,t),"TileTexture"),this.tileGeometryCache=new P(o)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n(()=>this._overlayRenderer.rendersOccludedDraped,e=>{this.renderOccludedFlags=e?v:Q.Occlude,this.setNeedsRender()},a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?M:L}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerViewUid(){return ee}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,E.TEXTURE_FADING)}reuseTextureFromParent(e){const t=e.parent;if(!t)return!1;const i=_(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===E.TEXTURE_FADING?O.FADING:O.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[R.ELEVATION])i.pendingUpdates&=~E.GEOMETRY;e.resetPendingUpdate(E.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&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=le-oe,i=Math.max(0,Math.floor((e.level-t)/oe)*oe);if(this._isGlobal&&0===i)return u;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=z.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=z.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=z.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new C(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==B.Opaque)return;const s=he,n=ue;c(s,r,i),d(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,u=e.options.store===V.MIN,g=!!e.results.ground.target,p=te(e.verticalOffset),_=e.tolerance;let f,m=u&&null!=a.distance?a.distance:1/0;const T=e.options,O=T.normalRequired||!T.backfacesTerrain,R=new X(!1,O),x=d=>{const g=d.renderData;if(!g?.vao)return;const x=g.geometry;b(ce,x.boundingBox);const v=g.localOrigin;null!=p&&(p.localOrigin=v,p.applyToAabb(ce));const w=ce;if(ge[0]=i[0]-v[0],ge[1]=i[1]-v[1],ge[2]=i[2]-v[2],!W(w,ge,n,_,m))return;const D=(e,t,i)=>{e.set(this.type,d,t,i),m=u&&null!=a.distance?a.distance:1/0},P=(n,c,d)=>{if((!O||null!=d)&&n>=0&&(T.backfacesTerrain||h(d,s)<0)&&(T.invisibleTerrain||!T.selectionMode||null==t||t(i,r,n))){if((null==l.distance||n<l.distance)&&D(l,n,d),T.isFiltered)return;T.store===V.ALL&&(null==f?(f=new H(e.ray),D(f,n,d),e.results.all.push(f)):n<f.distance&&D(f,n,d)),(null==a.distance||n<a.distance)&&D(a,n,d),T.store!==V.MIN&&(null==o.distance||n>o.distance)&&D(o,n,d)}},S=pe;c(S,r,v);const{indices:C,indexCount:E}=x,j=x.vertexAttributes,A=j.getField($.POSITION,y),N=new k(A.typedBuffer,3,j.stride/4),B=E/3;if(!p&&B>I){const e=d.renderData;null==e.intersectionData&&(e.intersectionData=new U(C,0,B,N)),e.intersectionData.intersectRay(ge,S,R,P)}else K(ge,S,0,B,C,N,p,R,P)},v=this._rootTiles;if(null!=v){(()=>{const t=this._tileIterator;t.reset(v);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==p&&!e.intersectsRay(i,s,_,m)||g&&this._useStencilForTile(e)?t.skipSubtree():x(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}acquireTechniques(e){const t=!!has("enable-feature:terrain-shadows")&&e.bind.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bind.viewshedEnabled;if(this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),e.bind.slot===Z.OCCLUDED_GROUND){if(0===(e.renderOccludedMask&v))return null}else{const t=this.transparency===B.Opaque?Z.OPAQUE_TERRAIN:Z.TRANSPARENT_TERRAIN;if(e.bind.slot!==t)return null}if(this.transparency===B.Invisible)return null;const r=this._configuration;switch(r.screenSpaceReflections=r.cloudReflections=r.receiveShadows=r.receiveAmbientOcclusion=r.renderOccluded=r.hasHighlightMixTexture=!1,r.overlayMode=this._overlayRenderer.mode,e.output){case G.Color:case G.ColorEmission:{r.screenSpaceReflections=null!=e.bind.ssr.lastFrameColor,r.cloudReflections=null!=e.bind.clouds.data,r.receiveShadows=e.bind.shadowMap.ready;const t=e.bind.slot===Z.OCCLUDED_GROUND;return r.renderOccluded=t,r.receiveAmbientOcclusion=!t&&null!=e.bind.ssao,this._acquireTechnique(e.output)}case G.Shadow:case G.ShadowExcludeHighlight:return this._castShadows?this._acquireTechnique(G.Shadow):null;case G.ViewshedShadow:return this._inViewshed?this._acquireTechnique(G.ViewshedShadow):null;case G.Depth:case G.Normal:return this._acquireTechnique(e.output);case G.ObjectAndLayerIdColor:return this._acquireTechnique(G.ObjectAndLayerIdColor);case G.Highlight:return r.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(G.Highlight):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case G.Color:case G.ColorEmission:{const i=e.bind.slot!==Z.OCCLUDED_GROUND||e.bind.overlay?.allSourcesOccluders?x.Color:x.Occluded;this._renderMaterialPass(e,t,i);break}case G.Depth:case G.Normal:this._renderAuxiliaryPass(e,t,x.Color,this._visiblePatchesByOrigin);break;case G.Highlight:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(x.Highlight)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,x.Highlight,this._visiblePatchesByOrigin);break}case G.Shadow:case G.ShadowExcludeHighlight:case G.ViewshedShadow:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case G.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,x.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=p(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll(e=>i.updateTileTexture(e,O.FADING)),this._configuration.tileBlendInput=i.backgroundIsGrid?F.GridComposite:null!=i.backgroundColor?F.ColorComposite:F.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==D.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)A(this.renderOrder,i,t);e.sort((e,t)=>N(e[0],t[0],this.renderOrder)),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.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){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bind,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach(r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],ae.TRIANGLES,n,i)}),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bind,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bind.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=J(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=e.bind.slot===Z.OCCLUDED_GROUND;o&&(n.bindTexture("tex",r.emptyTexture),n.setUniform3fv("textureOpacities",u),n.setUniform4fv("texOffsetAndScale",f));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:u;this._configuration.tileBlendInput===F.ColorComposite&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?ae.LINES:ae.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",r.emptyTexture);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const r=h[0].renderData.localOrigin;this._drawParameters.origin=r,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const s of h){const r=s.renderData,l=r.textureReference;if(null!=l){if(!o){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,c,a,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(S&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const d=a.geometry.indexCount;e.rctx.bindVAO(o),c.assertCompatibleVertexAttributeLocations(o),e.rctx.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(se,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([o({readOnly:!0})],de.prototype,"_isGlobal",null),e([o()],de.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],de.prototype,"renderingDisabled",null),e([o({value:!0})],de.prototype,"visible",null),e([o()],de.prototype,"renderPatchBorders",null),e([o()],de.prototype,"visualizeNormals",null),e([o()],de.prototype,"cullBackFaces",null),e([o({value:D.FRONT_TO_BACK})],de.prototype,"renderOrder",null),e([o()],de.prototype,"wireframe",null),de=e([l("esri.views.3d.terrain.TerrainRenderer")],de);const he=g(),ue=g(),ge=g(),pe=g();export{de as TerrainRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{invert as t,transpose as r}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as o}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{q as s,I as i}from"../../../../../../chunks/vec32.js";import{freeze as a,ZEROS as l}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{v as n}from"../../../../../../chunks/vec42.js";import{freeze as u,fromValues as h}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{EmissiveSourceMode as p}from"../../../../../../symbols/support/materialUtils.js";import{ColorMixModeEnum as c}from"../../../../layers/support/symbolColorUtils.js";import{OverlayContent as d}from"../../../../terrain/OverlayContent.js";import{ComponentTechnique as m}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as g,IntegratedMeshMode as f}from"./ComponentTechniqueConfiguration.js";import{ComponentDataType as x}from"./shader/ComponentData.glsl.js";import{VertexDiscardMode as v}from"./shader/VertexDiscardMode.js";import{parameter as b,parameterBlock as y,MaterialBase as M,MaterialParameterBlock as T}from"../../../core/material/MaterialBase.js";import{RenderPassIdentifier as O}from"../../../core/renderPasses/RenderPassIdentifier.js";import{ShaderOutput as C,isColorEmission as S}from"../../../core/shaderLibrary/ShaderOutput.js";import{NormalType as w}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as N}from"../../../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as D}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as j}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{EllipsoidMode as P}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{TwoVectorPosition as q}from"../../../core/util/TwoVectorPosition.js";import{AlphaDiscardMode as A,CullFaceOptions as R}from"../../../lib/basicInterfaces.js";import{OITPass as I}from"../../../lib/OITPass.js";import{RenderSlot as E}from"../../../lib/RenderSlot.js";import{advancedMRRFactors as F}from"../../../materials/pbrUtils.js";import{defaultHighlightName as B}from"../../../../../support/HighlightDefaults.js";import{alphaCutoff as W}from"../../../../../../webscene/support/AlphaCutoff.js";class L extends M{constructor(e,s){super(),this.toMapSpace=s,this.baseColor=u(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=F,this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.normalTexture=null,this.occlusionTexture=null,this.emissionTexture=null,this.emissiveBaseColor=a(0,0,0),this.emissiveStrength=1,this.emissiveSource=p.Emissive,this.commonMaterialParameters=new V,this.componentParameters=new U,this.objectOpacity=1,this.textureAlphaCutoff=W,this.alphaDiscardMode=A.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=P.Earth,this.hasOccludees=!1;const i=new q(e.position),l=o(e.rotationScale);t(l,l),r(l,l),this.transformNormalGlobalFromModel=l,this.transformWorldFromModelTL=i.low,this.transformWorldFromModelTH=i.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get hasEmissions(){return null!=this.emissionTexture||!s(this.emissiveBaseColor,l)}get texture(){return this.baseColorTexture?.glTexture}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.glTexture}get textureEmissive(){return this.emissionTexture?.glTexture}get textureOcclusion(){return this.occlusionTexture?.glTexture}get textureNormal(){return this.normalTexture?.glTexture}acquireTechnique(e,t,r,o){const s=new g(e.context.spherical);s.renderOccluded=r.slot===E.OCCLUDED_GROUND,s.hasVertexColors=o.colors,s.hasNormals=o.hasNormals,s.textureCoordinateType=o.textureCoordinates,s.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,s.hasOcclusionTexture=null!=this.occlusionTexture,s.hasNormalTexture=null!=this.normalTexture,s.oitPass=t.identifier===O.Material&&null!=r.oitPass?r.oitPass:I.NONE,s.terrainDepthTest=t.identifier===O.Material&&r.terrainDepthTest,s.cullAboveTerrain=t.identifier===O.Material&&r.cullAboveTerrain,s.ellipsoidMode=this.ellipsoidMode,s.componentData=this.componentParameters.type,s.cullFace=this.commonMaterialParameters.cullFace,s.doubleSidedMode=this.commonMaterialParameters.doubleSided?D.View:D.None,s.hasColorTexture=null!=this.baseColorTexture;const i=this._computeWhichMaterialPass();if(s.blendingEnabled=i===k.Transparent||i===k.OpaqueAndTransparent,s.alphaDiscardMode=this.alphaDiscardMode,s.integratedMeshMode=this.isIntegratedMesh?J(r)?z(r)?f.ColorOverlayWithWater:f.ColorOverlay:f.NoOverlay:f.None,s.hasPolygonOffset=this.polygonOffsetEnabled,s.pbrMode=s.integratedMeshMode===f.ColorOverlayWithWater?j.WaterOnIntegratedMesh:this.usePBR?this.hasParametersFromSource?o.shadeNormals&&this.isIntegratedMesh?j.Disabled:j.Schematic:j.Normal:j.Disabled,s.emissionSource=this.hasEmissions?null!=this.emissionTexture?N.Texture:s.pbrMode===j.Normal?N.SymbolColor:N.None:N.None,s.shadeNormals=o.shadeNormals,s.normalType=s.hasNormals?w.Compressed:w.ScreenDerivative,s.hasSlicePlane=null!=r.slicePlane&&this.commonMaterialParameters.hasSlicePlane,s.receiveAmbientOcclusion=s.hasOccludees=s.receiveShadows=s.screenSpaceReflections=s.cloudReflections=s.hasHighlightMixTexture=!1,t.identifier===O.ShadowMap)s.output=C.Shadow,s.vertexDiscardMode=v.None;else if(t.identifier===O.ViewshedShadowMap)s.output=C.ViewshedShadow,s.vertexDiscardMode=v.None;else if(t.identifier===O.Highlight)s.output=C.Highlight,s.vertexDiscardMode=v.None,s.hasHighlightMixTexture=null!=r.highlightMixTexture;else{switch(i===k.OpaqueAndTransparent?s.vertexDiscardMode=t.transparent?v.Opaque:v.Transparent:s.vertexDiscardMode=v.None,s.hasBloom=S(t.output),s.output=t.output,t.output){case C.Color:case C.ColorEmission:s.receiveAmbientOcclusion=o.applySSAO&&null!=r.ssao?.getTexture(),s.hasOccludees=r.hasOccludees,s.receiveShadows=r.shadowMap.ready,s.screenSpaceReflections=null!=r.ssr.lastFrameColor,s.cloudReflections=null!=r.clouds.data?.cubeMap?.colorTexture;break;case C.ObjectAndLayerIdColor:s.objectAndLayerIdColor=!0}s.snowCover=r.snowCover}const a=e.get(m,s);return this._setClean(),a}submit(e,t,r){if(this.objectOpacity<=0)return;const{componentData:o,renderable:s}=r,{geometry:i}=s,a=s.meta.cameraDepthSquared;o.updateHighlights(t.highlights);const{geometryRanges:l,highlightRangesMap:n,shadowmapRanges:u}=o;switch(this._computeWhichMaterialPass()){case k.Opaque:e.opaque.submitDraw(this,i,l,a);break;case k.Transparent:e.transparent.submitDraw(this,i,l,a);break;case k.OpaqueAndTransparent:e.opaque.submitDraw(this,i,l,a),e.transparent.submitDraw(this,i,l,a);break;case k.IntegratedMesh:e.integratedMesh.submitDraw(this,i,l,a),K(t)&&e.occludedGround.submitDraw(this,i,l,a),G(t)&&e.highlightIntegratedMesh.submitDraw(this,i,l,a)}if(this.componentParameters.castShadows!==H.None){if(null!=n)for(const t of n)t[0]===B&&e.highlightShadowMap.submitDraw(this,i,t[1],a,t[0]);null!=u&&e.defaultShadowMap.submitDraw(this,i,u,a),e.shadowMap.submitDraw(this,i,l,a)}if(null!=n)for(const h of n)e.highlight.submitDraw(this,i,h[1],a,h[0]);t.viewshedEnabled&&e.viewshedShadowMap.submitDraw(this,i,l,a)}_computeWhichMaterialPass(){if(this.isIntegratedMesh)return k.IntegratedMesh;if(this.objectOpacity<1)return k.Transparent;if(this.componentParameters.opaqueOverride===H.All)return k.Opaque;if(this.baseColor[3]<1||this.alphaDiscardMode===A.Blend||this.alphaDiscardMode===A.MaskBlend)return k.Transparent;switch(this.componentParameters.transparent){case H.None:return k.Opaque;case H.All:return k.Transparent;case H.Some:return k.OpaqueAndTransparent}}}var k,H;e([b({vectorOps:n})],L.prototype,"baseColor",void 0),e([b()],L.prototype,"usePBR",void 0),e([b()],L.prototype,"hasParametersFromSource",void 0),e([b({vectorOps:i})],L.prototype,"mrrFactors",void 0),e([b({dispose:!0})],L.prototype,"baseColorTexture",void 0),e([b({dispose:!0})],L.prototype,"metallicRoughnessTexture",void 0),e([b({dispose:!0})],L.prototype,"normalTexture",void 0),e([b({dispose:!0})],L.prototype,"occlusionTexture",void 0),e([b({dispose:!0})],L.prototype,"emissionTexture",void 0),e([b({vectorOps:i})],L.prototype,"emissiveBaseColor",void 0),e([b()],L.prototype,"emissiveStrength",void 0),e([b()],L.prototype,"emissiveSource",void 0),e([y()],L.prototype,"commonMaterialParameters",void 0),e([y()],L.prototype,"componentParameters",void 0),e([b()],L.prototype,"objectOpacity",void 0),e([b()],L.prototype,"textureAlphaCutoff",void 0),e([b()],L.prototype,"alphaDiscardMode",void 0),e([b()],L.prototype,"isIntegratedMesh",void 0),e([b()],L.prototype,"polygonOffsetEnabled",void 0),e([b()],L.prototype,"ellipsoidMode",void 0),e([b()],L.prototype,"hasOccludees",void 0),function(e){e[e.Opaque=0]="Opaque",e[e.Transparent=1]="Transparent",e[e.OpaqueAndTransparent=2]="OpaqueAndTransparent",e[e.IntegratedMesh=3]="IntegratedMesh"}(k||(k={}));class V extends T{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=R.Back,this.hasSlicePlane=!0}}e([b()],V.prototype,"doubleSided",void 0),e([b()],V.prototype,"cullFace",void 0),e([b()],V.prototype,"hasSlicePlane",void 0);class U extends T{constructor(){super(...arguments),this.externalColor=h(1,1,1,1),this.externalColorMixMode=c.Multiply,this.castShadows=H.All}get transparent(){return this.externalColor[3]<1?H.All:H.None}get opaqueOverride(){return this.externalColorMixMode===c.Replace&&1===this.externalColor[3]?H.All:H.None}get visible(){return this.externalColor[3]>0?H.All:H.None}get type(){return x.Uniform}}e([b({vectorOps:n})],U.prototype,"externalColor",void 0),e([b()],U.prototype,"externalColorMixMode",void 0),e([b()],U.prototype,"castShadows",void 0),function(e){e[e.All=0]="All",e[e.Some=1]="Some",e[e.None=2]="None"}(H||(H={}));class _ extends T{constructor(){super(...arguments),this.texture=null,this.transparent=H.None,this.opaqueOverride=H.None,this.castShadows=H.None}get type(){return x.Varying}}function G(e){return null!=e.overlay?.getTexture(d.Highlight)}function z(e){return null!=e.overlay?.getTexture(d.WaterNormal)}function J(e){return null!=e.overlay?.getTexture(d.ColorNoRasterImage)}function K(e){const t=null!=e.overlay?.getTexture(d.Occluded);return t&&e.overlay?.allSourcesOccludees?null!=e.overlay?.getTexture(d.ColorNoRasterImage):t}e([b()],_.prototype,"texture",void 0),e([b()],_.prototype,"transparent",void 0),e([b()],_.prototype,"opaqueOverride",void 0),e([b()],_.prototype,"castShadows",void 0);export{V as CommonMaterialParameters,L as ComponentMaterial,H as ComponentParameterSummary,U as ComponentParametersUniform,_ as ComponentParametersVarying};
|
|
5
|
+
import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{invert as t,transpose as r}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as o}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{q as s,I as i}from"../../../../../../chunks/vec32.js";import{freeze as a,ZEROS as l}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{v as n}from"../../../../../../chunks/vec42.js";import{freeze as u,fromValues as h}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{EmissiveSourceMode as p}from"../../../../../../symbols/support/materialUtils.js";import{ColorMixModeEnum as c}from"../../../../layers/support/symbolColorUtils.js";import{OverlayContent as d}from"../../../../terrain/OverlayContent.js";import{ComponentTechnique as m}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as g,IntegratedMeshMode as f}from"./ComponentTechniqueConfiguration.js";import{ComponentDataType as x}from"./shader/ComponentData.glsl.js";import{VertexDiscardMode as v}from"./shader/VertexDiscardMode.js";import{parameter as b,parameterBlock as M,MaterialBase as y,MaterialParameterBlock as T}from"../../../core/material/MaterialBase.js";import{RenderPassIdentifier as O}from"../../../core/renderPasses/RenderPassIdentifier.js";import{ShaderOutput as C,isColorEmission as S}from"../../../core/shaderLibrary/ShaderOutput.js";import{NormalType as w}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as N}from"../../../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as D}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as j}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{EllipsoidMode as P}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{TwoVectorPosition as q}from"../../../core/util/TwoVectorPosition.js";import{AlphaDiscardMode as A,CullFaceOptions as R}from"../../../lib/basicInterfaces.js";import{OITPass as I}from"../../../lib/OITPass.js";import{RenderSlot as E}from"../../../lib/RenderSlot.js";import{advancedMRRFactors as F}from"../../../materials/pbrUtils.js";import{defaultHighlightName as B}from"../../../../../support/HighlightDefaults.js";import{alphaCutoff as W}from"../../../../../../webscene/support/AlphaCutoff.js";class L extends y{constructor(e,s){super(),this.toMapSpace=s,this.baseColor=u(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=F,this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.normalTexture=null,this.occlusionTexture=null,this.emissionTexture=null,this.emissiveBaseColor=a(0,0,0),this.emissiveStrength=1,this.emissiveSource=p.Emissive,this.commonMaterialParameters=new V,this.componentParameters=new U,this.objectOpacity=1,this.textureAlphaCutoff=W,this.alphaDiscardMode=A.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=P.Earth,this.hasOccludees=!1;const i=new q(e.position),l=o(e.rotationScale);t(l,l),r(l,l),this.transformNormalGlobalFromModel=l,this.transformWorldFromModelTL=i.low,this.transformWorldFromModelTH=i.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get hasEmissions(){return null!=this.emissionTexture||!s(this.emissiveBaseColor,l)}get texture(){return this.baseColorTexture?.glTexture}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.glTexture}get textureEmissive(){return this.emissionTexture?.glTexture}get textureOcclusion(){return this.occlusionTexture?.glTexture}get textureNormal(){return this.normalTexture?.glTexture}acquireTechnique(e,t,r,o){const s=new g(e.context.spherical);s.renderOccluded=r.slot===E.OCCLUDED_GROUND,s.hasVertexColors=o.colors,s.hasNormals=o.hasNormals,s.textureCoordinateType=o.textureCoordinates,s.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,s.hasOcclusionTexture=null!=this.occlusionTexture,s.hasNormalTexture=null!=this.normalTexture,s.oitPass=t.identifier===O.Material&&null!=r.oitPass?r.oitPass:I.NONE,s.terrainDepthTest=t.identifier===O.Material&&r.terrainDepthTest,s.cullAboveTerrain=t.identifier===O.Material&&r.cullAboveTerrain,s.ellipsoidMode=this.ellipsoidMode,s.componentData=this.componentParameters.type,s.cullFace=this.commonMaterialParameters.cullFace,s.doubleSidedMode=this.commonMaterialParameters.doubleSided?D.View:D.None,s.hasColorTexture=null!=this.baseColorTexture;const i=this._computeWhichMaterialPass();if(s.blendingEnabled=i===k.Transparent||i===k.OpaqueAndTransparent,s.alphaDiscardMode=this.alphaDiscardMode,s.integratedMeshMode=this.isIntegratedMesh?J(r)?z(r)?f.ColorOverlayWithWater:f.ColorOverlay:f.NoOverlay:f.None,s.hasPolygonOffset=this.polygonOffsetEnabled,s.pbrMode=s.integratedMeshMode===f.ColorOverlayWithWater?j.WaterOnIntegratedMesh:this.usePBR?this.hasParametersFromSource?o.shadeNormals&&this.isIntegratedMesh?j.Disabled:j.Schematic:j.Normal:j.Disabled,s.emissionSource=this.hasEmissions?null!=this.emissionTexture?N.Texture:s.pbrMode===j.Normal?N.SymbolColor:N.None:N.None,s.shadeNormals=o.shadeNormals,s.normalType=s.hasNormals?w.Compressed:w.ScreenDerivative,s.hasSlicePlane=null!=r.slicePlane&&this.commonMaterialParameters.hasSlicePlane,s.receiveAmbientOcclusion=s.hasOccludees=s.receiveShadows=s.screenSpaceReflections=s.cloudReflections=s.hasHighlightMixTexture=!1,t.identifier===O.ShadowMap)s.output=C.Shadow,s.vertexDiscardMode=v.None;else if(t.identifier===O.ViewshedShadowMap)s.output=C.ViewshedShadow,s.vertexDiscardMode=v.None;else if(t.identifier===O.Highlight)s.output=C.Highlight,s.vertexDiscardMode=v.None,s.hasHighlightMixTexture=null!=r.highlightMixTexture;else{switch(i===k.OpaqueAndTransparent?s.vertexDiscardMode=t.transparent?v.Opaque:v.Transparent:s.vertexDiscardMode=v.None,s.hasBloom=S(t.output),s.output=t.output,t.output){case C.Color:case C.ColorEmission:s.receiveAmbientOcclusion=o.applySSAO&&null!=r.ssao?.getTexture(),s.hasOccludees=r.hasOccludees,s.receiveShadows=r.shadowMap.ready,s.screenSpaceReflections=null!=r.ssr.lastFrameColor,s.cloudReflections=null!=r.clouds.data?.cubeMap?.colorTexture;break;case C.ObjectAndLayerIdColor:s.objectAndLayerIdColor=!0}s.snowCover=r.snowCover}const a=e.get(m,s);return this._setClean(),a}submit(e,t,r){if(this.objectOpacity<=0)return;const{componentData:o,renderable:s}=r,{geometry:i}=s,a=s.meta.cameraDepthSquared;o.updateHighlights(t.highlights);const{geometryRanges:l,highlightRangesMap:n,shadowmapRanges:u}=o;switch(this._computeWhichMaterialPass()){case k.Opaque:e.opaque.submitDraw(this,i,l,a);break;case k.Transparent:e.transparent.submitDraw(this,i,l,a);break;case k.OpaqueAndTransparent:e.opaque.submitDraw(this,i,l,a),e.transparent.submitDraw(this,i,l,a);break;case k.IntegratedMesh:e.integratedMesh.submitDraw(this,i,l,a),K(t)&&e.occludedGround.submitDraw(this,i,l,a),G(t)&&e.highlightIntegratedMesh.submitDraw(this,i,l,a)}if(this.componentParameters.castShadows!==H.None){if(null!=n)for(const t of n)t[0]===B&&e.highlightShadowMap.submitDraw(this,i,t[1],a,t[0]);null!=u&&e.defaultShadowMap.submitDraw(this,i,u,a),e.shadowMap.submitDraw(this,i,l,a)}if(null!=n)for(const h of n)e.highlight.submitDraw(this,i,h[1],a,h[0]);t.viewshedEnabled&&e.viewshedShadowMap.submitDraw(this,i,l,a)}_computeWhichMaterialPass(){if(this.isIntegratedMesh)return k.IntegratedMesh;if(this.objectOpacity<1)return k.Transparent;if(this.componentParameters.opaqueOverride===H.All)return k.Opaque;if(this.baseColor[3]<1||this.alphaDiscardMode===A.Blend||this.alphaDiscardMode===A.MaskBlend)return k.Transparent;switch(this.componentParameters.transparent){case H.None:return k.Opaque;case H.All:return k.Transparent;case H.Some:return k.OpaqueAndTransparent}}}var k,H;e([b({vectorOps:n})],L.prototype,"baseColor",void 0),e([b()],L.prototype,"usePBR",void 0),e([b()],L.prototype,"hasParametersFromSource",void 0),e([b({vectorOps:i})],L.prototype,"mrrFactors",void 0),e([b({dispose:!0})],L.prototype,"baseColorTexture",void 0),e([b({dispose:!0})],L.prototype,"metallicRoughnessTexture",void 0),e([b({dispose:!0})],L.prototype,"normalTexture",void 0),e([b({dispose:!0})],L.prototype,"occlusionTexture",void 0),e([b({dispose:!0})],L.prototype,"emissionTexture",void 0),e([b({vectorOps:i})],L.prototype,"emissiveBaseColor",void 0),e([b()],L.prototype,"emissiveStrength",void 0),e([b()],L.prototype,"emissiveSource",void 0),e([M()],L.prototype,"commonMaterialParameters",void 0),e([M()],L.prototype,"componentParameters",void 0),e([b()],L.prototype,"objectOpacity",void 0),e([b()],L.prototype,"textureAlphaCutoff",void 0),e([b()],L.prototype,"alphaDiscardMode",void 0),e([b()],L.prototype,"isIntegratedMesh",void 0),e([b()],L.prototype,"polygonOffsetEnabled",void 0),e([b()],L.prototype,"ellipsoidMode",void 0),e([b()],L.prototype,"hasOccludees",void 0),function(e){e[e.Opaque=0]="Opaque",e[e.Transparent=1]="Transparent",e[e.OpaqueAndTransparent=2]="OpaqueAndTransparent",e[e.IntegratedMesh=3]="IntegratedMesh"}(k||(k={}));class V extends T{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=R.Back,this.hasSlicePlane=!0}}e([b()],V.prototype,"doubleSided",void 0),e([b()],V.prototype,"cullFace",void 0),e([b()],V.prototype,"hasSlicePlane",void 0);class U extends T{constructor(){super(...arguments),this.externalColor=h(1,1,1,1),this.externalColorMixMode=c.Multiply,this.castShadows=H.All}get transparent(){return this.externalColor[3]<1?H.All:H.None}get opaqueOverride(){return this.externalColorMixMode===c.Replace&&1===this.externalColor[3]?H.All:H.None}get visible(){return this.externalColor[3]>0?H.All:H.None}get type(){return x.Uniform}}e([b({vectorOps:n})],U.prototype,"externalColor",void 0),e([b()],U.prototype,"externalColorMixMode",void 0),e([b()],U.prototype,"castShadows",void 0),function(e){e[e.All=0]="All",e[e.Some=1]="Some",e[e.None=2]="None"}(H||(H={}));class _ extends T{constructor(){super(...arguments),this.texture=null,this.transparent=H.None,this.opaqueOverride=H.None,this.castShadows=H.None}get type(){return x.Varying}}function G(e){return null!=e.overlay?.getTexture(d.Highlight)}function z(e){return null!=e.overlay?.getTexture(d.WaterNormal)}function J(e){return null!=e.overlay?.getTexture(d.ColorNoRasterImage)}function K(e){return null!=e.overlay?.getTexture(e.overlay?.allSourcesOccluders?d.ColorNoRasterImage:d.Occluded)}e([b()],_.prototype,"texture",void 0),e([b()],_.prototype,"transparent",void 0),e([b()],_.prototype,"opaqueOverride",void 0),e([b()],_.prototype,"castShadows",void 0);export{V as CommonMaterialParameters,L as ComponentMaterial,H as ComponentParameterSummary,U as ComponentParametersUniform,_ as ComponentParametersVarying};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasArea as o,width as r,height as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{OverlayIndex as a}from"../../../../terrain/interfaces.js";import{OverlayContent as l}from"../../../../terrain/OverlayContent.js";import{RenderPassIdentifier as i}from"../../renderPasses/RenderPassIdentifier.js";import{ShaderOutput as n,isColorOrColorEmission as d}from"../ShaderOutput.js";import{addMainLightDirection as s,addMainLightIntensity as v}from"../shading/MainLighting.glsl.js";import{PBRMode as c}from"../shading/PhysicallyBasedRenderingParameters.glsl.js";import{Water as u}from"../shading/Water.glsl.js";import{Float4DrawUniform as x}from"../../shaderModules/Float4DrawUniform.js";import{FloatPassUniform as y}from"../../shaderModules/FloatPassUniform.js";import{glsl as m}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as p}from"../../shaderModules/Texture2DPassUniform.js";import{Texture2DUintPassUniform as g}from"../../shaderModules/Texture2DUintPassUniform.js";import{Uniform as f}from"../../../../../webgl/Uniform.js";var h;function C(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add(new x("overlayTexOffset",(e,o)=>I(e,o)),new x("overlayTexScale",(e,o)=>V(e,o))),t.constants.add("overlayOpacity","float",1),t.uniforms.add(new p("ovColorTex",(e,o)=>O(e,o))),b(e,o)}function O(e,o){return e.identifier===i.Material&&d(e.output)?e.occludedGround?o.overlay?.
|
|
5
|
+
import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasArea as o,width as r,height as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{OverlayIndex as a}from"../../../../terrain/interfaces.js";import{OverlayContent as l}from"../../../../terrain/OverlayContent.js";import{RenderPassIdentifier as i}from"../../renderPasses/RenderPassIdentifier.js";import{ShaderOutput as n,isColorOrColorEmission as d}from"../ShaderOutput.js";import{addMainLightDirection as s,addMainLightIntensity as v}from"../shading/MainLighting.glsl.js";import{PBRMode as c}from"../shading/PhysicallyBasedRenderingParameters.glsl.js";import{Water as u}from"../shading/Water.glsl.js";import{Float4DrawUniform as x}from"../../shaderModules/Float4DrawUniform.js";import{FloatPassUniform as y}from"../../shaderModules/FloatPassUniform.js";import{glsl as m}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as p}from"../../shaderModules/Texture2DPassUniform.js";import{Texture2DUintPassUniform as g}from"../../shaderModules/Texture2DUintPassUniform.js";import{Uniform as f}from"../../../../../webgl/Uniform.js";var h;function C(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add(new x("overlayTexOffset",(e,o)=>I(e,o)),new x("overlayTexScale",(e,o)=>V(e,o))),t.constants.add("overlayOpacity","float",1),t.uniforms.add(new p("ovColorTex",(e,o)=>O(e,o))),b(e,o)}function O(e,o){return e.identifier===i.Material&&d(e.output)?e.occludedGround?o.overlay?.allSourcesOccluders?o.overlay?.getTexture(l.ColorNoRasterImage):o.overlay?.getTexture(l.Occluded):o.overlay?.getTexture(l.ColorNoRasterImage):e.identifier===i.Material&&e.output===n.ObjectAndLayerIdColor?o.overlay?.getTexture(l.ObjectAndLayerIdColor):e.identifier===i.Highlight?o.overlay?.getTexture(l.Highlight):null}function T(e,o){const{vertex:r,fragment:t}=e,{output:a}=o;r.uniforms.add(new M("overlayTexOffset"),new M("overlayTexScale")),t.uniforms.add(new y("overlayOpacity",e=>e.overlayOpacity)),a!==n.Highlight&&t.uniforms.add(new p("ovColorTex",(e,o)=>o.overlay?.getTexture(e.overlayContent))),b(e,o)}function b(e,o){const r=o.pbrMode===c.Water||o.pbrMode===c.WaterOnIntegratedMesh||o.pbrMode===c.TerrainWithWater;r&&e.include(u,o);const{vertex:t,fragment:a,varyings:i}=e;i.add("vtcOverlay","vec4");const{output:d}=o,x=d===n.Highlight;t.code.add(m`void setOverlayVTC(in vec2 uv) {
|
|
6
6
|
vtcOverlay = vec4(uv, uv) * overlayTexScale + overlayTexOffset;
|
|
7
7
|
}`),a.code.add(m`bool isValid(vec2 uv, vec2 dxdy) {
|
|
8
8
|
return (uv.x >= 0.0 + dxdy.x) && (uv.x <= 1.0 - dxdy.x) && (uv.y >= 0.0 + dxdy.y) && (uv.y <= 1.0 - dxdy.y);
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../core/has.js";import{someMap as r,everyMap as t}from"../../../../core/MapUtils.js";import s from"../../../../core/PooledArray.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{a}from"../../../../chunks/sphere.js";import{OverlayTarget as d}from"../../terrain/Intersector.js";import{ShaderOutput as h}from"../core/shaderLibrary/ShaderOutput.js";import{ChangeSet as c}from"./ChangeSet.js";import{StoreResults as l}from"./IntersectorInterfaces.js";import{IntersectorResult as p}from"./IntersectorResult.js";import{IntersectorType as m}from"./IntersectorType.js";import{DirtyOperation as u,DirtyState as g}from"./ModelDirtyTypes.js";import{RendererBase as y}from"./RendererBase.js";import{RenderSlot as _}from"./RenderSlot.js";import{noBudget as f}from"../../../support/Scheduler.js";let R=class extends y{constructor(e){super(e),this._pending=new G,this._changes=new c,this._sortedRenderers=new s,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.prune(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return r(this.renderers,r=>r.hasHighlight(e))}get hasWater(){return this._hasWater}get
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../core/has.js";import{someMap as r,everyMap as t}from"../../../../core/MapUtils.js";import s from"../../../../core/PooledArray.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{a}from"../../../../chunks/sphere.js";import{OverlayTarget as d}from"../../terrain/Intersector.js";import{ShaderOutput as h}from"../core/shaderLibrary/ShaderOutput.js";import{ChangeSet as c}from"./ChangeSet.js";import{StoreResults as l}from"./IntersectorInterfaces.js";import{IntersectorResult as p}from"./IntersectorResult.js";import{IntersectorType as m}from"./IntersectorType.js";import{DirtyOperation as u,DirtyState as g}from"./ModelDirtyTypes.js";import{RendererBase as y}from"./RendererBase.js";import{RenderSlot as _}from"./RenderSlot.js";import{noBudget as f}from"../../../support/Scheduler.js";let R=class extends y{constructor(e){super(e),this._pending=new G,this._changes=new c,this._sortedRenderers=new s,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.prune(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return r(this.renderers,r=>r.hasHighlight(e))}get hasWater(){return this._hasWater}get hasOnlyOccluders(){const e=t(this.renderers,e=>e.hasOnlyOccluders);return this.renderers?.size>0&&e}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,f,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=r(this.renderers,e=>{const r=e.produces.get(_.DRAPED_MATERIAL);return!!r&&r(h.Highlight)}),this._hasWater=r(this.renderers,e=>{const r=e.produces.get(_.DRAPED_WATER);return!!r&&r(h.Normal)})),this.notifyChange("updating"),!0)}rendererAdded(){this._sortedRenderers.clear()}rendererRemoved(){this._sortedRenderers.clear()}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);s&&this.notifyChange("updating"),r===u.UPDATE&&this._notifyGraphicGeometryChanged(e)}removeGeometries(e,r){if(this.destroyed)return;const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),r===u.UPDATE&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=this._changes.updates.pushNew();e.renderGeometry=this._ensureValidRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case g.TRANSFORMATION:case g.GEOMETRY:return this._notifyGraphicGeometryChanged(e);case g.VISIBILITY:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll(t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r),r}precompile(e){return this._sortedRenderers.reduce((r,t)=>t.precompile(e)||r,!1)}render(e){this._sortedRenderers.forAll(r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)})}intersect(e,r,t,s,i){for(const n of this._geometries.values()){if(!s(n))continue;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;o&&(n.boundingSphere[0]-n.boundingSphere[3]<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),n.boundingSphere[0]+n.boundingSphere[3]>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)),i++}return i}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0))}}_processAddsRemoves(){this._changes.adds.clear(),this._changes.removes.clear(),this._changes.adds.pushArray(Array.from(this._pending.adds)),this._changes.removes.pushArray(Array.from(this._pending.removes)),this._changes.updates.filterInPlace(({renderGeometry:e})=>!this._pending.has(e)),this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible||!e.material.visible||!e.material.intersectDraped)return;let o=0;s+=e.transformation[12],o=e.transformation[13],C[0]=t[0]-s,C[1]=t[1]-o,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersectDraped(e,i,C,(t,s,o)=>{v(r,o,n,e.material.renderPriority,i,e.layerViewUid,e.graphicUid)},r)}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicGeometryChanged(t),r=t)}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(t),r=t)}_validateRenderGeometries(e){for(const r of e)this._ensureValidRenderGeometry(r);return e}_ensureValidRenderGeometry(e){return null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(a(e.boundingSphere))),e}get test(){}};e([i({constructOnly:!0})],R.prototype,"drapeSource",void 0),e([i({constructOnly:!0})],R.prototype,"rendererContext",void 0),e([i()],R.prototype,"updating",null),e([i()],R.prototype,"rctx",null),e([i()],R.prototype,"_localOriginFactory",null),e([i({readOnly:!0})],R.prototype,"isEmpty",null),e([i()],R.prototype,"_geometries",void 0),R=e([n("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],R);class G{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function v(e,r,t,s,i,n,o){const a=new d(n,o,r),h=r=>{r.set(m.OVERLAY,a,e.distance,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.distance||i.results.ground.distance<=i.results.min.distance)&&h(i.results.min),i.options.store!==l.MIN&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.distance||i.results.ground.distance>i.results.max.distance)&&h(i.results.max),i.options.store===l.ALL){const e=new p(i.ray);h(e),i.results.all.push(e)}}const C=o();export{R as SortedRenderGeometryRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{removeUnordered as t,filterInPlace as r}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{nextHighestPowerOfTwo as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{NestedMap as o}from"../../../../../core/NestedMap.js";import a from"../../../../../core/PooledArray.js";import{addMany as n}from"../../../../../core/SetUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{copy as u,invert as f,transpose as c}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as d}from"../../../support/buffer/glUtil.js";import{ShaderOutput as g}from"../../core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as p}from"../../effects/RenderPlugin.js";import{GLMaterials as y}from"../../lib/GLMaterials.js";import{DirtyState as _}from"../../lib/ModelDirtyTypes.js";import{RenderSlot as b}from"../../lib/RenderSlot.js";import{assert as w}from"../../lib/Util.js";import{DrawParameters as v}from"../DrawParameters.js";import{BufferRange as A,mergeAdjacentRanges as O}from"./BufferRange.js";import{Instance as C}from"./Instance.js";import{PerBufferData as E,hasVao as B}from"./PerBufferData.js";import{PerOriginData as M}from"./PerOriginData.js";import{defaultHighlightName as x}from"../../../../support/HighlightDefaults.js";var D;!function(e){e[e.Empty=0]="Empty",e[e.None=1]="None",e[e.Some=2]="Some",e[e.All=3]="All"}(D||(D={}));let S=class extends p{get _hasHighlights(){return this._highlightNames.size>0}hasHighlight(e){return this._highlightNames.has(e)}constructor(e){super(e),this._dataByOrigin=new Map,this._drawParameters=new v,this._highlightNames=new Set,this.drapedPriority=0,this._produces=new Map,this._hasOccludees=D.Empty}destroy(){this._glMaterials=s(this._glMaterials),this._dataByOrigin.forEach(e=>e.dispose()),this._dataByOrigin.clear(),this._vaoCache=null}initialize(){this._updateProduces()}_updateProduces(){this.material.produces.forEach((e,t)=>{this._produces.set(t,t=>!(0===this._dataByOrigin.size||!(t!==g.Highlight&&t!==g.ShadowHighlight||this._hasHighlights))&&e(t))})}initializeRenderContext(e){k??=e.renderContext.rctx.isAssumedMetalDriver,this._glMaterials=new y(this.material,e.materials),this._bufferWriter=this.material.createBufferWriter(),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,d(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}get produces(){return this._produces}get hasOccludees(){return this._hasOccludees===D.Some||this._hasOccludees===D.All}get hasOnlyOccludees(){return this._hasOccludees===D.All}get hasEmissions(){return this.material.hasEmissions}get isDecoration(){return this.material.parameters.isDecoration}get renderOccludedFlags(){return this.material.renderOccludedFlags}get numGeometries(){let e=0;return this._dataByOrigin.forEach(t=>e+=t.buffers.reduce((e,t)=>e+t.instances.size,0)),e}get usedMemory(){let e=0;return this._dataByOrigin.forEach(t=>e+=t.buffers.reduce((e,t)=>e+t.vao.cachedMemory,0)),e}forEachGeometry(e){this._dataByOrigin.forEach(t=>t.buffers.forEach(t=>t.instances.forEach(({geometry:t})=>e(t))))}modify(e,t){this._applyUpdates(e,t),this._applyAddsAndRemoves(e),this._updateDrawCommands()}get canCompact(){for(const e of this._dataByOrigin.values())if(e.buffers.some(e=>e.holes.length>1))return!0;return!1}compact(e){if(!this.canCompact)return!1;let t=!1;for(const r of this._dataByOrigin.values()){const i=new Array;for(let t=0;t<r.buffers.length&&!e.done;){const s=r.buffers[t];s.holes.length<=1?++t:(s.instances.forEach(({geometry:e})=>i.push(e)),this._vaoCache.deleteVao(s.vao),r.buffers[t]=r.buffers[r.buffers.length-1],--r.buffers.length,e.madeProgress())}if(i.length>0){for(r.buffers.forEach(e=>this._applyAdds(e,i));i.length>0;)r.buffers.push(this._applyAndRebuild(new E,i,null));t=!0}}return t}updateHighlights(e){this.highlightOrderMap=e,this._highlightNames.clear(),this._dataByOrigin.forEach(t=>{t.buffers.forEach(t=>{t.updateHighlights(e),t.highlightNames.forEach(e=>this._highlightNames.add(e))})}),this._updateProduces()}_applyUpdates(e,t){const r=this._bufferWriter;if(null==r)return void e.clearUpdates();const i=r.vertexBufferLayout.stride/4;for(const s of e.updates){if(t.done)return;const{renderGeometry:o,updateType:a}=s;e.pending.updates.removeUnordered(s),t.madeProgress();const n=this._dataByOrigin.get(o.localOrigin.id),l=n?.findBuffer(o.id);if(null==l)return;const h=l.instances.get(o.id);if(a&(_.GEOMETRY|_.TRANSFORMATION)){const e=V(r.elementCount(h.geometry.geometry.attributes)*i),t=r.vertexBufferLayout.createView(e.buffer);this._writeGeometry(o,t,0),l.vao.vertexBuffers.get("geometry").setSubData(e,h.from*i,0,h.numElements*i)}a&(_.HIGHLIGHT|_.OCCLUDEE|_.VISIBILITY)&&(l.drawCommandsDirty=!0)}}_computeDeltas(e,t){const r=new o;for(const i of e){const e=i.localOrigin;if(null==e)continue;let t=r.get(e.id,null);null==t&&(t=new H(e.vec3),r.set(e.id,null,t)),t.changes.push(i)}for(const i of t){const e=i.localOrigin;if(null==e)continue;const t=this._dataByOrigin.get(e.id),s=t?.findBuffer(i.id);if(null==s)continue;let o=r.get(e.id,s);null==o&&(o=new H(e.vec3),r.set(e.id,s,o)),o.changes.push(i)}return r}_applyAddsAndRemoves(e){const{_bufferWriter:r,_dataByOrigin:i,_vaoCache:s}=this;if(null==r||null==s)return void e.clearAddsAndRemoves();const o=r.vertexBufferLayout.stride/4,a=this._computeDeltas(e.adds,e.removes);a.forEach((e,n)=>{const l=e.get(null),h=l?.changes??[];a.delete(n,null);let u=i.get(n);if(e.forEach((e,l)=>{if(a.delete(n,l),null==l&&w(!1,"No VAO for removed geometries"),l.instances.size===e.changes.length)return s.deleteVao(l.vao),t(u.buffers,l),void(0===u.buffers.length&&0===h.length&&i.delete(n));const f=l.numElements,c=l.vao.getByteLength("geometry")/4,m=h.reduce((e,t)=>e+r.elementCount(t.geometry.attributes),0),d=e.changes.reduce((e,t)=>e+r.elementCount(t.geometry.attributes),0),g=Math.min((f+m-d)*o,G),p=g>c;g>I&&g<c/2?(e.changes.forEach(({id:e})=>l.deleteInstance(e)),l.instances.forEach(({geometry:e})=>h.push(e)),this._vaoCache.deleteVao(l.vao),t(u.buffers,l)):p?this._applyAndRebuild(l,h,e):this._applyRemoves(l,e)}),h.length>0)for(null==u&&(u=new M(l.origin),i.set(n,u)),u.buffers.forEach(e=>this._applyAdds(e,h));h.length>0;)u.buffers.push(this._applyAndRebuild(new E,h,null))}),e.clearAddsAndRemoves()}_updateDrawCommands(){this._highlightNames.clear();let e=D.Empty;this._dataByOrigin.forEach(t=>{t.buffers.forEach(t=>{t.updateIfDrawCommandsDirty(this.highlightOrderMap,this._bufferWriter.vertexBufferLayout.stride),t.hasHighlights&&n(this._highlightNames,t.highlightNames),t.hasOccludees?(e===D.Empty||e===D.None)&&(e=D.All):(e===D.Empty&&(e=D.None),e===D.All&&(e=D.Some))})}),this._hasOccludees=e}_applyAndRebuild(e,t,r){if(r)for(const m of r.changes)e.deleteInstance(m.id);const i=this._bufferWriter,s=i.vertexBufferLayout.stride,o=s/4,a=Math.floor(G/o);let n=e.numElements;for(;t.length>0;){const r=t.pop(),s=i.elementCount(r.geometry.attributes);if(n+s>a&&n>0){t.push(r);break}n+=s;const o=new C(r,0,0,this.highlightOrderMap);w(null==e.instances.get(r.id)),e.addInstance(r.id,o)}const l=n*o,h=V(l),u=i.vertexBufferLayout.createView(h.buffer);let f=0;e.resetInstanceSummary(),e.instances.forEach((t,r)=>{this._writeGeometry(t.geometry,u,f);const s=f;f+=i.elementCount(t.geometry.geometry.attributes),e.updateInstance(r,s,f),e.updateDrawState(t)}),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(z(l)),e.vao.vertexBuffers.get("geometry").setSubData(h,0,0,f*o),e.holes.clear();const c=e.holes.pushNew();return c.from=f,c.to=Math.floor(e.vao.getByteLength("geometry")/s),e.updateDrawCommands(this.highlightOrderMap,s),e}_applyRemoves(e,t){if(0===t.changes.length||null==this._bufferWriter)return;let r=1/0,i=-1/0;for(const a of t.changes){const t=a.id,s=e.instances.get(t);if(!s)continue;e.deleteInstance(t),k&&(r=Math.min(r,s.from),i=Math.max(i,s.to));const o=N.back();if(o){if(o.to===s.from){o.to=s.to;continue}if(o.from===s.to){o.from=s.from;continue}}const n=N.pushNew();n.from=s.from,n.to=s.to}O(N);const s=this._bufferWriter.vertexBufferLayout.stride/4,o=e.vao.vertexBuffers.get("geometry");if(k){const t=(i-r)*s,a=V(t),n=this._bufferWriter.vertexBufferLayout.createView(a.buffer);a.fill(0,0,t),e.instances.forEach(e=>{if(!(e.from>=r&&e.to<=i))return;const t=e.from-r;this._writeGeometry(e.geometry,n,t)}),o.setSubData(a,r*s,0,t)}else{const e=N.reduce((e,t)=>Math.max(e,t.numElements),0)*s,t=V(e);t.fill(0,0,e),N.forAll(e=>o.setSubData(t,e.from*s,0,e.numElements*s))}e.holes.pushArray(N.data,N.length),N.forAll((e,t)=>N.data[t]=null),N.clear(),e.drawCommandsDirty=!0}_applyAdds(e,t){if(0===t.length||null==this._bufferWriter)return;if(!B(e))return void this._applyAndRebuild(e,t,null);const i=this._bufferWriter,s=i.vertexBufferLayout.stride/4,o=e.numElements,a=t.reduce((e,t)=>e+i.elementCount(t.geometry.attributes),0),n=Math.min((o+a)*s,G),l=4*n;if(e.vao.getByteLength("geometry")<z(G-I)&&l>e.vao.getByteLength("geometry"))return void this._applyAndRebuild(e,t,null);O(e.holes);const h=new Array;let u=1/0,f=-1/0;for(const r of t){const t=i.elementCount(r.geometry.attributes),s=R(e.holes,t);h.push(s),k&&null!=s&&(u=Math.min(s,u),f=Math.max(s+t,f))}const c=e.vao.vertexBuffers.get("geometry");let m=0,d=0,g=0;const p=V(k?(f-u)*s:n),y=i.vertexBufferLayout.createView(p.buffer);if(t.forEach((t,r)=>{const o=h[r];if(null==o)return;const a=i.elementCount(t.geometry.attributes);if(!k){if(!(g===o)){const e=g-d;e>0&&c.setSubData(p,d*s,0,e*s),d=o,m=0}this._writeGeometry(t,y,m),m+=a,g=o+a}const n=new C(t,o,o+a,this.highlightOrderMap);w(null==e.instances.get(t.id)),e.addInstance(t.id,n),e.drawCommandsDirty=!0}),k){const t=(f-u)*s;p.fill(0,0,t),e.instances.forEach(e=>{if(!(e.from>=u&&e.to<=f))return;const t=e.from-u;this._writeGeometry(e.geometry,y,t)}),d=u,g=f}const _=g-d;_>0&&c.setSubData(p,d*s,0,_*s),r(t,(e,t)=>null==h[t])}_writeGeometry(e,t,r){null!=this._bufferWriter&&(u(L,e.transformation),L[12]-=e.localOrigin.vec3[0],L[13]-=e.localOrigin.vec3[1],L[14]-=e.localOrigin.vec3[2],f(j,L),c(j,j),this._bufferWriter.write(L,j,e.geometry.attributes,e.geometry.objectAndLayerIdColor,t,r))}updateAnimation(e){return this.material.update(e)}acquireTechniques(e){if(!this.material.shouldRender(e))return null;const{output:t,bind:r}=e,i=this.material.produces.get(r.slot);if(!i?.(t))return null;const{highlight:s,slot:o}=r,a=t===g.ShadowHighlight,n=t===g.Highlight,l=n||a,h=s?.name;if(l&&(0===this._highlightNames.size||n&&h&&!this._highlightNames.has(h)))return null;const u=e=>n&&!!h&&!e.has(h),f=t===g.ShadowExcludeHighlight,c=!(l||f);for(const{buffers:m}of this._dataByOrigin.values())for(const i of m){if(u(i.highlightNames))continue;const s=a?i.drawCommandsHighlights.get(x):l?h?i.drawCommandsHighlights.get(h):i.drawCommandsHighlights.size>0:((f&&i.needsMultipleCommands()?i.drawCommandsShadowHighlightRest:i.drawCommandsDefault)||null)?.length??!1,n=c&&i.drawCommandsOccludees||null;if(s||n?.length){const i=this._glMaterials.load(e.rctx,o,t),s=i?.beginSlot(r);if(s)return s}}return null}render(e,t){const{output:r,bind:i}=e,{slot:s,highlight:o}=i,n=r===g.Highlight,l=o?.name??"";if(n&&!o)return;const h=r===g.ShadowHighlight,u=n||h,f=r===g.ShadowExcludeHighlight,c=!(u||f),m=s===b.OCCLUDER_MATERIAL||s===b.TRANSPARENT_OCCLUDER_MATERIAL?s:null,{rctx:d}=e;d.runAppleAmdDriverHelper();const p=d.bindTechnique(t,i,this.material.parameters);for(const g of this._dataByOrigin.values())for(const e of g.buffers){if(n&&(!e.hasHighlights||!e.drawCommandsHighlights.has(l)))continue;if(h&&(!e.hasHighlights||!e.drawCommandsHighlights.has(x)))continue;const r=()=>{const t=[],r=e.drawCommandsHighlights.get(x)??new a;return r&&t.push(r),t},s=u&&!h?e.drawCommandsHighlights.get(l)??null:null,o=h?r():u?s?[s]:F:f&&e.needsMultipleCommands()?[e.drawCommandsShadowHighlightRest]:[e.drawCommandsDefault],y=o.some(e=>e.length>0),_=c&&e.drawCommandsOccludees||null;if(y||_?.length){if(this._drawParameters.origin=g.origin,p.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(e.vao),d.bindVAO(e.vao),y)for(const e of o)d.setPipelineState(t.getPipeline(!1,m)),e.forAll(e=>d.drawArrays(t.primitiveType,e.first,e.count));_?.length&&(d.setPipelineState(t.getPipeline(!0,m)),_.forAll(e=>d.drawArrays(t.primitiveType,e.first,e.count)))}}}static prune(){U=new Float32Array(I)}get test(){}};e([l({constructOnly:!0})],S.prototype,"material",void 0),e([l({})],S.prototype,"highlightOrderMap",void 0),S=e([h("esri.views.3d.webgl-engine.materials.renderers.MergedRenderer")],S);class H{constructor(e){this.origin=e,this.changes=new Array}}function R(e,t){const r=e.find(e=>e.numElements>=t);if(null==r)return null;const i=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),i}const L=m(),j=m(),N=new a({allocator:e=>e||new A,deallocator:null}),I=65536,P=4*I,T=1024,W=16777216,G=W/4;let U=new Float32Array(I);function V(e){return U.length<e&&(U=new Float32Array(e)),U}function z(e){const t=4*e;return t<=T?T:t<P?i(t):Math.max(Math.min(Math.ceil(1.5*t/P)*P,W),t)}const F=[];let k;export{S as MergedRenderer,D as OccludeeState,z as sizeForVao};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{removeUnordered as t,filterInPlace as r}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{nextHighestPowerOfTwo as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{NestedMap as o}from"../../../../../core/NestedMap.js";import a from"../../../../../core/PooledArray.js";import{addMany as n}from"../../../../../core/SetUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{copy as u,invert as f,transpose as c}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as m}from"../../../support/buffer/glUtil.js";import{ShaderOutput as g}from"../../core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as p}from"../../effects/RenderPlugin.js";import{GLMaterials as y}from"../../lib/GLMaterials.js";import{RenderOccludedFlag as _}from"../../lib/Material.js";import{DirtyState as b}from"../../lib/ModelDirtyTypes.js";import{RenderSlot as w}from"../../lib/RenderSlot.js";import{assert as v}from"../../lib/Util.js";import{DrawParameters as O}from"../DrawParameters.js";import{BufferRange as C,mergeAdjacentRanges as A}from"./BufferRange.js";import{Instance as E}from"./Instance.js";import{PerBufferData as B,hasVao as M}from"./PerBufferData.js";import{PerOriginData as x}from"./PerOriginData.js";import{defaultHighlightName as D}from"../../../../support/HighlightDefaults.js";let H=class extends p{get _hasHighlights(){return this._highlightNames.size>0}hasHighlight(e){return this._highlightNames.has(e)}constructor(e){super(e),this._dataByOrigin=new Map,this._drawParameters=new O,this._highlightNames=new Set,this.drapedPriority=0,this._produces=new Map,this._hasOccludees=!1}destroy(){this._glMaterials=s(this._glMaterials),this._dataByOrigin.forEach(e=>e.dispose()),this._dataByOrigin.clear(),this._vaoCache=null}initialize(){this._updateProduces()}_updateProduces(){this.material.produces.forEach((e,t)=>{this._produces.set(t,t=>!(0===this._dataByOrigin.size||!(t!==g.Highlight&&t!==g.ShadowHighlight||this._hasHighlights))&&e(t))})}initializeRenderContext(e){k??=e.renderContext.rctx.isAssumedMetalDriver,this._glMaterials=new y(this.material,e.materials),this._bufferWriter=this.material.createBufferWriter(),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,m(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}get produces(){return this._produces}get hasOccludees(){return this._hasOccludees}get hasOnlyOccluders(){return!!(0!==this.numGeometries&&this.renderOccludedFlags&~_.Occlude)}get hasEmissions(){return this.material.hasEmissions}get isDecoration(){return this.material.parameters.isDecoration}get renderOccludedFlags(){return this.material.renderOccludedFlags}get numGeometries(){let e=0;return this._dataByOrigin.forEach(t=>e+=t.buffers.reduce((e,t)=>e+t.instances.size,0)),e}get usedMemory(){let e=0;return this._dataByOrigin.forEach(t=>e+=t.buffers.reduce((e,t)=>e+t.vao.cachedMemory,0)),e}forEachGeometry(e){this._dataByOrigin.forEach(t=>t.buffers.forEach(t=>t.instances.forEach(({geometry:t})=>e(t))))}modify(e,t){this._applyUpdates(e,t),this._applyAddsAndRemoves(e),this._updateDrawCommands()}get canCompact(){for(const e of this._dataByOrigin.values())if(e.buffers.some(e=>e.holes.length>1))return!0;return!1}compact(e){if(!this.canCompact)return!1;let t=!1;for(const r of this._dataByOrigin.values()){const i=new Array;for(let t=0;t<r.buffers.length&&!e.done;){const s=r.buffers[t];s.holes.length<=1?++t:(s.instances.forEach(({geometry:e})=>i.push(e)),this._vaoCache.deleteVao(s.vao),r.buffers[t]=r.buffers[r.buffers.length-1],--r.buffers.length,e.madeProgress())}if(i.length>0){for(r.buffers.forEach(e=>this._applyAdds(e,i));i.length>0;)r.buffers.push(this._applyAndRebuild(new B,i,null));t=!0}}return t}updateHighlights(e){this.highlightOrderMap=e,this._highlightNames.clear(),this._dataByOrigin.forEach(t=>{t.buffers.forEach(t=>{t.updateHighlights(e),t.highlightNames.forEach(e=>this._highlightNames.add(e))})}),this._updateProduces()}_applyUpdates(e,t){const r=this._bufferWriter;if(null==r)return void e.clearUpdates();const i=r.vertexBufferLayout.stride/4;for(const s of e.updates){if(t.done)return;const{renderGeometry:o,updateType:a}=s;e.pending.updates.removeUnordered(s),t.madeProgress();const n=this._dataByOrigin.get(o.localOrigin.id),l=n?.findBuffer(o.id);if(null==l)return;const h=l.instances.get(o.id);if(a&(b.GEOMETRY|b.TRANSFORMATION)){const e=V(r.elementCount(h.geometry.geometry.attributes)*i),t=r.vertexBufferLayout.createView(e.buffer);this._writeGeometry(o,t,0),l.vao.vertexBuffers.get("geometry").setSubData(e,h.from*i,0,h.numElements*i)}a&(b.HIGHLIGHT|b.OCCLUDEE|b.VISIBILITY)&&(l.drawCommandsDirty=!0)}}_computeDeltas(e,t){const r=new o;for(const i of e){const e=i.localOrigin;if(null==e)continue;let t=r.get(e.id,null);null==t&&(t=new R(e.vec3),r.set(e.id,null,t)),t.changes.push(i)}for(const i of t){const e=i.localOrigin;if(null==e)continue;const t=this._dataByOrigin.get(e.id),s=t?.findBuffer(i.id);if(null==s)continue;let o=r.get(e.id,s);null==o&&(o=new R(e.vec3),r.set(e.id,s,o)),o.changes.push(i)}return r}_applyAddsAndRemoves(e){const{_bufferWriter:r,_dataByOrigin:i,_vaoCache:s}=this;if(null==r||null==s)return void e.clearAddsAndRemoves();const o=r.vertexBufferLayout.stride/4,a=this._computeDeltas(e.adds,e.removes);a.forEach((e,n)=>{const l=e.get(null),h=l?.changes??[];a.delete(n,null);let u=i.get(n);if(e.forEach((e,l)=>{if(a.delete(n,l),null==l&&v(!1,"No VAO for removed geometries"),l.instances.size===e.changes.length)return s.deleteVao(l.vao),t(u.buffers,l),void(0===u.buffers.length&&0===h.length&&i.delete(n));const f=l.numElements,c=l.vao.getByteLength("geometry")/4,d=h.reduce((e,t)=>e+r.elementCount(t.geometry.attributes),0),m=e.changes.reduce((e,t)=>e+r.elementCount(t.geometry.attributes),0),g=Math.min((f+d-m)*o,W),p=g>c;g>I&&g<c/2?(e.changes.forEach(({id:e})=>l.deleteInstance(e)),l.instances.forEach(({geometry:e})=>h.push(e)),this._vaoCache.deleteVao(l.vao),t(u.buffers,l)):p?this._applyAndRebuild(l,h,e):this._applyRemoves(l,e)}),h.length>0)for(null==u&&(u=new x(l.origin),i.set(n,u)),u.buffers.forEach(e=>this._applyAdds(e,h));h.length>0;)u.buffers.push(this._applyAndRebuild(new B,h,null))}),e.clearAddsAndRemoves()}_updateDrawCommands(){this._highlightNames.clear(),this._hasOccludees=!1,this._dataByOrigin.forEach(e=>{e.buffers.forEach(e=>{e.updateIfDrawCommandsDirty(this.highlightOrderMap,this._bufferWriter.vertexBufferLayout.stride),e.hasHighlights&&n(this._highlightNames,e.highlightNames),this._hasOccludees||=e.hasOccludees})})}_applyAndRebuild(e,t,r){if(r)for(const d of r.changes)e.deleteInstance(d.id);const i=this._bufferWriter,s=i.vertexBufferLayout.stride,o=s/4,a=Math.floor(W/o);let n=e.numElements;for(;t.length>0;){const r=t.pop(),s=i.elementCount(r.geometry.attributes);if(n+s>a&&n>0){t.push(r);break}n+=s;const o=new E(r,0,0,this.highlightOrderMap);v(null==e.instances.get(r.id)),e.addInstance(r.id,o)}const l=n*o,h=V(l),u=i.vertexBufferLayout.createView(h.buffer);let f=0;e.resetInstanceSummary(),e.instances.forEach((t,r)=>{this._writeGeometry(t.geometry,u,f);const s=f;f+=i.elementCount(t.geometry.geometry.attributes),e.updateInstance(r,s,f),e.updateDrawState(t)}),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(z(l)),e.vao.vertexBuffers.get("geometry").setSubData(h,0,0,f*o),e.holes.clear();const c=e.holes.pushNew();return c.from=f,c.to=Math.floor(e.vao.getByteLength("geometry")/s),e.updateDrawCommands(this.highlightOrderMap,s),e}_applyRemoves(e,t){if(0===t.changes.length||null==this._bufferWriter)return;let r=1/0,i=-1/0;for(const a of t.changes){const t=a.id,s=e.instances.get(t);if(!s)continue;e.deleteInstance(t),k&&(r=Math.min(r,s.from),i=Math.max(i,s.to));const o=N.back();if(o){if(o.to===s.from){o.to=s.to;continue}if(o.from===s.to){o.from=s.from;continue}}const n=N.pushNew();n.from=s.from,n.to=s.to}A(N);const s=this._bufferWriter.vertexBufferLayout.stride/4,o=e.vao.vertexBuffers.get("geometry");if(k){const t=(i-r)*s,a=V(t),n=this._bufferWriter.vertexBufferLayout.createView(a.buffer);a.fill(0,0,t),e.instances.forEach(e=>{if(!(e.from>=r&&e.to<=i))return;const t=e.from-r;this._writeGeometry(e.geometry,n,t)}),o.setSubData(a,r*s,0,t)}else{const e=N.reduce((e,t)=>Math.max(e,t.numElements),0)*s,t=V(e);t.fill(0,0,e),N.forAll(e=>o.setSubData(t,e.from*s,0,e.numElements*s))}e.holes.pushArray(N.data,N.length),N.forAll((e,t)=>N.data[t]=null),N.clear(),e.drawCommandsDirty=!0}_applyAdds(e,t){if(0===t.length||null==this._bufferWriter)return;if(!M(e))return void this._applyAndRebuild(e,t,null);const i=this._bufferWriter,s=i.vertexBufferLayout.stride/4,o=e.numElements,a=t.reduce((e,t)=>e+i.elementCount(t.geometry.attributes),0),n=Math.min((o+a)*s,W),l=4*n;if(e.vao.getByteLength("geometry")<z(W-I)&&l>e.vao.getByteLength("geometry"))return void this._applyAndRebuild(e,t,null);A(e.holes);const h=new Array;let u=1/0,f=-1/0;for(const r of t){const t=i.elementCount(r.geometry.attributes),s=j(e.holes,t);h.push(s),k&&null!=s&&(u=Math.min(s,u),f=Math.max(s+t,f))}const c=e.vao.vertexBuffers.get("geometry");let d=0,m=0,g=0;const p=V(k?(f-u)*s:n),y=i.vertexBufferLayout.createView(p.buffer);if(t.forEach((t,r)=>{const o=h[r];if(null==o)return;const a=i.elementCount(t.geometry.attributes);if(!k){if(!(g===o)){const e=g-m;e>0&&c.setSubData(p,m*s,0,e*s),m=o,d=0}this._writeGeometry(t,y,d),d+=a,g=o+a}const n=new E(t,o,o+a,this.highlightOrderMap);v(null==e.instances.get(t.id)),e.addInstance(t.id,n),e.drawCommandsDirty=!0}),k){const t=(f-u)*s;p.fill(0,0,t),e.instances.forEach(e=>{if(!(e.from>=u&&e.to<=f))return;const t=e.from-u;this._writeGeometry(e.geometry,y,t)}),m=u,g=f}const _=g-m;_>0&&c.setSubData(p,m*s,0,_*s),r(t,(e,t)=>null==h[t])}_writeGeometry(e,t,r){null!=this._bufferWriter&&(u(L,e.transformation),L[12]-=e.localOrigin.vec3[0],L[13]-=e.localOrigin.vec3[1],L[14]-=e.localOrigin.vec3[2],f(S,L),c(S,S),this._bufferWriter.write(L,S,e.geometry.attributes,e.geometry.objectAndLayerIdColor,t,r))}updateAnimation(e){return this.material.update(e)}acquireTechniques(e){if(!this.material.shouldRender(e))return null;const{output:t,bind:r}=e,i=this.material.produces.get(r.slot);if(!i?.(t))return null;const{highlight:s,slot:o}=r,a=t===g.ShadowHighlight,n=t===g.Highlight,l=n||a,h=s?.name;if(l&&(0===this._highlightNames.size||n&&h&&!this._highlightNames.has(h)))return null;const u=e=>n&&!!h&&!e.has(h),f=t===g.ShadowExcludeHighlight,c=!(l||f);for(const{buffers:d}of this._dataByOrigin.values())for(const i of d){if(u(i.highlightNames))continue;const s=a?i.drawCommandsHighlights.get(D):l?h?i.drawCommandsHighlights.get(h):i.drawCommandsHighlights.size>0:((f&&i.needsMultipleCommands()?i.drawCommandsShadowHighlightRest:i.drawCommandsDefault)||null)?.length??!1,n=c&&i.drawCommandsOccludees||null;if(s||n?.length){const i=this._glMaterials.load(e.rctx,o,t),s=i?.beginSlot(r);if(s)return s}}return null}render(e,t){const{output:r,bind:i}=e,{slot:s,highlight:o}=i,n=r===g.Highlight,l=o?.name??"";if(n&&!o)return;const h=r===g.ShadowHighlight,u=n||h,f=r===g.ShadowExcludeHighlight,c=!(u||f),d=s===w.OCCLUDER_MATERIAL||s===w.TRANSPARENT_OCCLUDER_MATERIAL?s:null,{rctx:m}=e;m.runAppleAmdDriverHelper();const p=m.bindTechnique(t,i,this.material.parameters);for(const g of this._dataByOrigin.values())for(const e of g.buffers){if(n&&(!e.hasHighlights||!e.drawCommandsHighlights.has(l)))continue;if(h&&(!e.hasHighlights||!e.drawCommandsHighlights.has(D)))continue;const r=()=>{const t=[],r=e.drawCommandsHighlights.get(D)??new a;return r&&t.push(r),t},s=u&&!h?e.drawCommandsHighlights.get(l)??null:null,o=h?r():u?s?[s]:F:f&&e.needsMultipleCommands()?[e.drawCommandsShadowHighlightRest]:[e.drawCommandsDefault],y=o.some(e=>e.length>0),_=c&&e.drawCommandsOccludees||null;if(y||_?.length){if(this._drawParameters.origin=g.origin,p.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(e.vao),m.bindVAO(e.vao),y)for(const e of o)m.setPipelineState(t.getPipeline(!1,d)),e.forAll(e=>m.drawArrays(t.primitiveType,e.first,e.count));_?.length&&(m.setPipelineState(t.getPipeline(!0,d)),_.forAll(e=>m.drawArrays(t.primitiveType,e.first,e.count)))}}}static prune(){U=new Float32Array(I)}get test(){}};e([l({constructOnly:!0})],H.prototype,"material",void 0),e([l({})],H.prototype,"highlightOrderMap",void 0),H=e([h("esri.views.3d.webgl-engine.materials.renderers.MergedRenderer")],H);class R{constructor(e){this.origin=e,this.changes=new Array}}function j(e,t){const r=e.find(e=>e.numElements>=t);if(null==r)return null;const i=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),i}const L=d(),S=d(),N=new a({allocator:e=>e||new C,deallocator:null}),I=65536,P=4*I,T=1024,G=16777216,W=G/4;let U=new Float32Array(I);function V(e){return U.length<e&&(U=new Float32Array(e)),U}function z(e){const t=4*e;return t<=T?T:t<P?i(t):Math.max(Math.min(Math.ceil(1.5*t/P)*P,G),t)}const F=[];let k;export{H as MergedRenderer,z as sizeForVao};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[7848],{159:(e,t,r)=>{r.d(t,{A:()=>u});var n,i=r(90237),o=r(69622),s=r(10107),a=(r(44208),r(53966),r(87811),r(40608)),l=r(99157);let u=n=class extends o.A{constructor(e){super(e),this.steps=[]}getInverse(){const e=new n;for(let t=this.steps.length-1;t>=0;t--){const r=this.steps[t];e.steps.push(r.getInverse())}return e}};(0,i._)([(0,s.MZ)({type:[l.A],nonNullable:!0})],u.prototype,"steps",void 0),u=n=(0,i._)([(0,a.$)("esri.geometry.operators.support.GeographicTransformation")],u)},1626:(e,t,r)=>{r.d(t,{A:()=>c});var n,i=r(90237),o=r(4718),s=r(10107),a=(r(44208),r(53966),r(40608)),l=r(2485),u=r(72606);let c=n=class extends u.A{constructor(e){super(e),this.colorRamps=null,this.type="multipart"}clone(){return new n({colorRamps:(0,o.o8)(this.colorRamps)})}};(0,i._)([(0,s.MZ)({type:[l.A],json:{write:!0}})],c.prototype,"colorRamps",void 0),(0,i._)([(0,s.MZ)({type:["multipart"]})],c.prototype,"type",void 0),c=n=(0,i._)([(0,a.$)("esri.rest.support.MultipartColorRamp")],c)},2485:(e,t,r)=>{r.d(t,{A:()=>d});var n,i=r(90237),o=r(68197),s=r(4718),a=r(10107),l=r(56507),u=r(93223),c=r(40608),p=r(72606);let d=n=class extends p.A{constructor(e){super(e),this.algorithm=null,this.fromColor=null,this.toColor=null,this.type="algorithmic"}clone(){return new n({fromColor:(0,s.o8)(this.fromColor),toColor:(0,s.o8)(this.toColor),algorithm:this.algorithm})}};(0,i._)([(0,u.e)({esriCIELabAlgorithm:"cie-lab",esriHSVAlgorithm:"hsv",esriLabLChAlgorithm:"lab-lch"})],d.prototype,"algorithm",void 0),(0,i._)([(0,a.MZ)({type:o.A,json:{type:[l.jz],write:!0}})],d.prototype,"fromColor",void 0),(0,i._)([(0,a.MZ)({type:o.A,json:{type:[l.jz],write:!0}})],d.prototype,"toColor",void 0),(0,i._)([(0,a.MZ)({type:["algorithmic"]})],d.prototype,"type",void 0),d=n=(0,i._)([(0,c.$)("esri.rest.support.AlgorithmicColorRamp")],d)},20437:(e,t,r)=>{r.d(t,{A:()=>m});var n,i=r(90237),o=r(66552),s=r(25482),a=r(10107),l=r(56507),u=(r(44208),r(87811),r(93223)),c=r(36005),p=r(40608),d=r(80451),f=r(98453);const h=new o.J({binary:"binary",coordinate:"coordinate",countOrAmount:"count-or-amount",dateAndTime:"date-and-time",description:"description",locationOrPlaceName:"location-or-place-name",measurement:"measurement",nameOrTitle:"name-or-title",none:"none",orderedOrRanked:"ordered-or-ranked",percentageOrRatio:"percentage-or-ratio",typeOrCategory:"type-or-category",uniqueIdentifier:"unique-identifier"});let m=class extends s.A{static{n=this}constructor(e){super(e),this.alias=null,this.defaultValue=void 0,this.description=null,this.domain=null,this.editable=!0,this.length=void 0,this.name=null,this.nullable=!0,this.type=null,this.valueType=null,this.visible=!0}readDescription(e,{description:t}){let r=null;try{r=t?JSON.parse(t):null}catch(e){}return r?.value??null}readValueType(e,{description:t}){let r=null;try{r=t?JSON.parse(t):null}catch(e){}return r?h.fromJSON(r.fieldValueType):null}clone(){return new n({alias:this.alias,defaultValue:this.defaultValue,description:this.description,domain:this.domain?.clone()??null,editable:this.editable,length:this.length,name:this.name,nullable:this.nullable,type:this.type,valueType:this.valueType,visible:this.visible})}};(0,i._)([(0,a.MZ)({type:String,json:{write:!0}})],m.prototype,"alias",void 0),(0,i._)([(0,a.MZ)({type:[String,Number],json:{write:{allowNull:!0}}})],m.prototype,"defaultValue",void 0),(0,i._)([(0,a.MZ)()],m.prototype,"description",void 0),(0,i._)([(0,c.w)("description")],m.prototype,"readDescription",null),(0,i._)([(0,a.MZ)({types:d.gK,json:{read:{reader:d.rS},write:!0}})],m.prototype,"domain",void 0),(0,i._)([(0,a.MZ)({type:Boolean,json:{write:!0}})],m.prototype,"editable",void 0),(0,i._)([(0,a.MZ)({type:l.jz,json:{write:{overridePolicy:e=>({enabled:Number.isFinite(e)})}}})],m.prototype,"length",void 0),(0,i._)([(0,a.MZ)({type:String,json:{write:!0}})],m.prototype,"name",void 0),(0,i._)([(0,a.MZ)({type:Boolean,json:{write:!0}})],m.prototype,"nullable",void 0),(0,i._)([(0,u.e)(f.m)],m.prototype,"type",void 0),(0,i._)([(0,a.MZ)()],m.prototype,"valueType",void 0),(0,i._)([(0,c.w)("valueType",["description"])],m.prototype,"readValueType",null),(0,i._)([(0,a.MZ)({type:Boolean,json:{read:!1}})],m.prototype,"visible",void 0),m=n=(0,i._)([(0,p.$)("esri.layers.support.Field")],m)},21312:(e,t,r)=>{r.d(t,{A:()=>m});var n,i=r(90237),o=r(10107),s=(r(44208),r(53966),r(87811),r(93223)),a=r(36005),l=r(40608),u=r(43937),c=r(5443),p=r(86738),d=r(82434);function f(e,t,r){const{x:n,y:i}=t;if(r<2)return{x:e[0]+n*e[2]+i*e[4],y:e[1]+n*e[3]+i*e[5]};if(2===r){const t=n*n,r=i*i,o=n*i;return{x:e[0]+n*e[2]+i*e[4]+t*e[6]+o*e[8]+r*e[10],y:e[1]+n*e[3]+i*e[5]+t*e[7]+o*e[9]+r*e[11]}}const o=n*n,s=i*i,a=n*i,l=o*n,u=o*i,c=n*s,p=i*s;return{x:e[0]+n*e[2]+i*e[4]+o*e[6]+a*e[8]+s*e[10]+l*e[12]+u*e[14]+c*e[16]+p*e[18],y:e[1]+n*e[3]+i*e[5]+o*e[7]+a*e[9]+s*e[11]+l*e[13]+u*e[15]+c*e[17]+p*e[19]}}function h(e,t,r){const{xmin:n,ymin:i,xmax:o,ymax:s,spatialReference:a}=t;let l=[];if(r<2)l.push({x:n,y:s}),l.push({x:o,y:s}),l.push({x:n,y:i}),l.push({x:o,y:i});else{let e=10;for(let t=0;t<e;t++)l.push({x:n,y:i+(s-i)*t/(e-1)}),l.push({x:o,y:i+(s-i)*t/(e-1)});e=8;for(let t=1;t<=e;t++)l.push({x:n+(o-n)*t/e,y:i}),l.push({x:n+(o-n)*t/e,y:s})}l=l.map(t=>f(e,t,r));const u=l.map(e=>e.x),p=l.map(e=>e.y);return new c.A({xmin:Math.min.apply(null,u),xmax:Math.max.apply(null,u),ymin:Math.min.apply(null,p),ymax:Math.max.apply(null,p),spatialReference:a})}let m=n=class extends d.A{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(e,t){const{coeffX:r,coeffY:n}=t;if(!r?.length||!n?.length||r.length!==n.length)return null;const i=[];for(let e=0;e<r.length;e++)i.push(r[e]),i.push(n[e]);return i}writeForwardCoefficients(e,t,r){const n=[],i=[];for(let t=0;t<e?.length;t++)t%2==0?n.push(e[t]):i.push(e[t]);t.coeffX=n,t.coeffY=i}get inverseCoefficients(){let e=this._get("inverseCoefficients");const t=this._get("forwardCoefficients");return!e&&t&&this.polynomialOrder<2&&(e=function(e){const[t,r,n,i,o,s]=e,a=n*s-o*i,l=o*i-n*s;return[(o*r-t*s)/a,(n*r-t*i)/l,s/a,i/l,-o/a,-n/l]}(t)),e}set inverseCoefficients(e){this._set("inverseCoefficients",e)}readInverseCoefficients(e,t){const{inverseCoeffX:r,inverseCoeffY:n}=t;if(!r?.length||!n?.length||r.length!==n.length)return null;const i=[];for(let e=0;e<r.length;e++)i.push(r[e]),i.push(n[e]);return i}writeInverseCoefficients(e,t,r){const n=[],i=[];for(let t=0;t<e?.length;t++)t%2==0?n.push(e[t]):i.push(e[t]);t.inverseCoeffX=n,t.inverseCoeffY=i}get affectsPixelSize(){return this.polynomialOrder>0}forwardTransform(e){if("point"===e.type){const t=f(this.forwardCoefficients,e,this.polynomialOrder);return new p.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return h(this.forwardCoefficients,e,this.polynomialOrder)}inverseTransform(e){if("point"===e.type){const t=f(this.inverseCoefficients,e,this.polynomialOrder);return new p.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return h(this.inverseCoefficients,e,this.polynomialOrder)}clone(){return new n({polynomialOrder:this.polynomialOrder,forwardCoefficients:this.forwardCoefficients?[...this.forwardCoefficients]:null,inverseCoefficients:this.inverseCoefficients?[...this.inverseCoefficients]:null})}};(0,i._)([(0,o.MZ)({json:{write:!0}})],m.prototype,"polynomialOrder",void 0),(0,i._)([(0,o.MZ)()],m.prototype,"forwardCoefficients",void 0),(0,i._)([(0,a.w)("forwardCoefficients",["coeffX","coeffY"])],m.prototype,"readForwardCoefficients",null),(0,i._)([(0,u.K)("forwardCoefficients")],m.prototype,"writeForwardCoefficients",null),(0,i._)([(0,o.MZ)({json:{write:!0}})],m.prototype,"inverseCoefficients",null),(0,i._)([(0,a.w)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],m.prototype,"readInverseCoefficients",null),(0,i._)([(0,u.K)("inverseCoefficients")],m.prototype,"writeInverseCoefficients",null),(0,i._)([(0,o.MZ)()],m.prototype,"affectsPixelSize",null),(0,i._)([(0,s.e)({PolynomialXform:"polynomial"})],m.prototype,"type",void 0),m=n=(0,i._)([(0,l.$)("esri.layers.support.rasterTransforms.PolynomialTransform")],m)},30139:(e,t,r)=>{r.r(t),r.d(t,{default:()=>O});var n,i=r(5443),o=r(86738),s=r(159),a=r(14140),l=r(51244),u=r(28435),c=r(6049),p=r(70834),d=r(6952),f=r(14636),h=r(73037),m=r(90237),y=(r(53966),r(44208),r(87811),r(49186),r(93223)),g=r(40608),v=r(82434);let b=n=class extends v.A{constructor(){super(...arguments),this.type="identity"}clone(){return new n}};(0,m._)([(0,y.e)({IdentityXform:"identity"})],b.prototype,"type",void 0),b=n=(0,m._)([(0,g.$)("esri.layers.support.rasterTransforms.IdentityTransform")],b);var w=r(21312);const x={GCSShiftXform:h.A,IdentityXform:b,PolynomialXform:w.A};function M(e){const t=e?.type;if(!t)return null;const r=x[e?.type];if(r){const t=new r;return t.read(e),t}return null}var A=r(85676),S=r(4095);function _(e){if(!e)return{result:null,transferList:[]};const{pixelBlock:t,transferList:r}=e.getTransferableObject();return{result:t,transferList:r}}class O{convertVectorFieldData(e){const t=a.A.fromJSON(e.pixelBlock),r=_((0,f.FI)(t,e.type));return Promise.resolve(r)}convertPixelBlockToFeatures(e){const t=(0,u.L)({pixelBlock:a.A.fromJSON(e.pixelBlock),extent:i.A.fromJSON(e.extent),fieldNames:e.fieldNames,skipFactor:e.skipFactor,skipSpatialReference:!0,pixelIdOffset:e.pixelIdOffset,imageRowSize:e.imageRowSize});return Promise.resolve(t)}computeStatisticsHistograms(e){const t=a.A.fromJSON(e.pixelBlock),r=(0,d.eH)(t);return Promise.resolve(r)}async decode(e){return _(await(0,l.D)(e.data,e.options))}symbolize(e){e.pixelBlock=a.A.fromJSON(e.pixelBlock),e.extent=e.extent?i.A.fromJSON(e.extent):null;const t=_(this.symbolizer.symbolize(e));return Promise.resolve(t)}async updateSymbolizer(e){this.symbolizer=A.A.fromJSON(e.symbolizerJSON),e.histograms&&"rasterStretch"===this.symbolizer?.rendererJSON.type&&(this.symbolizer.rendererJSON.histograms=e.histograms)}async updateRasterFunction(e){this.rasterFunction=(0,c.vt)(e.rasterFunctionJSON)}async process(e){return _(this.rasterFunction.process({extent:i.A.fromJSON(e.extent),primaryPixelBlocks:e.primaryPixelBlocks.map(e=>null!=e?a.A.fromJSON(e):null),primaryPixelSizes:e.primaryPixelSizes?.map(e=>null!=e?o.A.fromJSON(e):null),primaryRasterIds:e.primaryRasterIds}))}stretch(e){const t=_(this.symbolizer.simpleStretch(a.A.fromJSON(e.srcPixelBlock),e.stretchParams));return Promise.resolve(t)}estimateStatisticsHistograms(e){const t=(0,d.f4)(a.A.fromJSON(e.srcPixelBlock));return Promise.resolve(t)}split(e){const t=(0,u.lD)(a.A.fromJSON(e.srcPixelBlock),e.tileSize,e.maximumPyramidLevel??0,!1===e.useBilinear),r=[];let n;return t&&(n=new Map,t.forEach((e,t)=>{if(e){const{pixelBlock:i,transferList:o}=e.getTransferableObject();n.set(t,i),o.forEach(e=>{r.includes(e)||r.push(e)})}})),Promise.resolve({result:n,transferList:r})}clipTile(e){const t=a.A.fromJSON(e.pixelBlock),r=_((0,u.J$)({...e,pixelBlock:t}));return Promise.resolve(r)}async mosaicAndTransform(e){const t=e.srcPixelBlocks.map(e=>e?new a.A(e):null),r=(0,u.z7)(t,e.srcMosaicSize,{blockWidths:e.blockWidths,alignmentInfo:e.alignmentInfo,clipOffset:e.clipOffset,clipSize:e.clipSize});let n,i=r;e.coefs&&(i=(0,u.$i)(r,e.destDimension,e.coefs,e.sampleSpacing,e.interpolation)),e.projectDirections&&e.gcsGrid&&(n=(0,u.QF)(e.destDimension,e.gcsGrid),i=(0,f.Y2)(i,e.isUV?"vector-uv":"vector-magdir",n));const{result:o,transferList:s}=_(i);return{result:{pixelBlock:o,localNorthDirections:n},transferList:s}}async createFlowMesh(e,t){const r={data:new Float32Array(e.flowData.buffer),mask:new Uint8Array(e.flowData.maskBuffer),width:e.flowData.width,height:e.flowData.height},{vertexData:n,indexData:i}=await(0,S.CW)(e.meshType,e.simulationSettings,r,t.signal);return{result:{vertexBuffer:n.buffer,indexBuffer:i.buffer},transferList:[n.buffer,i.buffer]}}async getProjectionOffsetGrid(e){const t=i.A.fromJSON(e.projectedExtent),r=i.A.fromJSON(e.srcBufferExtent);let n=null;e.datumTransformationSteps?.length&&(n=new s.A({steps:e.datumTransformationSteps})),await(0,p.Hh)();const o=e.rasterTransform?M(e.rasterTransform):null;return(0,p.l0)({...e,projectedExtent:t,srcBufferExtent:r,datumTransformation:n,rasterTransform:o})}}},34304:(e,t,r)=>{r.d(t,{DF:()=>l,FD:()=>i,Ov:()=>o,ct:()=>u});let n=1e-6;function i(){return n}const o=Math.random,s=Math.PI/180,a=180/Math.PI;function l(e){return e*s}function u(e){return e*a}Object.freeze(Object.defineProperty({__proto__:null,RANDOM:o,equals:function(e,t){return Math.abs(e-t)<=n*Math.max(1,Math.abs(e),Math.abs(t))},getEpsilon:i,setEpsilon:function(e){n=e},toDegree:u,toRadian:l},Symbol.toStringTag,{value:"Module"}))},39357:(e,t,r)=>{r.d(t,{H:()=>l});var n,i=r(90237),o=r(25482),s=r(10107),a=(r(44208),r(53966),r(87811),r(40608));let l=n=class extends o.A{constructor(e){super(e),this.name=null,this.code=null}clone(){return new n({name:this.name,code:this.code})}};(0,i._)([(0,s.MZ)({type:String,json:{write:{isRequired:!0}}})],l.prototype,"name",void 0),(0,i._)([(0,s.MZ)({type:[String,Number],json:{write:{isRequired:!0}}})],l.prototype,"code",void 0),l=n=(0,i._)([(0,a.$)("esri.layers.support.CodedValue")],l)},40876:(e,t,r)=>{r.d(t,{Eq:()=>f,G1:()=>m,TS:()=>o,Tf:()=>v,V6:()=>i,Vm:()=>h,ay:()=>l,c1:()=>y,c4:()=>s,j5:()=>u,lT:()=>p,oW:()=>c});const n={transparent:[0,0,0,0],black:[0,0,0,1],silver:[192,192,192,1],gray:[128,128,128,1],white:[255,255,255,1],maroon:[128,0,0,1],red:[255,0,0,1],purple:[128,0,128,1],fuchsia:[255,0,255,1],green:[0,128,0,1],lime:[0,255,0,1],olive:[128,128,0,1],yellow:[255,255,0,1],navy:[0,0,128,1],blue:[0,0,255,1],teal:[0,128,128,1],aqua:[0,255,255,1],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],blanchedalmond:[255,235,205,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],oldlace:[253,245,230,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],rebeccapurple:[102,51,153,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],whitesmoke:[245,245,245,1],yellowgreen:[154,205,50,1]};function i(e){return!!n[e]||!!n[e.toLowerCase()]}function o(e){return n[e]??n[e.toLowerCase()]}function s(e){return[...o(e)]}function a(e,t,r){r<0&&++r,r>1&&--r;const n=6*r;return n<1?e+(t-e)*n:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}function l(e,t,r,n=1){const i=(e%360+360)%360/360,o=r<=.5?r*(t+1):r+t-r*t,s=2*r-o;return[Math.round(255*a(s,o,i+1/3)),Math.round(255*a(s,o,i)),Math.round(255*a(s,o,i-1/3)),n]}function u(e){const t=e.length>5,r=t?8:4,n=(1<<r)-1,i=t?1:17,o=t?9===e.length:5===e.length;let s=Number("0x"+e.slice(1));if(isNaN(s))return null;const a=[0,0,0,1];let l;return o&&(l=s&n,s>>=r,a[3]=i*l/255),l=s&n,s>>=r,a[2]=i*l,l=s&n,s>>=r,a[1]=i*l,l=s&n,s>>=r,a[0]=i*l,a}function c(e){if("#"!==e[0]||isNaN(Number(`0x${e.slice(1)}`)))return null;switch(e.length){case 4:case 5:{const t=parseInt(e.slice(1,2),16),r=parseInt(e.slice(2,3),16),n=parseInt(e.slice(3,4),16),i=5===e.length?15:parseInt(e.slice(4),16);return[t+16*t,r+16*r,n+16*n,(i+16*i)/255]}case 7:case 9:return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16),(7===e.length?255:parseInt(e.slice(7),16))/255];default:return null}}function p(e){const t=e.toLowerCase().match(/^(rgba?|hsla?)\(([\s.\-,%0-9]+)\)/);if(t){const e=t[2].split(/\s*,\s*/),r=t[1];if("rgb"===r&&3===e.length||"rgba"===r&&4===e.length){const t=e[0];if("%"===t.charAt(t.length-1)){const t=e.map(e=>2.56*parseFloat(e));return 4===e.length&&(t[3]=parseFloat(e[3])),d(t)}return d(e.map(e=>parseFloat(e)))}if("hsl"===r&&3===e.length||"hsla"===r&&4===e.length)return l(parseFloat(e[0]),parseFloat(e[1])/100,parseFloat(e[2])/100,parseFloat(e[3]))}return null}function d(e){return e[0]=y(e[0]),e[1]=y(e[1]),e[2]=y(e[2]),e[3]=4===e.length?m(e[3]):1,e}function f(e){let t=i(e)?o(e):null;return t??=p(e),t??=c(e),t}function h(e){const t=f(e);return null!=t?[t[0]/255,t[1]/255,t[2]/255,t[3]]:null}function m(e){return g(e,0,1)}function y(e){return Math.round(g(e,0,255))}function g(e,t,r){return e=Number(e),isNaN(e)?r:e<t?t:e>r?r:e}const v=2.2},51850:(e,t,r)=>{function n(){return[0,0,0]}function i(e){return[e[0],e[1],e[2]]}function o(e,t,r){return[e,t,r]}function s(e,t,r){return[e,t,r]}function a(e,t=[0,0,0]){const r=Math.min(3,e.length);for(let n=0;n<r;++n)t[n]=e[n];return t}function l(){return o(1,1,1)}function u(){return o(1,0,0)}function c(){return o(0,1,0)}function p(){return o(0,0,1)}r.d(t,{CN:()=>s,Cb:()=>y,Cw:()=>h,JP:()=>m,Un:()=>f,ci:()=>a,fA:()=>o,o8:()=>i,uY:()=>d,vt:()=>n});const d=[0,0,0],f=l(),h=u(),m=c(),y=p();Object.freeze(Object.defineProperty({__proto__:null,ONES:f,UNIT_X:h,UNIT_Y:m,UNIT_Z:y,ZEROS:d,clone:i,create:n,freeze:s,fromArray:a,fromValues:o,ones:l,unitX:u,unitY:c,unitZ:p,zeros:function(){return[0,0,0]}},Symbol.toStringTag,{value:"Module"}))},53177:(e,t,r)=>{r.d(t,{A:()=>p});var n,i=r(90237),o=r(4718),s=r(10107),a=(r(44208),r(53966),r(93223)),l=r(40608),u=r(39357),c=r(76357);let p=class extends c.A{static{n=this}constructor(e){super(e),this.codedValues=null,this.type="coded-value"}getName(e){let t=null;if(this.codedValues){const r=String(e);this.codedValues.some(e=>(String(e.code)===r&&(t=e.name),!!t))}return t}clone(){return new n({codedValues:(0,o.o8)(this.codedValues),name:this.name})}};(0,i._)([(0,s.MZ)({type:[u.H],json:{write:{isRequired:!0}}})],p.prototype,"codedValues",void 0),(0,i._)([(0,a.e)({codedValue:"coded-value"})],p.prototype,"type",void 0),p=n=(0,i._)([(0,l.$)("esri.layers.support.CodedValueDomain")],p)},65864:(e,t,r)=>{r.d(t,{$B:()=>m,Bi:()=>f,Rg:()=>d,U9:()=>c,ZC:()=>u,fT:()=>p,rS:()=>h,xD:()=>g});var n=r(5443),i=r(91075),o=r(48526),s=r(86738),a=r(39829),l=r(82799);function u(e){return void 0!==e.xmin&&void 0!==e.ymin&&void 0!==e.xmax&&void 0!==e.ymax}function c(e){return void 0!==e.points}function p(e){return void 0!==e.x&&void 0!==e.y}function d(e){return void 0!==e.paths||void 0!==e.curvePaths}function f(e){return void 0!==e.rings||void 0!==e.curveRings}function h(e){return null==e?null:e instanceof i.A?e:p(e)?s.A.fromJSON(e):d(e)?l.A.fromJSON(e):f(e)?a.A.fromJSON(e):c(e)?o.A.fromJSON(e):u(e)?n.A.fromJSON(e):null}function m(e){return e?p(e)?"esriGeometryPoint":d(e)?"esriGeometryPolyline":f(e)?"esriGeometryPolygon":u(e)?"esriGeometryEnvelope":c(e)?"esriGeometryMultipoint":null:null}const y={esriGeometryPoint:s.A,esriGeometryPolyline:l.A,esriGeometryPolygon:a.A,esriGeometryEnvelope:n.A,esriGeometryMultipoint:o.A,esriGeometryMultiPatch:a.A};function g(e){return e&&y[e]||null}},68197:(e,t,r)=>{r.d(t,{A:()=>p});var n,i,o=r(40876),s=r(34727),a=r(56507);function l(e){return(0,s.qE)((0,a.Vr)(e),0,255)}function u(e,t){const r=e.toString(16).padStart(2,"0");return t?r.slice(0,1):r}class c{static blendColors(e,t,r,n=new c){return n.r=Math.round(e.r+(t.r-e.r)*r),n.g=Math.round(e.g+(t.g-e.g)*r),n.b=Math.round(e.b+(t.b-e.b)*r),n.a=e.a+(t.a-e.a)*r,n._sanitize()}static fromRgb(e,t){const r=(0,o.lT)(e);return r?c.fromArray(r,t):null}static fromHex(e,t=new c){const r=(0,o.oW)(e);return r?c.fromArray(r,t):null}static fromArray(e,t=new c){return t._set(Number(e[0]),Number(e[1]),Number(e[2]),Number(e[3])),isNaN(t.a)&&(t.a=1),t._sanitize()}static fromString(e,t){const r=(0,o.Eq)(e);return r?c.fromArray(r,t):null}static fromJSON(e){return null!=e?new c([e[0],e[1],e[2],(e[3]??255)/255]):void 0}static toUnitRGB(e){return null!=e?[e.r/255,e.g/255,e.b/255]:null}static toUnitRGBA(e){return null!=e?[e.r/255,e.g/255,e.b/255,null!=e.a?e.a:1]:null}constructor(e){this.r=255,this.g=255,this.b=255,this.a=1,e&&this.setColor(e)}get isBright(){return.299*this.r+.587*this.g+.114*this.b>=127}setColor(e){return"string"==typeof e?c.fromString(e,this):Array.isArray(e)?c.fromArray(e,this):(this._set(e.r??0,e.g??0,e.b??0,e.a??1),e instanceof c||this._sanitize()),this}toRgb(){return[this.r,this.g,this.b]}toRgba(){return[this.r,this.g,this.b,this.a]}toHex(e){const t=e?.capitalize??!1,r=e?.digits??6,n=3===r||4===r,i=4===r||8===r,o=`#${u(this.r,n)}${u(this.g,n)}${u(this.b,n)}${i?u(Math.round(255*this.a),n):""}`;return t?o.toUpperCase():o}toCss(e=!1){const t=this.r+", "+this.g+", "+this.b;return e?`rgba(${t}, ${this.a})`:`rgb(${t})`}toString(){return this.toCss(!0)}toJSON(){return this.toArray()}toArray(e=c.AlphaMode.ALWAYS){const t=l(this.r),r=l(this.g),n=l(this.b);return e===c.AlphaMode.ALWAYS||1!==this.a?[t,r,n,l(255*this.a)]:[t,r,n]}clone(){return new c(this.toRgba())}hash(){return this.r<<24|this.g<<16|this.b<<8|255*this.a}equals(e){return null!=e&&e.r===this.r&&e.g===this.g&&e.b===this.b&&e.a===this.a}_sanitize(){return this.r=(0,o.c1)(this.r),this.g=(0,o.c1)(this.g),this.b=(0,o.c1)(this.b),this.a=(0,o.G1)(this.a),this}_set(e,t,r,n){this.r=e,this.g=t,this.b=r,this.a=n}}c.prototype.declaredClass="esri.Color",(i=(n=c||(c={})).AlphaMode||(n.AlphaMode={}))[i.ALWAYS=0]="ALWAYS",i[i.UNLESS_OPAQUE=1]="UNLESS_OPAQUE";const p=c},72606:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(90237),i=r(25482),o=r(10107),s=(r(44208),r(53966),r(87811),r(40608));let a=class extends i.A{constructor(e){super(e),this.type=null}};(0,n._)([(0,o.MZ)({readOnly:!0,json:{read:!1,write:!0}})],a.prototype,"type",void 0),a=(0,n._)([(0,s.$)("esri.rest.support.ColorRamp")],a)},73037:(e,t,r)=>{r.d(t,{A:()=>u});var n,i=r(90237),o=r(10107),s=(r(44208),r(53966),r(87811),r(93223)),a=r(40608),l=r(82434);let u=n=class extends l.A{constructor(){super(...arguments),this.type="gcs-shift",this.tolerance=1e-8}forwardTransform(e){return"point"===(e=e.clone()).type?(e.x>180+this.tolerance&&(e.x-=360),e):(e.xmin>=180-this.tolerance?(e.xmax-=360,e.xmin-=360):e.xmax>180+this.tolerance&&(e.xmin=-180,e.xmax=180),e)}inverseTransform(e){return"point"===(e=e.clone()).type?(e.x<-this.tolerance&&(e.x+=360),e):(e.xmin<-this.tolerance&&(e.xmin+=360,e.xmax+=360),e)}clone(){return new n({tolerance:this.tolerance})}};(0,i._)([(0,s.e)({GCSShiftXform:"gcs-shift"})],u.prototype,"type",void 0),(0,i._)([(0,o.MZ)()],u.prototype,"tolerance",void 0),u=n=(0,i._)([(0,a.$)("esri.layers.support.rasterTransforms.GCSShiftTransform")],u)},76357:(e,t,r)=>{r.d(t,{A:()=>c});var n=r(90237),i=r(66552),o=r(25482),s=r(10107),a=(r(44208),r(53966),r(87811),r(93223)),l=r(40608);const u=new i.J({inherited:"inherited",codedValue:"coded-value",range:"range"});let c=class extends o.A{constructor(e){super(e),this.name=null,this.type=null}};(0,n._)([(0,s.MZ)({type:String,json:{write:!0}})],c.prototype,"name",void 0),(0,n._)([(0,a.e)(u),(0,s.MZ)({json:{write:{isRequired:!0}}})],c.prototype,"type",void 0),c=(0,n._)([(0,l.$)("esri.layers.support.Domain")],c)},80451:(e,t,r)=>{r.d(t,{rS:()=>h,gK:()=>f}),r(44208);var n,i=r(53177),o=r(76357),s=r(90237),a=(r(53966),r(87811),r(49186),r(93223)),l=r(40608);let u=class extends o.A{static{n=this}constructor(e){super(e),this.type="inherited"}clone(){return new n}};(0,s._)([(0,a.e)({inherited:"inherited"})],u.prototype,"type",void 0),u=n=(0,s._)([(0,l.$)("esri.layers.support.InheritedDomain")],u);var c,p=r(10107);let d=class extends o.A{static{c=this}constructor(e){super(e),this.maxValue=null,this.minValue=null,this.type="range"}clone(){return new c({maxValue:this.maxValue,minValue:this.minValue,name:this.name})}};(0,s._)([(0,p.MZ)({json:{type:[Number],read:{source:"range",reader:(e,t)=>t.range?.[1]},write:{enabled:!1,overridePolicy(){return{enabled:null!=this.maxValue&&null==this.minValue}},target:"range",writer(e,t,r){t[r]=[this.minValue||0,e]},isRequired:!0}}})],d.prototype,"maxValue",void 0),(0,s._)([(0,p.MZ)({json:{type:[Number],read:{source:"range",reader:(e,t)=>t.range?.[0]},write:{target:"range",writer(e,t,r){t[r]=[e,this.maxValue||0]},isRequired:!0}}})],d.prototype,"minValue",void 0),(0,s._)([(0,a.e)({range:"range"})],d.prototype,"type",void 0),d=c=(0,s._)([(0,l.$)("esri.layers.support.RangeDomain")],d);const f={key:"type",base:o.A,typeMap:{range:d,"coded-value":i.A,inherited:u}};function h(e){if(!e?.type)return null;switch(e.type){case"range":return d.fromJSON(e);case"codedValue":return i.A.fromJSON(e);case"inherited":return u.fromJSON(e)}return null}},82434:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(90237),i=r(25482),o=r(10107),s=(r(44208),r(53966),r(87811),r(40608));let a=class extends i.A{get affectsPixelSize(){return!1}forwardTransform(e){return e}inverseTransform(e){return e}};(0,n._)([(0,o.MZ)()],a.prototype,"affectsPixelSize",null),(0,n._)([(0,o.MZ)({json:{write:!0}})],a.prototype,"spatialReference",void 0),a=(0,n._)([(0,s.$)("esri.layers.support.rasterTransforms.BaseRasterTransform")],a)},87317:(e,t,r)=>{r.d(t,{a:()=>b,b:()=>h,c:()=>i,d:()=>c,e:()=>w,f:()=>d,g:()=>s,h:()=>y,j:()=>f,l:()=>g,n:()=>m,s:()=>o,t:()=>v});var n=r(34304);function i(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function o(e,t,r,n,i){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e}function s(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function a(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}function l(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e}function u(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e[3]=t[3]/r[3],e}function c(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function p(e,t){const r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],o=t[3]-e[3];return Math.sqrt(r*r+n*n+i*i+o*o)}function d(e,t){const r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],o=t[3]-e[3];return r*r+n*n+i*i+o*o}function f(e){const t=e[0],r=e[1],n=e[2],i=e[3];return Math.sqrt(t*t+r*r+n*n+i*i)}function h(e){const t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}function m(e,t){const r=t[0],n=t[1],i=t[2],o=t[3];let s=r*r+n*n+i*i+o*o;return s>0&&(s=1/Math.sqrt(s),e[0]=r*s,e[1]=n*s,e[2]=i*s,e[3]=o*s),e}function y(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function g(e,t,r,n){const i=t[0],o=t[1],s=t[2],a=t[3];return e[0]=i+n*(r[0]-i),e[1]=o+n*(r[1]-o),e[2]=s+n*(r[2]-s),e[3]=a+n*(r[3]-a),e}function v(e,t,r){const n=t[0],i=t[1],o=t[2],s=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*s,e[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*s,e[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*s,e[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*s,e}function b(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function w(e,t){const r=e[0],i=e[1],o=e[2],s=e[3],a=t[0],l=t[1],u=t[2],c=t[3],p=(0,n.FD)();return Math.abs(r-a)<=p*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(i-l)<=p*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=p*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(s-c)<=p*Math.max(1,Math.abs(s),Math.abs(c))}const x=a,M=l,A=u,S=p,_=d,O=f,N=h;Object.freeze(Object.defineProperty({__proto__:null,add:s,ceil:function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e},copy:i,copyVec3:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},dist:S,distance:p,div:A,divide:u,dot:y,equals:w,exactEquals:b,floor:function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e},inverse:function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e},len:O,length:f,lerp:g,max:function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e[3]=Math.max(t[3],r[3]),e},min:function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e[3]=Math.min(t[3],r[3]),e},mul:M,multiply:l,negate:function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e},normalize:m,random:function(e,t=1){const r=n.Ov;let i,o,s,a,l,u;do{i=2*r()-1,o=2*r()-1,l=i*i+o*o}while(l>=1);do{s=2*r()-1,a=2*r()-1,u=s*s+a*a}while(u>=1);const c=Math.sqrt((1-l)/u);return e[0]=t*i,e[1]=t*o,e[2]=t*s*c,e[3]=t*a*c,e},round:function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e},scale:c,scaleAndAdd:function(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e},set:o,sqrDist:_,sqrLen:N,squaredDistance:d,squaredLength:h,str:function(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},sub:x,subtract:a,transformMat4:v,transformQuat:function(e,t,r){const n=t[0],i=t[1],o=t[2],s=r[0],a=r[1],l=r[2],u=r[3],c=u*n+a*o-l*i,p=u*i+l*n-s*o,d=u*o+s*i-a*n,f=-s*n-a*i-l*o;return e[0]=c*u+f*-s+p*-l-d*-a,e[1]=p*u+f*-a+d*-s-c*-l,e[2]=d*u+f*-l+c*-a-p*-s,e[3]=t[3],e}},Symbol.toStringTag,{value:"Module"}))},91829:(e,t,r)=>{function n(){return[0,0,0,0]}function i(e){return[e[0],e[1],e[2],e[3]]}function o(e,t,r,n){return[e,t,r,n]}function s(e,t,r,n){return[e,t,r,n]}function a(e,t=[0,0,0,0]){const r=Math.min(4,e.length);for(let n=0;n<r;++n)t[n]=e[n];return t}function l(){return o(1,1,1,1)}function u(){return o(1,0,0,0)}function c(){return o(0,1,0,0)}function p(){return o(0,0,1,0)}function d(){return o(0,0,0,1)}r.d(t,{CN:()=>s,Un:()=>h,ci:()=>a,fA:()=>o,o8:()=>i,uY:()=>f,vt:()=>n});const f=[0,0,0,0],h=l(),m=u(),y=c(),g=p(),v=d();Object.freeze(Object.defineProperty({__proto__:null,ONES:h,UNIT_W:v,UNIT_X:m,UNIT_Y:y,UNIT_Z:g,ZEROS:f,clone:i,create:n,freeze:s,fromArray:a,fromValues:o,ones:l,unitW:d,unitX:u,unitY:c,unitZ:p,zeros:function(){return[0,0,0,0]}},Symbol.toStringTag,{value:"Module"}))},93223:(e,t,r)=>{r.d(t,{e:()=>o});var n=r(66552),i=r(10107);function o(e,t={}){const r=e instanceof n.J?e:new n.J(e,t),{alwaysWriteDefaults:o,default:s,ignoreUnknown:a=!0,name:l,nonNullable:u,readOnly:c=!1}=t;return(0,i.MZ)({type:a?r.apiValues:String,json:{type:r.jsonValues,default:s,name:l,read:!c&&{reader:r.read},write:{writer:r.write,alwaysWriteDefaults:o}},nonNullable:u,readOnly:c})}},95349:(e,t,r)=>{r.d(t,{g:()=>s,r:()=>a});var n=r(2485),i=r(72606),o=r(1626);const s={key:"type",base:i.A,typeMap:{algorithmic:n.A,multipart:o.A}};function a(e){return e?.type?"algorithmic"===e.type?n.A.fromJSON(e):"multipart"===e.type?o.A.fromJSON(e):null:null}},95488:(e,t,r)=>{r.d(t,{I:()=>i});var n=r(11406);class i extends n.T{notify(){const e=this._observers;if(e&&e.length>0){const t=e.slice();for(const e of t)e.onInvalidated(),e.onCommitted()}}}},98453:(e,t,r)=>{r.d(t,{m:()=>n});const n=new(r(66552).J)({esriFieldTypeSmallInteger:"small-integer",esriFieldTypeInteger:"integer",esriFieldTypeSingle:"single",esriFieldTypeDouble:"double",esriFieldTypeLong:"long",esriFieldTypeString:"string",esriFieldTypeDate:"date",esriFieldTypeOID:"oid",esriFieldTypeGeometry:"geometry",esriFieldTypeBlob:"blob",esriFieldTypeRaster:"raster",esriFieldTypeGUID:"guid",esriFieldTypeGlobalID:"global-id",esriFieldTypeXML:"xml",esriFieldTypeBigInteger:"big-integer",esriFieldTypeDateOnly:"date-only",esriFieldTypeTimeOnly:"time-only",esriFieldTypeTimestampOffset:"timestamp-offset"})},99157:(e,t,r)=>{r.d(t,{A:()=>l});var n,i=r(90237),o=r(69622),s=r(10107),a=(r(44208),r(53966),r(87811),r(40608));let l=n=class extends o.A{constructor(e){super(e),this.isInverse=!1,this.wkt=null,this.wkid=null}getInverse(){return new n({isInverse:!this.isInverse,wkid:this.wkid,wkt:this.wkt})}};(0,i._)([(0,s.MZ)()],l.prototype,"isInverse",void 0),(0,i._)([(0,s.MZ)()],l.prototype,"wkt",void 0),(0,i._)([(0,s.MZ)()],l.prototype,"wkid",void 0),l=n=(0,i._)([(0,a.$)("esri.geometry.operators.support.GeographicTransformationStep")],l)}}]);
|