@arcgis/core 5.2.0-next.60 → 5.2.0-next.62
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 +10 -0
- package/applications/Components/imageryUtils.js +1 -1
- package/arcgisGlobal.d.ts +2 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{3abc12d2407e4214963d.js → 13033178de9f637a2356.js} +1 -1
- package/assets/esri/core/workers/chunks/{d205edd949f3e6e24eb9.js → 147a89553188cc6aabf4.js} +1 -1
- package/assets/esri/core/workers/chunks/{3157f85bb319294878ca.js → 1b68b1b724ad30396723.js} +2 -2
- package/assets/esri/core/workers/chunks/{127b111ee53e4b9184f8.js → 4dcd4a052b40047a9230.js} +1 -1
- package/assets/esri/core/workers/chunks/{aaa66a04b882b0ba2961.js → 5600fc334d20c4f0c83d.js} +1 -1
- package/assets/esri/core/workers/chunks/{14c066c31fe37b7f6e63.js → 638ed1297efdb24f4711.js} +1 -1
- package/assets/esri/core/workers/chunks/{42692a4ce3fb364e321e.js → 763cbb6716e398436a6d.js} +1 -1
- package/assets/esri/core/workers/chunks/{d6aad815fc0ee8e24bb5.js → 7ce52b850dd785bfa33f.js} +1 -1
- package/assets/esri/core/workers/chunks/{81659d121ed732bda907.js → a12803108c3b12808698.js} +2 -2
- package/assets/esri/core/workers/chunks/{5527b2da4abe0faa98bb.js → a494abeb026d536d9fae.js} +1 -1
- package/assets/esri/core/workers/chunks/{498d29e8c8be4a12ba12.js → b958f87f23f984131d09.js} +1 -1
- package/assets/esri/core/workers/chunks/{4e2f3dd158a5228c87ba.js → c85ba0700eafdc8d6f9e.js} +1 -1
- package/assets/esri/core/workers/chunks/{edf87407dd20685c82ab.js → e287113777a94ded8de6.js} +1 -1
- package/assets/esri/core/workers/chunks/{a615a644086e98a90579.js → f4891345507df63cff3c.js} +2 -2
- package/assets/esri/core/workers/chunks/{4fb549f11e176fc2f24a.js → f7fa932ade85cb2847b6.js} +1 -1
- package/config.js +1 -1
- package/core/screenUtils.js +1 -1
- package/geometry/support/intersectsBase.js +1 -1
- package/interfaces.d.ts +14 -0
- package/kernel.js +1 -1
- package/package.json +3 -3
- package/popup/FeatureContent.d.ts +311 -0
- package/popup/FeatureContent.js +2 -0
- package/popup/FeatureContentCollection.d.ts +569 -0
- package/popup/FeatureContentCollection.js +2 -0
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/views/2d/layers/BaseLayerView2D.d.ts +2 -2
- package/views/2d/layers/BaseLayerViewGL2D.d.ts +2 -2
- package/views/2d/layers/graphics/GraphicStore.js +1 -1
- package/views/2d/support/hitTestUtils.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
- package/views/3d/support/buffer/glUtil.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/FBOCacheUsage.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +11 -11
- package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
- package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/View2D.d.ts +2 -2
- package/views/interactive/snapping/featureSources/WorkerTileTreeDebugger.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/widgets/Legend/support/heatmapRampUtils.js +1 -1
- /package/assets/esri/core/workers/chunks/{81659d121ed732bda907.js.LICENSE.txt → a12803108c3b12808698.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{watch as t,syncAndInitial as s,when as i,sync as l}from"../../../../core/reactiveUtils.js";import{throttle as a}from"../../../../core/throttle.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{clone as n,create as d}from"../../../../geometry/support/aaBoundingRect.js";import h from"../../layers/FlowSubView3D.js";import{getFeatureTileId as u}from"../../layers/support/FeatureTileDescriptor.js";import{tilesWaitingTime as c}from"./constants.js";import{FlowDataTile as p}from"./loadUtils.js";import{isRasterTile as f}from"../../terrain/TerrainData.js";import{descendantsAtLevel as T}from"../../terrain/tileUtils.js";import{toFlowData as _}from"../../../support/flow/dataUtils.js";const m={type:"delete"};let g=class extends h{constructor(e){super(e),this._flowDataTiles=D(),this._throttling=!1,this._resetTileData=!0}initialize(){this.addHandles([this.surface.on("tile-data-changed",({tile:e,layerIndex:t,layerClass:s})=>{if(t!==this._layerIndex||1!==s)return;const i=this.frameTask.schedule(()=>{this._applyTileDataUpdate(e)&&this.triggerLoad()});this.updatingHandles.consumePromise(i)}),t(()=>this.renderedTiles,e=>{const t=this.frameTask.scheduleGenerator(this.loadAllTiles?t=>this._applyTileDataUpdates(e,t):t=>this._syncToTiles(e,t));this.updatingHandles.consumePromise(t)},s),i(()=>null!=this.renderedTiles&&null!=this.extent&&this.loadAllTiles,()=>{const e=this.frameTask.scheduleGenerator(e=>this._enterAllTilesMode(e));this.updatingHandles.consumePromise(e)},s),t(()=>this._pixelSize,()=>{this.invalidateTileData(),this._resetTileData=!0},l),this.layerView.on("data-changed",()=>{this.invalidateTileData(),this._resetTileData=!0})]),this._throttledTriggerLoad=a(()=>{super.triggerLoad(),this._throttling=!1},()=>this._throttling=!0,c,this),this.addHandles(this._throttledTriggerLoad)}clear(){super.clear(),this._resetTileData=!1}*_enterAllTilesMode(e){const{targetTiles:t,_flowDataTiles:s}=this,i=D();for(const[l,a]of s)t.has(l)&&i.set(l,a);this._setFlowDataTiles(i),e.madeProgress(),e.done&&(e=yield),yield*this._applyTileDataUpdates(new Set(this.surface.allTiles),e),this.triggerLoad()}*_syncToTiles(e,t){const s=D();for(const i of e??[]){const e=this._flowDataTiles.get(i.key),l=null==e||"delete"===e.type||"invalid"===e.type?this._getLoadedState(i):e;null!=l&&s.set(i.key,l),t.madeProgress(),t.done&&(t=yield)}this._setFlowDataTiles(s),this.triggerLoad()}*_applyTileDataUpdates(e,t){let s=!1;for(const i of e??[]){const e=this._applyTileDataUpdate(i);s||=e,t.madeProgress(),t.done&&(t=yield)}s&&this.triggerLoad()}abort(){super.abort(),this._throttling=!1}get _layerIndex(){return this.surface.getLayerIndexByUID(1,this.layerView.uid)}get _pixelSize(){return this.surface.tilingScheme.pixelSize}doRefresh(){this.invalidateTileData(),super.doRefresh()}triggerLoad(){const{_throttledTriggerLoad:e}=this;null!=e?this._allTilesLoaded?(e.hasPendingUpdates()||e(),e.forceUpdate()):e():super.triggerLoad()}async fetchDataAndGenerateStreamlines(e,t){const{_flowDataTiles:s,needsMagnitude:i}=this,l=this.getSimulationSettings(e);if(null==l)return;const a=this._resetTileData;if(!a&&0===s.size)return;const r=D();s.forEach((e,t)=>{"delete"===e.type?(r.set(t,m),s.delete(t)):(a||"on-worker"!==e.type&&"invalid"!==e.type)&&(r.set(t,e),s.set(t,"invalid"===e.type?{type:"invalid",memory:e.memory}:{type:"on-worker",sourceLevel:e.sourceLevel,memory:e.memory}))});const o={simulationSettings:l,flowExtentInfo:e.flowExtentInfo,flowDataTiles:r,reset:a,needsMagnitude:i,startPositions:this.startPositions(e)};this._resetTileData=!1;const{streamlines:n}=await this.workerHandle.generateTiledStreamlines(o,t);return n}hasWork(){const e=!this.suspended&&super.loadRequirementsMet&&this.tilesIntersectDataBounds;return super.hasWork()||this._throttling||this._resetTileData&&e}get loadRequirementsMet(){return super.loadRequirementsMet&&(this._flowDataTiles.size>0||this._resetTileData)}_getLoadedState(e){const{_layerIndex:t}=this;if(null==t||e.isDisposed)return null;const s=e.getLayerInfo(t,1);if(null==s)return null;const i=this._getRasterTile(s,e,t);if(null==i)return this._upsampleFlowData(t,s.upsampleInfo,e.lij,e.extent);const l=this._createFlowDataTile(i,e.lij,e.extent,this._pixelSize);return{type:"loaded",memory:v(l),data:l,sourceLevel:e.level}}_upsampleFlowData(e,t,s,i){if(null==t)return null;const l=t.tile;if(null==l)return null;const a=l.getLayerInfo(e,1);if(null==a)return null;const r=this._getRasterTile(a,l,e);if(null==r)return null;const{scale:o,offset:n}=t,d=Math.max(Math.floor(this._pixelSize*o),1),h=r.source,u=Math.floor(n[0]*h.width),c=Math.floor((1-n[1]-o)*h.height),p=this._createFlowDataTile(r,s,i,d,u,c);return{type:"loaded",memory:v(p),data:p,sourceLevel:l.level}}_getRasterTile(e,t,s){const{data:i}=e;return!e.dataMissing&&t.hasLayerData(s,1)&&f(i)?i:null}_createFlowDataTile(e,t,s,i,l,a){const r=_(this.layer.serviceRasterInfo.dataType,e.source,i,i,l,a),o=r.mask.slice();return new p(r.data,o,r.width,r.height,t,n(s))}_applyTileDataUpdate(e){const{renderedTiles:t,_layerIndex:s,loadAllTiles:i,loadAllTilesLevel:l}=this;if(null==t||null==s||i&&e.level>l)return!1;if(t.has(e))return this._updateRenderedTile(e);const a=e.key;let r=this._setTileData(a,m);const o=this._updateUpsampledTiles(t,e,s);r||=o;const n=i&&this._updateDescendants(e,s);return r||=n,r}_updateRenderedTile(e){const t=e.key,{_flowDataTiles:s}=this;if(w(s.get(t),e))return!1;const i=this._getLoadedState(e);return this._setTileData(t,i)}_updateUpsampledTiles(e,t,s){const{_flowDataTiles:i}=this;let l=!1;for(const a of e.values()){const e=a.key;if(w(i.get(e),t))continue;const r=a.getLayerInfo(s,1);if(null==r)continue;if(null!=this._getRasterTile(r,a,s))continue;const o=r.upsampleInfo?.tile;if(o!==t)continue;const n=this._getLoadedState(a),d=this._setTileData(e,n);l||=d}return l}_updateDescendants(e,t){let s=!1;const{tilingScheme:i,upsampleInfoPool:l}=this.surface,{targetTiles:a,_flowDataTiles:r,loadAllTilesLevel:o}=this,n=e.lij,h=T(n,o).map(e=>[u(e[0],e[1],e[2]),e]).filter(([e])=>a.has(e));if(0===h.length)return s;const c=1<<o-n[0],p=1/c,f=n[1]*c,_=n[2]*c,m=l.acquire();for(const[u,T]of h){if(w(r.get(u),e))continue;const l=d();i.getExtent(T[0],T[1],T[2],l);const a=1-(T[1]-f)*p-p,o=(T[2]-_)*p;m.init(e,o,a,p);const n=this._upsampleFlowData(t,m,T,l),h=this._setTileData(u,n);s||=h}return l.release(m),s}_setTileData(e,t){if(null==t)return!1;const{_flowDataTiles:s}=this;return(null!=s.get(e)||"delete"!==t.type)&&(s.set(e,t),!0)}_setFlowDataTiles(e){const t=this._flowDataTiles.size!==e.size||
|
|
2
|
+
import{__decorate as e}from"tslib";import{watch as t,syncAndInitial as s,when as i,sync as l}from"../../../../core/reactiveUtils.js";import{throttle as a}from"../../../../core/throttle.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{clone as n,create as d}from"../../../../geometry/support/aaBoundingRect.js";import h from"../../layers/FlowSubView3D.js";import{getFeatureTileId as u}from"../../layers/support/FeatureTileDescriptor.js";import{tilesWaitingTime as c}from"./constants.js";import{FlowDataTile as p}from"./loadUtils.js";import{isRasterTile as f}from"../../terrain/TerrainData.js";import{descendantsAtLevel as T}from"../../terrain/tileUtils.js";import{toFlowData as _}from"../../../support/flow/dataUtils.js";const m={type:"delete"};let g=class extends h{constructor(e){super(e),this._flowDataTiles=D(),this._throttling=!1,this._resetTileData=!0}initialize(){this.addHandles([this.surface.on("tile-data-changed",({tile:e,layerIndex:t,layerClass:s})=>{if(t!==this._layerIndex||1!==s)return;const i=this.frameTask.schedule(()=>{this._applyTileDataUpdate(e)&&this.triggerLoad()});this.updatingHandles.consumePromise(i)}),t(()=>this.renderedTiles,e=>{const t=this.frameTask.scheduleGenerator(this.loadAllTiles?t=>this._applyTileDataUpdates(e,t):t=>this._syncToTiles(e,t));this.updatingHandles.consumePromise(t)},s),i(()=>null!=this.renderedTiles&&null!=this.extent&&this.loadAllTiles,()=>{const e=this.frameTask.scheduleGenerator(e=>this._enterAllTilesMode(e));this.updatingHandles.consumePromise(e)},s),t(()=>this._pixelSize,()=>{this.invalidateTileData(),this._resetTileData=!0},l),this.layerView.on("data-changed",()=>{this.invalidateTileData(),this._resetTileData=!0})]),this._throttledTriggerLoad=a(()=>{super.triggerLoad(),this._throttling=!1},()=>this._throttling=!0,c,this),this.addHandles(this._throttledTriggerLoad)}clear(){super.clear(),this._resetTileData=!1}*_enterAllTilesMode(e){const{targetTiles:t,_flowDataTiles:s}=this,i=D();for(const[l,a]of s)t.has(l)&&i.set(l,a);this._setFlowDataTiles(i),e.madeProgress(),e.done&&(e=yield),yield*this._applyTileDataUpdates(new Set(this.surface.allTiles),e),this.triggerLoad()}*_syncToTiles(e,t){const s=D();for(const i of e??[]){const e=this._flowDataTiles.get(i.key),l=null==e||"delete"===e.type||"invalid"===e.type?this._getLoadedState(i):e;null!=l&&s.set(i.key,l),t.madeProgress(),t.done&&(t=yield)}this._setFlowDataTiles(s),this.triggerLoad()}*_applyTileDataUpdates(e,t){let s=!1;for(const i of e??[]){const e=this._applyTileDataUpdate(i);s||=e,t.madeProgress(),t.done&&(t=yield)}s&&this.triggerLoad()}abort(){super.abort(),this._throttling=!1}get _layerIndex(){return this.surface.getLayerIndexByUID(1,this.layerView.uid)}get _pixelSize(){return this.surface.tilingScheme.pixelSize}doRefresh(){this.invalidateTileData(),super.doRefresh()}triggerLoad(){const{_throttledTriggerLoad:e}=this;null!=e?this._allTilesLoaded?(e.hasPendingUpdates()||e(),e.forceUpdate()):e():super.triggerLoad()}async fetchDataAndGenerateStreamlines(e,t){const{_flowDataTiles:s,needsMagnitude:i}=this,l=this.getSimulationSettings(e);if(null==l)return;const a=this._resetTileData;if(!a&&0===s.size)return;const r=D();s.forEach((e,t)=>{"delete"===e.type?(r.set(t,m),s.delete(t)):(a||"on-worker"!==e.type&&"invalid"!==e.type)&&(r.set(t,e),s.set(t,"invalid"===e.type?{type:"invalid",memory:e.memory}:{type:"on-worker",sourceLevel:e.sourceLevel,memory:e.memory}))});const o={simulationSettings:l,flowExtentInfo:e.flowExtentInfo,flowDataTiles:r,reset:a,needsMagnitude:i,startPositions:this.startPositions(e)};this._resetTileData=!1;const{streamlines:n}=await this.workerHandle.generateTiledStreamlines(o,t);return n}hasWork(){const e=!this.suspended&&super.loadRequirementsMet&&this.tilesIntersectDataBounds;return super.hasWork()||this._throttling||this._resetTileData&&e}get loadRequirementsMet(){return super.loadRequirementsMet&&(this._flowDataTiles.size>0||this._resetTileData)}_getLoadedState(e){const{_layerIndex:t}=this;if(null==t||e.isDisposed)return null;const s=e.getLayerInfo(t,1);if(null==s)return null;const i=this._getRasterTile(s,e,t);if(null==i)return this._upsampleFlowData(t,s.upsampleInfo,e.lij,e.extent);const l=this._createFlowDataTile(i,e.lij,e.extent,this._pixelSize);return{type:"loaded",memory:v(l),data:l,sourceLevel:e.level}}_upsampleFlowData(e,t,s,i){if(null==t)return null;const l=t.tile;if(null==l)return null;const a=l.getLayerInfo(e,1);if(null==a)return null;const r=this._getRasterTile(a,l,e);if(null==r)return null;const{scale:o,offset:n}=t,d=Math.max(Math.floor(this._pixelSize*o),1),h=r.source,u=Math.floor(n[0]*h.width),c=Math.floor((1-n[1]-o)*h.height),p=this._createFlowDataTile(r,s,i,d,u,c);return{type:"loaded",memory:v(p),data:p,sourceLevel:l.level}}_getRasterTile(e,t,s){const{data:i}=e;return!e.dataMissing&&t.hasLayerData(s,1)&&f(i)?i:null}_createFlowDataTile(e,t,s,i,l,a){const r=_(this.layer.serviceRasterInfo.dataType,e.source,i,i,l,a),o=r.mask.slice();return new p(r.data,o,r.width,r.height,t,n(s))}_applyTileDataUpdate(e){const{renderedTiles:t,_layerIndex:s,loadAllTiles:i,loadAllTilesLevel:l}=this;if(null==t||null==s||i&&e.level>l)return!1;if(t.has(e))return this._updateRenderedTile(e);const a=e.key;let r=this._setTileData(a,m);const o=this._updateUpsampledTiles(t,e,s);r||=o;const n=i&&this._updateDescendants(e,s);return r||=n,r}_updateRenderedTile(e){const t=e.key,{_flowDataTiles:s}=this;if(w(s.get(t),e))return!1;const i=this._getLoadedState(e);return this._setTileData(t,i)}_updateUpsampledTiles(e,t,s){const{_flowDataTiles:i}=this;let l=!1;for(const a of e.values()){const e=a.key;if(w(i.get(e),t))continue;const r=a.getLayerInfo(s,1);if(null==r)continue;if(null!=this._getRasterTile(r,a,s))continue;const o=r.upsampleInfo?.tile;if(o!==t)continue;const n=this._getLoadedState(a),d=this._setTileData(e,n);l||=d}return l}_updateDescendants(e,t){let s=!1;const{tilingScheme:i,upsampleInfoPool:l}=this.surface,{targetTiles:a,_flowDataTiles:r,loadAllTilesLevel:o}=this,n=e.lij,h=T(n,o).map(e=>[u(e[0],e[1],e[2]),e]).filter(([e])=>a.has(e));if(0===h.length)return s;const c=1<<o-n[0],p=1/c,f=n[1]*c,_=n[2]*c,m=l.acquire();for(const[u,T]of h){if(w(r.get(u),e))continue;const l=d();i.getExtent(T[0],T[1],T[2],l);const a=1-(T[1]-f)*p-p,o=(T[2]-_)*p;m.init(e,o,a,p);const n=this._upsampleFlowData(t,m,T,l),h=this._setTileData(u,n);s||=h}return l.release(m),s}_setTileData(e,t){if(null==t)return!1;const{_flowDataTiles:s}=this;return(null!=s.get(e)||"delete"!==t.type)&&(s.set(e,t),!0)}_setFlowDataTiles(e){const t=this._flowDataTiles.size!==e.size||e.entries().some(([e,t])=>this._flowDataTiles.get(e)!==t);this._flowDataTiles=e,t&&(this._resetTileData=!0)}get _allTilesLoaded(){let e=0;for(const t of this._flowDataTiles.values()??[])"delete"!==t.type&&"invalid"!==t.type&&e++;return this.loadAllTiles?e===this.targetTiles.size:e===this.renderedTiles?.size}invalidateTileData(){const{_flowDataTiles:e}=this;for(const[t,s]of e.entries())"delete"!==s.type&&e.set(t,{type:"invalid",memory:s.memory})}get usedMemory(){let e=0;return this._flowDataTiles.forEach(t=>{"delete"!==t.type&&(e+=t.memory)}),super.usedMemory+e}get test(){return{...super.test,loadedTiles:this._flowDataTiles}}};e([r()],g.prototype,"_throttling",void 0),e([r()],g.prototype,"_resetTileData",void 0),g=e([o("esri.views.3d.support.flow.FlowSubViewTiles3D")],g);const y=g;function D(){return new Map}function w(e,t){return null!=e&&("loaded"===e.type||"on-worker"===e.type)&&e.sourceLevel>=t.level}function v(e){return e.width*e.height*9}export{y as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{signal as e}from"../../../../core/signal.js";import{Milliseconds as i}from"../../../../core/time.js";import{getGaussianSplatAlphaCutoffValue as t}from"../../webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js";class a{static{this.fadeInEase=e=>e*(2-e)}static{this.fadeOutEase=e=>e*e}static{this.inverseFadeInEase=e=>1-Math.sqrt(1-e)}static{this.inverseFadeOutEase=e=>Math.sqrt(1-e)}static{this.minimumFadeDuration=i(80)}static{this.resetFadeDurationInterval=i(1e3)}constructor(t){this.layerView=t,this._numFadingTiles=e(0),this._tmpFullyFadedOutTiles=new Array,this._previousNumFadingTiles=0,this._lastStoppedFading=i(0),this._currentFadeDuration=this.baseFadeDuration}get numFadingTiles(){return this._numFadingTiles.value}fadeTile(e,i,t){const a=this._getTargetOpacity(i);if(e.fadeDirection=i,!this.fadingEnabled)return void this._instantTileFading(e,a);const s=e.opacityModifier;if(s!==a){const a=this._getFadeProgressFromOpacity(s,i);this._startTileFading(e,a,t)}else this._stopTileFading(e)}updateAllTileFading(e){const i=this._tmpFullyFadedOutTiles;i.length=0,this.layerView.tileHandles.forEach(t=>{this._updateTileFading(t,e)&&i.push(t)});i.length>0&&(this.layerView.notifyTileObbsChanged(i),0===this._numFadingTiles.value&&this.layerView.updateGaussians()),this._numFadingTiles.value>0&&this.layerView.view.stage?.renderView.requestRender(2)}onFadeDurationChanged(e){0===e&&this.numFadingTiles>0&&this._instantlyFullyFadeAllTiles()}isTileFadingOut(e){return null!=e.fadeProgress&&1===e.fadeDirection}onTileDiscarded(e){null!=e.fadeProgress&&(this._numFadingTiles.value--,0===this._numFadingTiles.value&&(this._lastStoppedFading=i(performance.now())))}updateFadeDuration(){if(this.numFadingTiles&&this.numFadingTiles>=this._previousNumFadingTiles){const e=.95*this._currentFadeDuration;this._currentFadeDuration=i(Math.max(e,a.minimumFadeDuration))}else 0===this.numFadingTiles&&performance.now()-this._lastStoppedFading>a.resetFadeDurationInterval&&(this._currentFadeDuration=this.baseFadeDuration);return this._previousNumFadingTiles=this.numFadingTiles,this._currentFadeDuration}get updating(){return this._numFadingTiles.value>0}get baseFadeDuration(){return this.layerView.view.qualitySettings.fadeDuration}get fadingEnabled(){return 0!==this.baseFadeDuration}_startTileFading(e,i,t){null==e.fadeProgress&&this._numFadingTiles.value++,e.fadeDuration=t,e.fadeProgress=i}_stopTileFading(e){null!=e.fadeProgress&&(1===e.fadeDirection&&this._onTileFullyFadedOut(e),this._numFadingTiles.value--,0===this._numFadingTiles.value&&(this._lastStoppedFading=i(performance.now())),e.fadeDuration=null,e.fadeProgress=null)}_updateTileFading(e,i){const{fadeProgress:t,fadeDirection:s}=e;if(null==t)return!1;const n=this._fadeDirectionToSign(s),r=e.fadeDuration,d=this._getTargetOpacity(s),l=i/Math.abs(r||1),u=Math.min(t+l,1),o=d-n*(1-(0===s?a.fadeInEase:a.fadeOutEase)(u)),h=1===u||this._tileReachedFadeOutCutoff(e,o);if(e.opacityModifier=h?d:o,h){const i=1===s;return this._stopTileFading(e),this._updateOpacityModifier(e),i}return e.fadeProgress=u,this._updateOpacityModifier(e),!1}_updateOpacityModifier(e){
|
|
2
|
+
import{signal as e}from"../../../../core/signal.js";import{Milliseconds as i}from"../../../../core/time.js";import{getGaussianSplatAlphaCutoffValue as t}from"../../webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js";class a{static{this.fadeInEase=e=>e*(2-e)}static{this.fadeOutEase=e=>e*e}static{this.inverseFadeInEase=e=>1-Math.sqrt(1-e)}static{this.inverseFadeOutEase=e=>Math.sqrt(1-e)}static{this.minimumFadeDuration=i(80)}static{this.resetFadeDurationInterval=i(1e3)}constructor(t){this.layerView=t,this._numFadingTiles=e(0),this._tmpFullyFadedOutTiles=new Array,this._previousNumFadingTiles=0,this._lastStoppedFading=i(0),this._currentFadeDuration=this.baseFadeDuration}get numFadingTiles(){return this._numFadingTiles.value}fadeTile(e,i,t){const a=this._getTargetOpacity(i);if(e.fadeDirection=i,!this.fadingEnabled)return void this._instantTileFading(e,a);const s=e.opacityModifier;if(s!==a){const a=this._getFadeProgressFromOpacity(s,i);this._startTileFading(e,a,t)}else this._stopTileFading(e)}updateAllTileFading(e){const i=this._tmpFullyFadedOutTiles;i.length=0,this.layerView.tileHandles.forEach(t=>{this._updateTileFading(t,e)&&i.push(t)});i.length>0&&(this.layerView.notifyTileObbsChanged(i),0===this._numFadingTiles.value&&this.layerView.updateGaussians()),this._numFadingTiles.value>0&&this.layerView.view.stage?.renderView.requestRender(2)}onFadeDurationChanged(e){0===e&&this.numFadingTiles>0&&this._instantlyFullyFadeAllTiles()}isTileFadingOut(e){return null!=e.fadeProgress&&1===e.fadeDirection}onTileDiscarded(e){null!=e.fadeProgress&&(this._numFadingTiles.value--,0===this._numFadingTiles.value&&(this._lastStoppedFading=i(performance.now())))}updateFadeDuration(){if(this.numFadingTiles&&this.numFadingTiles>=this._previousNumFadingTiles){const e=.95*this._currentFadeDuration;this._currentFadeDuration=i(Math.max(e,a.minimumFadeDuration))}else 0===this.numFadingTiles&&performance.now()-this._lastStoppedFading>a.resetFadeDurationInterval&&(this._currentFadeDuration=this.baseFadeDuration);return this._previousNumFadingTiles=this.numFadingTiles,this._currentFadeDuration}get updating(){return this._numFadingTiles.value>0}get baseFadeDuration(){return this.layerView.view.qualitySettings.fadeDuration}get fadingEnabled(){return 0!==this.baseFadeDuration}_startTileFading(e,i,t){null==e.fadeProgress&&this._numFadingTiles.value++,e.fadeDuration=t,e.fadeProgress=i}_stopTileFading(e){null!=e.fadeProgress&&(1===e.fadeDirection&&this._onTileFullyFadedOut(e),this._numFadingTiles.value--,0===this._numFadingTiles.value&&(this._lastStoppedFading=i(performance.now())),e.fadeDuration=null,e.fadeProgress=null)}_updateTileFading(e,i){const{fadeProgress:t,fadeDirection:s}=e;if(null==t)return!1;const n=this._fadeDirectionToSign(s),r=e.fadeDuration,d=this._getTargetOpacity(s),l=i/Math.abs(r||1),u=Math.min(t+l,1),o=d-n*(1-(0===s?a.fadeInEase:a.fadeOutEase)(u)),h=1===u||this._tileReachedFadeOutCutoff(e,o);if(e.opacityModifier=h?d:o,h){const i=1===s;return this._stopTileFading(e),this._updateOpacityModifier(e),i}return e.fadeProgress=u,this._updateOpacityModifier(e),!1}_updateOpacityModifier(e){for(let i=0;i<e.pageIds.length;i++){const t=e.pageIds[i];this.layerView.data.fadingTexture.updateBuffer(e.opacityModifier,t)}}_tileReachedFadeOutCutoff(e,i){if(1!==e.fadeDirection)return!1;const a=t(this.layerView.view.qualitySettings.gaussianSplat.nonIdleMinimumOpacity);return i*e.maxGaussianOpacity<=a}_instantTileFading(e,i){e.fadeDuration=null,e.fadeProgress=null,e.opacityModifier=i,this._updateOpacityModifier(e),1===e.fadeDirection&&this._onTileFullyFadedOut(e)}_instantlyFullyFadeAllTiles(){const e=this._tmpFullyFadedOutTiles;e.length=0,this.layerView.tileHandles.forEach(i=>{if(null!=i.fadeProgress){const t=1===i.fadeDirection;this._instantTileFading(i,this._getTargetOpacity(i.fadeDirection)),t&&e.push(i)}});e.length>0&&(this.layerView.updateGaussians(),this.layerView.notifyTileObbsChanged(e)),this._numFadingTiles.value=0}_onTileFullyFadedOut(e){e.lifecycleState=0,this.layerView.moveTileToCache(e)}_fadeDirectionToSign(e){return 0===e?1:-1}_getTargetOpacity(e){return 0===e?1:0}_getFadeProgressFromOpacity(e,i){const t=Math.max(0,Math.min(e,1));return 0===i?a.inverseFadeInEase(t):a.inverseFadeOutEase(t)}}export{a as GaussianSplatFadeHelper};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{
|
|
2
|
+
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{initialSplatAtlasTexturePages as t}from"./GaussianSplatAtlasPages.js";import{TextureBackedBuffer as r}from"../../webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js";import{TextureBackedBufferLayout as u}from"../../webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js";const a=new u([{name:"gaussianSplatFading",type:"unorm8"}]);class i{constructor(e){this._textureBackedBuffer=null,this._fadingField=null,this._rctx=e,this._createTextureBackedBuffer()}get usedMemory(){return this._textureBackedBuffer.usedMemory}ensureCapacity(r){if(this._textureBackedBuffer.itemCount>=r)return;const u=Math.max(Math.ceil(r*e),t);this._textureBackedBuffer.resizeToFit(u-1)}updateTexture(e){this.ensureCapacity(e),this._textureBackedBuffer.updateTexture()}updateBuffer(e,t){this.ensureCapacity(t+1),this._fadingField.set(t,e)}clear(){this._textureBackedBuffer.dispose(),this._createTextureBackedBuffer()}destroy(){this.clear()}get texture(){return this._textureBackedBuffer.texture}_createTextureBackedBuffer(){this._textureBackedBuffer=new r(this._rctx,a),this._fadingField=this._textureBackedBuffer.getScalarField("gaussianSplatFading")}}export{i as GaussianSplatFadeTexture};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{reallocGrowthFactor as
|
|
2
|
+
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{minExpectedGaussianCount as t}from"./GaussianSplatAtlasPages.js";import{TextureBackedBufferLayout as r}from"../../webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js";import{TextureBuffer as u}from"../../webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js";const s=new r([{name:"gaussianSplatOrder",type:"u32"}]);class f{constructor(e){this._textureBuffer=null,this._rctx=e}get usedMemory(){return this._textureBuffer?.usedMemory??0}ensureCapacity(r){if(r<=0)return;const f=this._textureBuffer;if(null!=f&&f.itemCount>=r&&f.texture.hasWebGLTextureObject)return;const i=Math.max(Math.ceil(r*e),t);f?.dispose(),this._textureBuffer=new u(this._rctx,s,i)}setData(e,t){this.ensureCapacity(t),this._textureBuffer.setSubData(e.buffer,0,e.byteOffset,t)}clear(){this._textureBuffer?.dispose(),this._textureBuffer=null}destroy(){this.clear()}get texture(){return this._textureBuffer?.texture??null}}export{f as GaussianSplatOrderTexture};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthTexture as t}from"../../webgl/ManagedDepthTexture.js";import a from"../../webgl/ManagedFBO.js";import{isDepthFormat as c,formatString as r,DepthTextureFormats as h,ColorFormats as i}from"./FBOCacheFormats.js";import{FBOCacheUsage as s}from"./FBOCacheUsage.js";import{FBOPool as o}from"./FBOPool.js";import{DepthStencilAttachment as n,ColorAttachment0 as l}from"../../../webgl/enums.js";import{DisposableFramebufferObject as u}from"../../../webgl/FramebufferObject.js";import m from"../../../webgl/Texture.js";class d{constructor(e){this.rctx=e,this._interactive=!1,this._usage=new s,this._acquired=new Set,this._cache=new o(e.newCache,"FBOCache"),this._colorCache=new o(e.newCache,"ColorAttachmentCache"),this._depthCache=new o(e.newCache,"DepthAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.(),this._usage.clear()}frameEnd(){this.debugCallback&&(this._usage.summarize(),this._acquired.forEach(e=>this.debugCallback?.(e.name,e.fbo)))}get usedMemory(){return
|
|
2
|
+
import e from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthTexture as t}from"../../webgl/ManagedDepthTexture.js";import a from"../../webgl/ManagedFBO.js";import{isDepthFormat as c,formatString as r,DepthTextureFormats as h,ColorFormats as i}from"./FBOCacheFormats.js";import{FBOCacheUsage as s}from"./FBOCacheUsage.js";import{FBOPool as o}from"./FBOPool.js";import{DepthStencilAttachment as n,ColorAttachment0 as l}from"../../../webgl/enums.js";import{DisposableFramebufferObject as u}from"../../../webgl/FramebufferObject.js";import m from"../../../webgl/Texture.js";class d{constructor(e){this.rctx=e,this._interactive=!1,this._usage=new s,this._acquired=new Set,this._cache=new o(e.newCache,"FBOCache"),this._colorCache=new o(e.newCache,"ColorAttachmentCache"),this._depthCache=new o(e.newCache,"DepthAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.(),this._usage.clear()}frameEnd(){this.debugCallback&&(this._usage.summarize(),this._acquired.forEach(e=>this.debugCallback?.(e.name,e.fbo)))}get usedMemory(){return this._acquired.values().reduce((e,t)=>e+t.usedMemory,this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e,this._interactive=e}get interactive(){return this._interactive}acquire(e,t,h,i=5){const s=p(i,e,t);let o=this._cache.pop(s);const{rctx:m}=this;if(o){o.retain(),o.setName(h);const e=o.getAttachment(n);e&&(e.name=C);const t=o.getAttachment(l);t&&(t.name=_(0)),m.unbindTexture(o.fbo.colorTexture)}else{const r=new u(m),d=(a,c,r)=>{c??=5,r??=_(a-l);const h=this._acquireColor(c,e,t,r);return this.rctx.unbindTexture(h.attachment),o.attachColor(h,a),h.release(),o},p=a=>{a??=14;const c=this.acquireDepth(a,e,t,`${o.name} ${C}`);return o.attachDepth(c),c.release(),o},g=()=>{if(!o)return;this.debugCallback?.(o.name,o.fbo),this._acquired.delete(o);const e=c(i);e&&null!=o.getAttachment(n)||!e&&null!=o.getAttachment(l)?(e?(o.fbo?.invalidateAttachments([n]),o.detachAllColors()):(o.fbo?.invalidateAttachments([l]),o.detachAllButColor0()),this._trackRelease(o),this._cache.put(o)):o.dispose()};o=new a(s,h,r,d,p,g),c(i)?o.acquireDepth(i):o.acquireColor(l,i)}return this._trackAcquire(o,"f "+r(i),e,t),this._trackHandle(o)}acquireDepth(e,a,c,i){const s=p(e,a,c);let o=this._depthCache.pop(s);if(o)o.retain(),o.attachment.setShadowFiltering(!1);else{const r=new m(this.rctx,{...h[e],width:a,height:c});o=new t(s,r,()=>{this._trackRelease(o),this._depthCache.put(o)})}return o.name=i,this._trackAcquire(o,"d "+r(e),a,c),o}_acquireColor(t,a,c,h){const s=p(t,a,c);let o=this._colorCache.pop(s);if(o)o.retain();else{const r=new m(this.rctx,{...i[t],width:a,height:c,isImmutable:!0});o=new e(s,r,()=>{this._trackRelease(o),this._colorCache.put(o)})}return o.name=h,this._trackAcquire(o,"c "+r(t),a,c),o}_trackHandle(e){return this._acquired.add(e),e}_trackAcquire(e,t,a,c){this.debugCallback&&this._usage.add(e,t,a,c)}_trackRelease(e){this.debugCallback&&this._usage.remove(e)}}function _(e=0){return`color${e}`}const C="depth";function p(e,t,a){return`${t}x${a}:${e}`}export{d as FBOCache};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
class e{constructor(){this._usage=new Map,this._pad=0}clear(){this._usage.clear()}add(e,s,t,
|
|
2
|
+
class e{constructor(){this._usage=new Map,this._pad=0}clear(){this._usage.clear()}add(e,s,t,o){const u=this._usage.get(e);u?(u[2]=!0,u[3].push(e.name)):this._usage.set(e,[s,`${t}x${o}`,!0,[e.name]]),this._pad=Math.max(this._pad,a(this._usage)),console.debug(Array.from(this._usage.values()).map(([e,a,s,t])=>(s?t[t.length-1]:"").padStart(this._pad," ")).join(" | "))}remove(e){const a=this._usage.get(e);a&&(a[2]=!1)}summarize(){const e=a(this._usage);console.debug(Array.from(this._usage.values()).map(([a,s])=>s.padStart(e," ")).join(" | ")),console.debug(Array.from(this._usage.keys()).map(({usedMemory:a})=>`${(a/1024/1024).toFixed(1)}MB`.padStart(e," ")).join(" | ")),console.debug(Array.from(this._usage.values()).map(([a])=>a.padStart(e," ")).join(" | ")),console.debug("Total",(this._usage.keys().reduce((e,{usedMemory:a})=>e+a,0)/1024/1024).toFixed(1),"MB")}}function a(e){return e.values().reduce((e,[a,s,t,o])=>Math.max(a.length,s.length,o.reduce((e,a)=>Math.max(e,a.length),e)),0)}export{e as FBOCacheUsage};
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{maxUint8 as n}from"../../../../../core/typedArrayUtil.js";import{hasNativeFloat16Array as e}from"../../../../../geometry/support/float16.js";import{FloatBindUniform as o}from"../shaderModules/FloatBindUniform.js";import{glsl as
|
|
2
|
+
import{__decorate as t}from"tslib";import{maxUint8 as n}from"../../../../../core/typedArrayUtil.js";import{hasNativeFloat16Array as e}from"../../../../../geometry/support/float16.js";import{FloatBindUniform as o}from"../shaderModules/FloatBindUniform.js";import{glsl as u,If as i}from"../shaderModules/glsl.js";import{parameter as a,ShaderTechniqueConfiguration as r}from"../shaderTechnique/ShaderTechniqueConfiguration.js";function s(t){switch(t.elementType){case"float":switch(t.elementCount){case 1:return u`float`;case 2:return u`vec2`;case 3:return u`vec3`;case 4:return u`vec4`;case 9:return u`mat3`;default:t.elementCount}break;case"int":switch(t.elementCount){case 1:return u`int`;case 2:return u`ivec2`;case 3:return u`ivec3`;case 4:return u`ivec4`;case 9:throw new Error("Invalid element count 9 for type int");default:t.elementCount}break;case"uint":switch(t.elementCount){case 1:return u`uint`;case 2:return u`uvec2`;case 3:return u`uvec3`;case 4:return u`uvec4`;case 9:throw new Error("Invalid element count 9 for type uint");default:t.elementCount}break;default:t.elementType}throw new Error("unsupported field")}const c=new o("constNaN",()=>NaN,{supportsNaN:!0});class p extends r{constructor(t){super(),this.supportNaN=t}}function f(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(c),t.code.add(u`bool bitsEncodeFloat16NaN(highp uint bits) {
|
|
3
3
|
const highp uint nanExponent = 0x00007c00u;
|
|
4
4
|
highp uint exponent = bits & nanExponent;
|
|
5
5
|
highp uint mantissa = bits & 0x000003ffu;
|
|
6
6
|
return exponent == nanExponent && mantissa != 0u;
|
|
7
|
-
}`)),t.code.add(
|
|
7
|
+
}`)),t.code.add(u`
|
|
8
8
|
mediump float unpackHalf1x16(highp uint bits) {
|
|
9
|
-
${
|
|
9
|
+
${i(e,u`
|
|
10
10
|
if (bitsEncodeFloat16NaN(bits)) {
|
|
11
11
|
return constNaN;
|
|
12
12
|
}`)}
|
|
13
13
|
return unpackHalf2x16(bits).x;
|
|
14
|
-
}`),t.code.add(
|
|
14
|
+
}`),t.code.add(u`
|
|
15
15
|
mediump vec2 unpackHalf2x16NaNSupport(highp uint bits) {
|
|
16
16
|
vec2 result = unpackHalf2x16(bits);
|
|
17
|
-
${
|
|
17
|
+
${i(e,u`
|
|
18
18
|
if (bitsEncodeFloat16NaN(bits)) {
|
|
19
19
|
result.x = constNaN;
|
|
20
20
|
}
|
|
21
|
-
if (bitsEncodeFloat16NaN(bits >> ${
|
|
21
|
+
if (bitsEncodeFloat16NaN(bits >> ${u.uint(k[2])})) {
|
|
22
22
|
result.y = constNaN;
|
|
23
23
|
}
|
|
24
24
|
`)}
|
|
25
25
|
return result;
|
|
26
|
-
}`)}function l(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(c),t.code.add(
|
|
26
|
+
}`)}function l(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(c),t.code.add(u`bool bitsEncodeFloat32NaN(highp uint bits) {
|
|
27
27
|
const highp uint nanExponent = 0x7f800000u;
|
|
28
28
|
highp uint exponent = bits & nanExponent;
|
|
29
29
|
highp uint mantissa = bits & 0x007fffffu;
|
|
30
30
|
return exponent == nanExponent && mantissa != 0u;
|
|
31
|
-
}`)),t.code.add(
|
|
31
|
+
}`)),t.code.add(u`
|
|
32
32
|
highp float unpackFloat1x32(highp uint bits) {
|
|
33
|
-
${
|
|
33
|
+
${i(e,u`
|
|
34
34
|
if (bitsEncodeFloat32NaN(bits)) {
|
|
35
35
|
return constNaN;
|
|
36
36
|
}`)}
|
|
37
37
|
return uintBitsToFloat(bits);
|
|
38
|
-
}`)}function d(t){t.code.add(
|
|
38
|
+
}`)}function d(t){t.code.add(u`mediump int unpackInt1x16(highp uint bits) {
|
|
39
39
|
highp uint signExtendedBits = (bits & 0x8000u) != 0u ? (bits | 0xffff0000u) : bits;
|
|
40
40
|
return int(signExtendedBits);
|
|
41
|
-
}`)}function h(t,n){const{fieldType:e}=t;return`${(0,g[e])(y(t,n))}`}function m(t,n){const e=[];for(const o of t){const t=
|
|
41
|
+
}`)}function h(t,n){const{fieldType:e}=t;return`${(0,g[e])(y(t,n))}`}function m(t,n){const e=[];for(const o of t){const t=u`unpackFloat1x32(${o})`;e.push(t)}return e.join(n)}t([a()],p.prototype,"supportNaN",void 0);const x=t=>u`${t[0]}`,$=t=>{const n=t[0],e=u`uvec4(${u.uint(k[0])}, ${u.uint(k[1])}, ${u.uint(k[2])}, ${u.uint(k[3])})`,o=u`uvec4(${u.hexuint(w[1])})`;return u`((uvec4(${n}) >> ${e}) & ${o})`},N=t=>u`(float(${x(t)})/${u.float(n)})`,b=t=>u`unpackFloat1x32(${t[0]})`,v=t=>u`vec4(${m(t,", ")})`,g={u8:x,u32:t=>u`${t[0]}`,unorm8:N,vec4unorm8:t=>u`(vec4(${$(t)})/${u.float(n)})`,snorm16:t=>u`unpackSnorm2x16(${t[0]}).x`,vec2snorm16:t=>u`unpackSnorm2x16(${t[0]})`,f16:e?t=>u`unpackHalf1x16(${t[0]})`:b,vec4f16:e?t=>u`vec4(unpackHalf2x16NaNSupport(${t[0]}), unpackHalf2x16NaNSupport(${t[1]}))`:v,f32:b,vec4u8:$,vec2f32:t=>u`vec2(${m(t,", ")})`,vec3f32:t=>u`vec3(${m(t,", ")})`,vec4f32:v,mat3f32:t=>u`mat3(${m(t,",\n")})`};function y(t,n){const{byteOffset:e,byteSize:o}=t,i=n.channelByteStride,a=n.byteStride,r=Math.ceil(o/E),s=F[n.channels],c=new Array;for(let p=0;p<r;++p){const t=p*E,n=e+t,r=o-t,f=Math.min(r,E);let l=0;const d=new Array;for(;l<f;){const t=n+l,e=Math.floor(t/a),o=t%a,r=Math.floor(o/i),c=o%i,p=i-c,h=f-l,m=Math.min(p,h),x=u`texel${u.int(e)}${s[r]}`,$=4===m?"":u` & ${u.hexuint(w[m])}`,N=0===c?"":u` >> ${u.uint(k[c])}`,b=u`((${x}${N})${$})`,v=0===l?"":u` << ${u.uint(k[l])}`,g=u`(${b})${v}`;d.push(g),l+=m}c.push(u`(${d.join(" | ")})`)}return c}const E=4,k=[0,8,16,24],w=[0,255,65535,16777215,4294967295],F={1:[u``],2:[u`.x`,u`.y`],4:[u`.x`,u`.y`,u`.z`,u`.w`]};export{p as TextureBufferNaNSupportConfiguration,h as glslDecodeField,s as glslType,l as unpackFloat1x32,f as unpackHalf,d as unpackInt1x16};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{clamp as t}from"../../../../core/mathUtils.js";import{set as
|
|
2
|
+
import{clamp as t}from"../../../../core/mathUtils.js";import{set as i,copy as e,exactEquals as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as o,clone as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{newFloatArray as a}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as n,getZeroIndexArray as l}from"../../../../geometry/support/Indices.js";import{Attribute as u}from"./Attribute.js";import{Geometry as h}from"./Geometry.js";import{getPathVertexFrameIndex as p}from"./PathVertexInfo.js";import{createPositionReader as c}from"./PositionReader.js";class m extends h{constructor(t,i,e,s){const{vertexIndices:r,framePositionIndices:a,numExtrusionFrames:h}=i,p=n(h),c=l(h),m=[["position",new u(i.positions,a,3,!0)],["profileRight",new u(i.profileRightAxes,p,2,!0)],["profileUp",new u(i.profileUpAxes,p,2,!0)],["profileRotation",new u(i.profileRotations,p,1,!0)],["pathMaxStretchDistance",new u(i.pathMaxStretchDistances,p,1,!0)],["pathVertexInfo",new u(i.pathVertexInfos,r,1,!0)]];i.profileRotationFrameUpAxes&&m.push(["pathRotationUp",new u(i.profileRotationFrameUpAxes,p,2,!0)]),null!=e.sizeAttributeValue&&m.push(["sizeFeatureAttribute",new u([e.sizeAttributeValue],c,1,!0)]),null!=e.size&&m.push(["size",new u([...e.size],c,2,!0)]),null!=e.colorAttributeValue&&m.push(["colorFeatureAttribute",new u([e.colorAttributeValue],c,1,!0)]),null!=e.color&&m.push(["color",new u([...e.color],c,4,!0)]),null!=e.opacityAttributeValue&&m.push(["opacityFeatureAttribute",new u([e.opacityAttributeValue],c,1,!0)]),null!=e.opacity&&m.push(["opacity",new u([e.opacity],c,1,!0)]),super(t,m,null,0,s,0),this.builder=i,this.visualVariablesState=e,this._lastSize=o()}get indexCount(){return this.attributes.get("pathVertexInfo")?.indices.length??0}get readPrimitivePosition(){if(this._invalidateOnSizeChange(),null==this._readPrimitivePosition){const{builder:t,size:i}=this,{vertexIndices:e,numVerticesTotal:s,evaluator:o}=t,r=a(3*s);for(let a=0;a<s;++a)o.evaluateVertexPosition(r,i,a,a);this._readPrimitivePosition=c(r,e,3)}return this._readPrimitivePosition}onPathChanged(){this.builder.onPathChanged(),this.invalidateBoundingInfo(),i(this._lastSize,-1,-1),this._invalidateReadPrimitivePosition()}get size(){const{parameters:i}=this.material,s=r(i.size);if(i.vvSize){const{offset:e,factor:o,minSize:r,maxSize:a,fallback:n}=i.vvSize,l=this.visualVariablesState.sizeAttributeValue??NaN;Number.isNaN(l)?(s[0]*=n[0],s[1]*=n[2]):(s[0]*=t(e[0]+l*o[0],r[0],a[0]),s[1]*=t(e[2]+l*o[2],r[2],a[2]))}else i.hasPathSize&&this.visualVariablesState.size&&e(s,this.visualVariablesState.size);return s}_computePrimitivePositionIndices(){const t=this.attributes.get("pathVertexInfo"),i=this.attributes.get("position");if(t&&i){const e=i.indices,s=t.indices,o=t.data;return s.map(i=>e[p(o[t.stride*i])])}return i?.indices??null}get boundingInfo(){return this._invalidateOnSizeChange(),super.boundingInfo}_invalidateOnSizeChange(){const{size:t}=this;s(t,this._lastSize)||(e(this._lastSize,t),this.invalidateBoundingInfo(),this._invalidateReadPrimitivePosition())}}function f(t){return t instanceof m}export{m as PathGeometry,f as isPathGeometry};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{sliceEquals as i}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{watch as r,sync as a}from"../../../../core/reactiveUtils.js";import{signal as o}from"../../../../core/signal.js";import{property as n,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{copy as c,equals as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as m}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{F as _}from"../../../../chunks/FocusAreaMask.glsl.js";import{volumeToVao as d}from"../effects/focusArea/focusAreaMaskUtils.js";import{BindParameters as p}from"./BindParameters.js";import{DepthRange as f}from"./DepthRange.js";import{createQuadVAO as g}from"./glUtil3D.js";import{ShadowCastRenderer as b}from"./ShadowCastRenderer.js";import{ShadowMap as v}from"./ShadowMap.js";import{S as y}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as S}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as w}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as A}from"../shaders/ShadowCastClearTechnique.js";import{ShadowCastMaskTechnique as x}from"../shaders/ShadowCastMaskTechnique.js";import{PrimitiveType as C,DepthStencilAttachment as R,PixelType as F}from"../../../webgl/enums.js";import{DisposableFramebufferObject as q}from"../../../webgl/FramebufferObject.js";import{noParameters as V}from"../../../webgl/NoParameters.js";let H=class extends t{constructor(e,t,i,s,o){super({}),this._fbos=e,this._techniques=t,this._renderToShadowMap=s,this._requestRender=o,this.fullyRecompute=!1,this._analysisVolumeGeometry=null,this._primarySet=new D(new w(0),()=>this._requestRenderIfEnabled()),this._contextSet=new D(new w(1),()=>this._requestRenderIfEnabled()),this._passParameters=new m,this._maskParameters=new _,this._volumeVao=null,this._volumeVertexCount=0,this._depthRange=f.Zero,this._enabled=!1,this._previewing=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._bindParameters=new p(e.rctx,new v(e,i.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=g(e.rctx),this._accumulationRenderer=new b({view:i.view,data:this}),this._tmpReadFbo=new q(e.rctx),this.addHandles([r(()=>this._previewing,e=>{e?this._invalidateAccumulationSets():this._requestRenderIfEnabled()},a),r(()=>this._numActive,()=>this._numActiveChanged(),a)],this._shadowAccumulatorKey)}destroy(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._fboHandle=s(this._fboHandle),this._vao=s(this._vao),this._volumeVao=s(this._volumeVao),this._tmpReadFbo=s(this._tmpReadFbo),this._bindParameters.destroy();for(const e of this._accumulationSets())e.destroy();this._contextSet=null,this._primarySet=null}*_accumulationSets(){yield this._primarySet,yield this._contextSet}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fboHandle?.getTexture()}get accumulating(){return this.active&&(this._previewing||this._refining||this.fullyRecompute)}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return this._enabled&&[...this._accumulationSets()].some(e=>e.active)}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==f.Zero&&this._accumulationRenderer.isAboveElevationThreshold}get _doneAccumulating(){return[...this._accumulationSets()].every(e=>e.doneAccumulating)}get _numActive(){return[...this._accumulationSets()].reduce((e,t)=>e+(t.active?1:0),0)}get _colorFormat(){return 2===this._numActive?2:0}get _analysisVolume(){return this._analysisVolumeGeometry}set _analysisVolume(e){if(this._analysisVolumeGeometry===e)return;this._invalidateAccumulationSets(),this._analysisVolumeGeometry=e,this._volumeVao=s(this._volumeVao),this._volumeVertexCount=0;const t=null!=e;for(const s of this._accumulationSets())s.configuration.useMask=t;if(!t)return;const i=e.geometryVolume,{vao:r,vertexCount:a}=d(this._rctx,i);this._volumeVao=r,this._volumeVertexCount=a}get requiresDepth(){return this.accumulating||null!=this._volumeVao}renderAccumulation(e){if(!this.active)return!1;if(this._bindParameters.contentCamera=e.contentCamera,this._bindParameters.depth=e.depth,this._passParameters.origin=this._bindParameters.camera.center,!this.canAccumulate)return this._bindParameters.depth=null,!1;if(this._renderAreaMask(),!this.accumulating)return this._bindParameters.depth=null,!1;(this._previewing||this.fullyRecompute)&&this._reset(),this._clearBuffersOnAccumulationStart(this._bindParameters);const t=this._accumulateSetsForRenderFrame(this._previewing&&!this.fullyRecompute,this._bindParameters);return this._bindParameters.depth=null,t}_renderAreaMask(){const e=this._techniques.getCompiled(x),t=this._volumeVao,i=this._volumeVertexCount,s=this._fboHandle,r=this._analysisVolume;if(s?.detachDepth(),!e||!t||i<1||!s||!r)return;s.acquireDepth(14);const a=this._rctx,o=this._bindParameters,n=o.depth,h=this._tmpReadFbo;h.attachDepthStencil(n?.attachment),a.blitFramebuffer(h,s.fbo,256),h.detachDepthStencilTexture(),a.bindFramebuffer(s.fbo),a.setClearStencil(0),a.clear(1024),a.setViewport(0,0,o.camera.width,o.camera.height);const c=a.bindTechnique(e,o,V);this._maskParameters.origin=r.origin,c.bindDraw(o,V,this._maskParameters),a.bindVAO(t),a.drawArrays(C.TRIANGLES,0,i)}_clearBuffersOnAccumulationStart(e){if([...this._accumulationSets()].every(e=>0===e.progress))this._clearFramebuffer();else for(const t of this._accumulationSets())0===t.progress&&this._clearFramebufferForSet(this._fboHandle,t,e)}_accumulateSetsForRenderFrame(e,t){let i=!1;for(const s of this._accumulationSets())this._accumulateSet(s,e,t),i=!0;return i&&this._requestRender(),i}_accumulateSet(e,t,i){const s=t?Math.min(j,e.sampleCount)-e.progress:e.sampleCount-e.progress;for(let r=0;r<s;++r)this._accumulateShadow(e,i)}precompilePrepass(){if(this.accumulating){for(const e of this._accumulationSets())this._techniques.precompile(S,e.configuration),this._techniques.precompile(A,e.configuration);this._techniques.precompile(x)}}precompile(){this._accumulationRenderer.precompile()}updateMask(){this._accumulationRenderer.setStencilMask(this._fboHandle?.getAttachment(R))}setParameters(e){void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._primarySet.lightDirections=e.lightDirections),void 0!==e.lightDirectionsContext&&(this._contextSet.lightDirections=e.lightDirectionsContext),!0===e.enabled?this._enable():!1===e.enabled&&this._disable(),void 0!==e.analysisVolume&&(this._analysisVolume=e.analysisVolume),this._accumulationRenderer.setOptions(e)}readAccumulatedShadow(e,t){const i=this._primarySet.progress;return!this.active||!this._fboHandle||i<1||e<0||e>=this._fboHandle.fbo.width||t<0||t>=this._fboHandle.fbo.height?0:(this._fboHandle.fbo.readPixels(e,t,1,1,6408,F.UNSIGNED_BYTE,P),P[0]/i)}updateCamera(e){if(!this.active)return;const t=this._bindParameters.camera;e.equals(t)||t.copyFrom(e),this._isAccumulationValid(e)||(this._fboHandle?.release(),this._fboHandle=this._createFBO(e.fullWidth,e.fullHeight),this._reset()),this._accumulationRenderer.setOpacityFromElevation(e.relativeElevation)}_numActiveChanged(){if(!this._enabled||!this._fboHandle)return;const e=2===this._numActive,{width:t,height:i}=this._fboHandle.fbo,s=this._createFBO(t,i);e&&(this._clearFramebuffer(s),this._contextSet.reset()),this._rctx.blitFramebuffer(this._fboHandle.fbo,s.fbo),this._fboHandle.dispose(),this._fboHandle=s,this._requestRender()}_enable(){this._enabled||(this._enabled=!0,this._invalidateAccumulationSets())}_disable(){this._enabled&&(this._fboHandle=s(this._fboHandle),this._enabled=!1,this._requestRender())}_createFBO(e,t){return this._fbos.acquire(e,t,"shadow accumulation",this._colorFormat)}_invalidateAccumulationSets(){for(const e of this._accumulationSets())e.reset();this._requestRenderIfEnabled()}_reset(){for(const e of this._accumulationSets())e.reset()}_clearFramebuffer(e=this._fboHandle){e&&(this._rctx.bindFramebuffer(e.fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(16384))}_clearFramebufferForSet(e,t,i){if(!e)return;const s=this._techniques.get(A,t.configuration);this._rctx.bindFramebuffer(e.fbo),this._rctx.bindTechnique(s,i,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(s.primitiveType,0,this._vao.vertexCount("geometry"))}_accumulateShadow(e,t){this._renderToShadowMap(t,e.lightDirections[e.progress++],this._depthRange);const i=this._techniques.get(S,e.configuration);this._rctx.bindFramebuffer(this._fboHandle?.fbo),this._rctx.bindTechnique(i,t,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.primitiveType,0,this._vao.vertexCount("geometry"))}_isAccumulationValid(e){return this._fboHandle?.fbo.width===e.fullWidth&&this._fboHandle?.fbo.height===e.fullHeight}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}get _rctx(){return this._fbos.rctx}updateDepthRange(e){this._depthRange.equals(e)||(this._depthRange=e,this._invalidateAccumulationSets())}get test(){}};e([n()],H.prototype,"_refining",null),e([n()],H.prototype,"active",null),e([n()],H.prototype,"_doneAccumulating",null),e([n()],H.prototype,"_numActive",null),e([n()],H.prototype,"_colorFormat",null),e([n()],H.prototype,"_depthRange",void 0),e([n()],H.prototype,"_enabled",void 0),e([n()],H.prototype,"_previewing",void 0),e([n()],H.prototype,"_accumulationRenderer",void 0),H=e([h("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],H);const j=6,P=new Uint8Array(4);class D{constructor(e,t){this.configuration=e,this._notifyChange=t,this._cachedLightDirections=[],this._progress=o(0),this._sampleCount=o(0)}get progress(){return this._progress.value}set progress(e){this._progress.value=e}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(e){const t=this._cachedLightDirections,s=Math.min(y,e.length);if(!i(t,0,t.length,e,0,s,u)){t.length=s,this._sampleCount.value=s;for(let i=0;i<s;++i)t[i]=c(t[i]??l(),e[i]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}precompile(e){e.precompile(S,this.configuration),e.precompile(A,this.configuration)}}export{H as ShadowAccumulator};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{sliceEquals as i}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{watch as r,sync as a}from"../../../../core/reactiveUtils.js";import{signal as o}from"../../../../core/signal.js";import{property as n,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{copy as c,equals as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as m}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{F as _}from"../../../../chunks/FocusAreaMask.glsl.js";import{volumeToVao as d}from"../effects/focusArea/focusAreaMaskUtils.js";import{BindParameters as p}from"./BindParameters.js";import{DepthRange as f}from"./DepthRange.js";import{createQuadVAO as g}from"./glUtil3D.js";import{ShadowCastRenderer as b}from"./ShadowCastRenderer.js";import{ShadowMap as v}from"./ShadowMap.js";import{S as y}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as S}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as w}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as A}from"../shaders/ShadowCastClearTechnique.js";import{ShadowCastMaskTechnique as x}from"../shaders/ShadowCastMaskTechnique.js";import{PrimitiveType as C,DepthStencilAttachment as R,PixelType as F}from"../../../webgl/enums.js";import{DisposableFramebufferObject as q}from"../../../webgl/FramebufferObject.js";import{noParameters as V}from"../../../webgl/NoParameters.js";let H=class extends t{constructor(e,t,i,s,o){super({}),this._fbos=e,this._techniques=t,this._renderToShadowMap=s,this._requestRender=o,this.fullyRecompute=!1,this._analysisVolumeGeometry=null,this._primarySet=new D(new w(0),()=>this._requestRenderIfEnabled()),this._contextSet=new D(new w(1),()=>this._requestRenderIfEnabled()),this._passParameters=new m,this._maskParameters=new _,this._volumeVao=null,this._volumeVertexCount=0,this._depthRange=f.Zero,this._enabled=!1,this._previewing=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._bindParameters=new p(e.rctx,new v(e,i.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=g(e.rctx),this._accumulationRenderer=new b({view:i.view,data:this}),this._tmpReadFbo=new q(e.rctx),this.addHandles([r(()=>this._previewing,e=>{e?this._invalidateAccumulationSets():this._requestRenderIfEnabled()},a),r(()=>this._numActive,()=>this._numActiveChanged(),a)],this._shadowAccumulatorKey)}destroy(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._fboHandle=s(this._fboHandle),this._vao=s(this._vao),this._volumeVao=s(this._volumeVao),this._tmpReadFbo=s(this._tmpReadFbo),this._bindParameters.destroy();for(const e of this._accumulationSets())e.destroy();this._contextSet=null,this._primarySet=null}*_accumulationSets(){yield this._primarySet,yield this._contextSet}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fboHandle?.getTexture()}get accumulating(){return this.active&&(this._previewing||this._refining||this.fullyRecompute)}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return this._enabled&&this._accumulationSets().some(e=>e.active)}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==f.Zero&&this._accumulationRenderer.isAboveElevationThreshold}get _doneAccumulating(){return this._accumulationSets().every(e=>e.doneAccumulating)}get _numActive(){return this._accumulationSets().reduce((e,t)=>e+(t.active?1:0),0)}get _colorFormat(){return 2===this._numActive?2:0}get _analysisVolume(){return this._analysisVolumeGeometry}set _analysisVolume(e){if(this._analysisVolumeGeometry===e)return;this._invalidateAccumulationSets(),this._analysisVolumeGeometry=e,this._volumeVao=s(this._volumeVao),this._volumeVertexCount=0;const t=null!=e;for(const s of this._accumulationSets())s.configuration.useMask=t;if(!t)return;const i=e.geometryVolume,{vao:r,vertexCount:a}=d(this._rctx,i);this._volumeVao=r,this._volumeVertexCount=a}get requiresDepth(){return this.accumulating||null!=this._volumeVao}renderAccumulation(e){if(!this.active)return!1;if(this._bindParameters.contentCamera=e.contentCamera,this._bindParameters.depth=e.depth,this._passParameters.origin=this._bindParameters.camera.center,!this.canAccumulate)return this._bindParameters.depth=null,!1;if(this._renderAreaMask(),!this.accumulating)return this._bindParameters.depth=null,!1;(this._previewing||this.fullyRecompute)&&this._reset(),this._clearBuffersOnAccumulationStart(this._bindParameters);const t=this._accumulateSetsForRenderFrame(this._previewing&&!this.fullyRecompute,this._bindParameters);return this._bindParameters.depth=null,t}_renderAreaMask(){const e=this._techniques.getCompiled(x),t=this._volumeVao,i=this._volumeVertexCount,s=this._fboHandle,r=this._analysisVolume;if(s?.detachDepth(),!e||!t||i<1||!s||!r)return;s.acquireDepth(14);const a=this._rctx,o=this._bindParameters,n=o.depth,h=this._tmpReadFbo;h.attachDepthStencil(n?.attachment),a.blitFramebuffer(h,s.fbo,256),h.detachDepthStencilTexture(),a.bindFramebuffer(s.fbo),a.setClearStencil(0),a.clear(1024),a.setViewport(0,0,o.camera.width,o.camera.height);const c=a.bindTechnique(e,o,V);this._maskParameters.origin=r.origin,c.bindDraw(o,V,this._maskParameters),a.bindVAO(t),a.drawArrays(C.TRIANGLES,0,i)}_clearBuffersOnAccumulationStart(e){if(this._accumulationSets().every(e=>0===e.progress))this._clearFramebuffer();else for(const t of this._accumulationSets())0===t.progress&&this._clearFramebufferForSet(this._fboHandle,t,e)}_accumulateSetsForRenderFrame(e,t){let i=!1;for(const s of this._accumulationSets())this._accumulateSet(s,e,t),i=!0;return i&&this._requestRender(),i}_accumulateSet(e,t,i){const s=t?Math.min(j,e.sampleCount)-e.progress:e.sampleCount-e.progress;for(let r=0;r<s;++r)this._accumulateShadow(e,i)}precompilePrepass(){if(this.accumulating){for(const e of this._accumulationSets())this._techniques.precompile(S,e.configuration),this._techniques.precompile(A,e.configuration);this._techniques.precompile(x)}}precompile(){this._accumulationRenderer.precompile()}updateMask(){this._accumulationRenderer.setStencilMask(this._fboHandle?.getAttachment(R))}setParameters(e){void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._primarySet.lightDirections=e.lightDirections),void 0!==e.lightDirectionsContext&&(this._contextSet.lightDirections=e.lightDirectionsContext),!0===e.enabled?this._enable():!1===e.enabled&&this._disable(),void 0!==e.analysisVolume&&(this._analysisVolume=e.analysisVolume),this._accumulationRenderer.setOptions(e)}readAccumulatedShadow(e,t){const i=this._primarySet.progress;return!this.active||!this._fboHandle||i<1||e<0||e>=this._fboHandle.fbo.width||t<0||t>=this._fboHandle.fbo.height?0:(this._fboHandle.fbo.readPixels(e,t,1,1,6408,F.UNSIGNED_BYTE,P),P[0]/i)}updateCamera(e){if(!this.active)return;const t=this._bindParameters.camera;e.equals(t)||t.copyFrom(e),this._isAccumulationValid(e)||(this._fboHandle?.release(),this._fboHandle=this._createFBO(e.fullWidth,e.fullHeight),this._reset()),this._accumulationRenderer.setOpacityFromElevation(e.relativeElevation)}_numActiveChanged(){if(!this._enabled||!this._fboHandle)return;const e=2===this._numActive,{width:t,height:i}=this._fboHandle.fbo,s=this._createFBO(t,i);e&&(this._clearFramebuffer(s),this._contextSet.reset()),this._rctx.blitFramebuffer(this._fboHandle.fbo,s.fbo),this._fboHandle.dispose(),this._fboHandle=s,this._requestRender()}_enable(){this._enabled||(this._enabled=!0,this._invalidateAccumulationSets())}_disable(){this._enabled&&(this._fboHandle=s(this._fboHandle),this._enabled=!1,this._requestRender())}_createFBO(e,t){return this._fbos.acquire(e,t,"shadow accumulation",this._colorFormat)}_invalidateAccumulationSets(){for(const e of this._accumulationSets())e.reset();this._requestRenderIfEnabled()}_reset(){for(const e of this._accumulationSets())e.reset()}_clearFramebuffer(e=this._fboHandle){e&&(this._rctx.bindFramebuffer(e.fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(16384))}_clearFramebufferForSet(e,t,i){if(!e)return;const s=this._techniques.get(A,t.configuration);this._rctx.bindFramebuffer(e.fbo),this._rctx.bindTechnique(s,i,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(s.primitiveType,0,this._vao.vertexCount("geometry"))}_accumulateShadow(e,t){this._renderToShadowMap(t,e.lightDirections[e.progress++],this._depthRange);const i=this._techniques.get(S,e.configuration);this._rctx.bindFramebuffer(this._fboHandle?.fbo),this._rctx.bindTechnique(i,t,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.primitiveType,0,this._vao.vertexCount("geometry"))}_isAccumulationValid(e){return this._fboHandle?.fbo.width===e.fullWidth&&this._fboHandle?.fbo.height===e.fullHeight}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}get _rctx(){return this._fbos.rctx}updateDepthRange(e){this._depthRange.equals(e)||(this._depthRange=e,this._invalidateAccumulationSets())}get test(){}};e([n()],H.prototype,"_refining",null),e([n()],H.prototype,"active",null),e([n()],H.prototype,"_doneAccumulating",null),e([n()],H.prototype,"_numActive",null),e([n()],H.prototype,"_colorFormat",null),e([n()],H.prototype,"_depthRange",void 0),e([n()],H.prototype,"_enabled",void 0),e([n()],H.prototype,"_previewing",void 0),e([n()],H.prototype,"_accumulationRenderer",void 0),H=e([h("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],H);const j=6,P=new Uint8Array(4);class D{constructor(e,t){this.configuration=e,this._notifyChange=t,this._cachedLightDirections=[],this._progress=o(0),this._sampleCount=o(0)}get progress(){return this._progress.value}set progress(e){this._progress.value=e}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(e){const t=this._cachedLightDirections,s=Math.min(y,e.length);if(!i(t,0,t.length,e,0,s,u)){t.length=s,this._sampleCount.value=s;for(let i=0;i<s;++i)t[i]=c(t[i]??l(),e[i]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}precompile(e){e.precompile(S,this.configuration),e.precompile(A,this.configuration)}}export{H as ShadowAccumulator};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{disposeMaybe as t}from"../../../../../core/maybe.js";import{Vec4Field as e,ScalarField as r}from"./TextureBackedBufferFields.js";import{getItemsRectangle as
|
|
2
|
+
import{disposeMaybe as t}from"../../../../../core/maybe.js";import{Vec4Field as e,ScalarField as r}from"./TextureBackedBufferFields.js";import{getItemsRectangle as u}from"./TextureBackedBufferUtils.js";import{TextureBuffer as i}from"./TextureBuffer.js";class s{constructor(t,e){this._rctx=t,this._layout=e,this._nameToFieldMap=new Map,this._dirty=!0,this._textureData=e.createBuffer(0),this._setupFields(e)}get layout(){return this._layout}get usedMemory(){return this._textureData.usedMemory+(this._textureBuffer?.usedMemory??0)}get itemCount(){return this._textureData.count}dispose(){this._textureBuffer=t(this._textureBuffer),this._textureData=void 0}get test(){return{data:this._textureData}}getScalarField(t){const e=this._nameToFieldMap.get(t);return 1===e?.elementCount?e:null}getVec4Field(t){const e=this._nameToFieldMap.get(t);return 4===e?.elementCount?e:null}resizeToFit(t){const e=t+1;e>this._textureData.count&&this._resize(e)}updateTexture(){const e=this._textureBuffer,r=null==e||!e.texture.hasWebGLTextureObject;if(this._dirty||r){if(this._dirty=!1,0!==this._textureData.count)return r||e.itemCount<this._textureData.count?(this._textureBuffer=t(this._textureBuffer),void(this._textureBuffer=new i(this._rctx,this.layout,this._textureData.buffer))):void e.setSubData(this._textureData.buffer);this._textureBuffer=t(this._textureBuffer)}}get texture(){return this._textureBuffer?.texture}_resize(t){const{_layout:e}=this;if(0===t)return this._textureData=e.createBuffer(0),this._updateFields(),void(this._dirty=!0);const r=u(t).itemCount,i=e.createBuffer(r);i.texelElementBuffer.set(this._textureData.texelElementBuffer),this._textureData=i,this._updateFields(),this._dirty=!0}_setupFields(t){const u=this._textureData,i=()=>{this._dirty=!0},s=new Map;for(const[o,a]of t.fields){const t=u.getField(o,a.bufferViewConstructor);if(null==t)throw new Error(`Field ${o} does not exist in buffer`);s.set(o,4===t.elementCount?new e(t,a,i):new r(t,a,i))}this._nameToFieldMap=s}_updateFields(){const t=this._textureData;for(const[e,r]of this._nameToFieldMap){const u=t.getField(e,r.layoutField.bufferViewConstructor);if(null==u)throw new Error(`Field ${e} does not exist in buffer`);r.updateBufferView(u)}}}export{s as TextureBackedBuffer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{hasNativeFloat16Array as e}from"../../../../../geometry/support/float16.js";import{BufferViewMat3f as t,BufferViewVec4f as o,BufferViewVec3f as
|
|
2
|
+
import{hasNativeFloat16Array as e}from"../../../../../geometry/support/float16.js";import{BufferViewMat3f as t,BufferViewVec4f as o,BufferViewVec3f as n,BufferViewVec2f as f,BufferViewFloat as r,BufferViewVec4f16 as u,BufferViewFloat16 as m,BufferViewVec2Snorm16 as s,BufferViewSnorm16 as l,BufferViewVec4Unorm8 as w,BufferViewUnorm8 as a,BufferViewVec4u8 as i,BufferViewUint32 as c,BufferViewUint8 as p}from"../../../../../geometry/support/buffer/BufferView.js";import{elementTypeSize as v}from"../../../../../geometry/support/buffer/types.js";class y{constructor(e,t,o){this.elementCount=e,this.elementType=t,this.bufferViewConstructor=o,this.byteSize=b(o)}}function b(e){return v(e.ElementType)*e.ElementCount}const h={u8:new y(1,"uint",p),u32:new y(1,"uint",c),vec4u8:new y(4,"uint",i),unorm8:new y(1,"float",a),vec4unorm8:new y(4,"float",w),snorm16:new y(1,"float",l),vec2snorm16:new y(2,"float",s),f16:new y(1,"float",e?m:r),vec4f16:new y(4,"float",e?u:o),f32:new y(1,"float",r),vec2f32:new y(2,"float",f),vec3f32:new y(3,"float",n),vec4f32:new y(4,"float",o),mat3f32:new y(9,"float",t)};export{y as FieldCreationInfo,h as typeToCreationInfoMap};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import has from"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{releaseMaybe as e}from"../../../../core/maybe.js";import{fromRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as r,add as o,negate as a,transformMat4 as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyTextureResizeModulo as n}from"./textureUtils.js";import{ViewshedFaceCamera as
|
|
2
|
+
import has from"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{releaseMaybe as e}from"../../../../core/maybe.js";import{fromRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as r,add as o,negate as a,transformMat4 as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyTextureResizeModulo as n}from"./textureUtils.js";import{ViewshedFaceCamera as u}from"./ViewshedFaceCamera.js";import{DepthStencilAttachment as l,SizedDepthFormat as f}from"../../../webgl/enums.js";import{isSizedDepthStencilFormat as m}from"../../../webgl/textureUtils.js";class d{constructor(){this.textureSizeQuality=1,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.textureSizeMultiple=128,this.toleranceSides=5,this.toleranceBottomTop=10}textureSizeModifier(t){const e=t?this.textureSizeModHighQuality:this.textureSizeModLowQuality;return this.textureSizeQuality*e}textureResizeModulo(t){return Math.ceil(t/this.textureSizeMultiple)*this.textureSizeMultiple}}const p=["front","left","right","back","top","bottom"];function g(t){return!["top","bottom"].includes(t)}class _{constructor(t){this._fbos=t,this._faces={},this._width=0,this._height=0,this.settings=new d,this._maxTextureSize=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}get depthTexture(){return this._fbo?.getTexture(l)}get ready(){return null!=this.depthTexture&&0!==this._width&&0!==this._height}get nearFar(){const t=this.faces;return 0===t.length?null:t[0].nearFar}get numActiveFaces(){const t=this._faces;let e=0;return Object.keys(t).forEach(i=>{t[i]&&(e+=1)}),e}get faces(){const t=this._faces,e=[];for(const i of p){const s=t[i];s&&e.push(s)}return e}get atlasRegions(){return this.faces.map(t=>[t.x/this._width,(t.x+t.width)/this._width,t.y/this._height,(t.y+t.height)/this._height])}get viewshedProjectionMatrices(){return this.faces.map(t=>t.projectionMatrix)}get viewshedViewMatrices(){return this.faces.map(t=>t.viewMatrix)}_setupFaceCamera(e,n,l,f){const{effectiveObserverRenderSpace:m,effectiveTargetRenderSpace:d,tiltedUpVector:p,farDistanceRenderSpace:_,horizontalFieldOfView:x,verticalFieldOfView:b}=n,w=c();r(w,d,m);const M=c(),S=c(),F=(t,e)=>{const r=c(),a=s();return i(a,t,e),h(r,w,a),o(r,m,r),r};let z,T=p;const v=Math.min(90,x),O=Math.min(90,Math.max(0,(x-90)/2));let B=-45,j=45,y=-45,k=45;if(g(e)){const e=e=>t(e,-45,45);y=e(-b/2)-this.settings.toleranceBottomTop,k=e(+b/2)+this.settings.toleranceBottomTop}switch(e){case"front":z=d,B=-v/2,j=v/2;break;case"left":z=F(Math.PI/2,p),B=45-O;break;case"right":z=F(-Math.PI/2,p),j=-45+O;break;case"top":z=o(M,m,p),T=a(S,w);break;case"bottom":z=r(M,m,p),T=w;break;case"back":z=F(Math.PI,p)}const V=new u({center:z,eye:m,up:T,far:_});V.sectionAnglesDeg=[B-this.settings.toleranceSides,j+this.settings.toleranceSides,y,k],V.fovY=Math.PI/2;const P=V.setViewport(l,f);return this._faces[e]=V,P}isActive(t){return this._computeActiveFaces(t).size>0}_computeActiveFaces(t){const e=new Set,{horizontalFieldOfView:i,verticalFieldOfView:s}=t,r=-s/2,o=s/2;return 0===i||0===s||(r<=45&&o>=-45&&e.add("front"),i>90&&(e.add("left"),e.add("right")),i>270&&e.add("back"),o>45-this.settings.toleranceBottomTop&&e.add("top"),r<-45+this.settings.toleranceBottomTop&&e.add("bottom")),e}_computeBaseTextureSize({pixelRatio:t,fullWidth:e,fullHeight:i},s,r,o){const a=s/t,h=this.settings.textureSizeModifier(r);return n(Math.max(e,i)*a*h,this._maxTextureSize/o)}_ensureFBO(t){const e=this._width,i=this._height,s=this._fbo?.fbo;s&&s.width===e&&s.height===i&&t===m(s.depthStencilTexture?.descriptor?.internalFormat??f.DEPTH_COMPONENT16)||(this._fbo?.release(),this._fbo=this._allocateFBO(t))}_allocateFBO(t){const{_width:e,_height:i}=this,s=t?14:13,r=this._fbos.acquire(e,i,"viewshed shadow map",s);return r.getTexture(l)?.setShadowFiltering(!1),r}clearFBO(t){const e=this._fbos.rctx;this._ensureFBO(t),e.bindFramebuffer(this._fbo?.fbo),e.setClearColor(1,1,1,1),e.clear(16640)}dispose(){this._fbo=e(this._fbo)}releaseFBO(){this._debugFBO||(this._fbo=e(this._fbo))}start(t,e,i,s,r=!1){this._faces={};const o=this._computeActiveFaces(e),a=o.size;if(0===a)return!1;const h=this._computeBaseTextureSize(t,s,i,a);let c=0,n=0,u=0;for(const l of o){const t=x(l,a);t>n&&(u=Math.max(u,c),c=0),n=t;const i=t*h;c+=this._setupFaceCamera(l,e,[c,i],h)}return u=Math.max(u,c),this._width=this.settings.textureResizeModulo(u),this._height=b(a)*h,this.clearFBO(r),!0}finish(){}get test(){}}function x(t,e){if(e<4)return 0;const i="front"===t||"left"===t;return 4===e?i?0:1:i||"right"===t?0:1}function b(t){return t<4?1:2}export{_ as ViewshedShadowMap};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{unique as e}from"../../../../../core/arrayUtils.js";import{estimateNumberArrayMemory as t,baseTypedArrayMemory as r}from"../../../../../core/memoryEstimations.js";import{IntersectorResultRay as s}from"../IntersectorResult.js";import{LodTarget as n}from"./Intersector.js";class i{constructor(e,t,r,s){this.material=e,this.buffer=t,this.numVertices=r,this.boundingInfo=s,this.bufferWriter=e.createBufferWriter()}get layout(){return this.bufferWriter.layout}get numTriangles(){return this.numVertices/3}computeUsedMemory(){return this.buffer.byteLength+r}get renderGeometry(){return this}}class o{constructor(e){this.engineGeometry=e;const t=this.material,r=this.engineGeometry,s=r.attributes,n=r.boundingInfo,o=t.createBufferWriter(),a=o.layout,m=o.elementCount(s),u=a.createBuffer(m);o.write(null,null,s,null,{buffer:u,offset:0}),this.renderGeometry=new i(t,u.buffer,m,n)}get material(){return this.engineGeometry.material}get numVertices(){return this.engineGeometry.indexCount}get numTriangles(){return this.numVertices/3}get boundingInfo(){return this.engineGeometry.boundingInfo}computeUsedMemory(){return
|
|
2
|
+
import{unique as e}from"../../../../../core/arrayUtils.js";import{estimateNumberArrayMemory as t,baseTypedArrayMemory as r}from"../../../../../core/memoryEstimations.js";import{IntersectorResultRay as s}from"../IntersectorResult.js";import{LodTarget as n}from"./Intersector.js";class i{constructor(e,t,r,s){this.material=e,this.buffer=t,this.numVertices=r,this.boundingInfo=s,this.bufferWriter=e.createBufferWriter()}get layout(){return this.bufferWriter.layout}get numTriangles(){return this.numVertices/3}computeUsedMemory(){return this.buffer.byteLength+r}get renderGeometry(){return this}}class o{constructor(e){this.engineGeometry=e;const t=this.material,r=this.engineGeometry,s=r.attributes,n=r.boundingInfo,o=t.createBufferWriter(),a=o.layout,m=o.elementCount(s),u=a.createBuffer(m);o.write(null,null,s,null,{buffer:u,offset:0}),this.renderGeometry=new i(t,u.buffer,m,n)}get material(){return this.engineGeometry.material}get numVertices(){return this.engineGeometry.indexCount}get numTriangles(){return this.numVertices/3}get boundingInfo(){return this.engineGeometry.boundingInfo}computeUsedMemory(){return this.engineGeometry.attributes.values().reduce((e,r)=>e+t(r.data,r.indices),0)}intersect(e,t,r,s,n,i,o,m){const u=this.engineGeometry;this.material.intersectRay(u,e.transform.transform,e,r,s,(r,s,u)=>a(r,s,u,e,t,i,o,n,m))}intersectScreenPolygon(e,t,r,s,i,o){const a=this.engineGeometry,m=this.material.intersectScreenPolygon?.(a,e.transform.transform,e,t);m?.valid&&e.polygonResults.add(3,new n(s.layerViewUid,s.graphicUid(r),m.primitiveIndex,i,o),m.distance)}}function a(e,t,r,i,o,a,m,u,c){if(e<0)return;if(o&&!o(i.rayBegin,i.rayEnd,e))return;const l=new n(a.layerViewUid,a.graphicUid(u),r,m,c);if((null==i.results.min.distance||e<i.results.min.distance)&&i.results.min.set(3,l,e,t,i.transform.transform),(null==i.results.max.distance||e>i.results.max.distance)&&i.results.max.set(3,l,e,t,i.transform.transform),2===i.options.store){const r=new s(i.results.min.ray);r.set(3,l,e,t,i.transform.transform),i.results.all.push(r)}}class m{constructor(e,t=null){this.geometry=e,this.textures=t}get material(){return this.geometry.material}get numTriangles(){return this.geometry.numTriangles}}class u{constructor(t,r,s){this.components=t,this.minScreenSpaceRadius=r,this.pivotOffset=s;const n=e(this.components.map(e=>e.geometry));this.numVertices=n.reduce((e,t)=>e+t.numVertices,0)}}class c{constructor(e){this.levels=e,this.levels.sort((e,t)=>e.minScreenSpaceRadius===t.minScreenSpaceRadius?e.numVertices-t.numVertices:e.minScreenSpaceRadius-t.minScreenSpaceRadius)}get materialParameters(){return this.levels[0].components[0].geometry.material.parameters}getMaterials(){const t=[];return this.levels.forEach(e=>e.components.forEach(e=>t.push(e.geometry.material))),e(t)}getTextures(){const t=new Array;return this.levels.forEach(e=>e.components.forEach(e=>{null!=e.textures&&t.push(...e.textures)})),e(t)}getGeometries(){const t=new Array;return this.levels.forEach(e=>e.components.forEach(e=>{t.push(e.geometry)})),e(t)}getEngineGeometries(){return this.getGeometries().map(e=>e.engineGeometry).filter(e=>null!=e)}computeUsedMemory(){const e=this.getGeometries(),t=this.getTextures(),r=e.reduce((e,t)=>e+t.computeUsedMemory(),0);return t.reduce((e,t)=>e+t.usedMemory,0)+r}}export{o as LodComponentEngineGeometry,i as LodComponentRenderGeometry,m as LodComponentResources,u as LodLevelResources,c as LodResources};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import t from"../../../../core/PooledArray.js";import{createScreenPointArray as e}from"../../../../core/screenUtils.js";import{
|
|
2
|
+
import t from"../../../../core/PooledArray.js";import{createScreenPointArray as e}from"../../../../core/screenUtils.js";import{distance as r,copy as o,set as i,transformMat4 as n,squaredDistance as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as a,create as u}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as c}from"../../../../geometry/support/frustum.js";import{clipPolygon as m}from"../../../../geometry/support/plane.js";import{normalFromValues as f,closestPointFromValues as p}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as d}from"./intersectionConstants.js";import{screenPolygonIntersectsTriangle as h}from"./screenPolygonOverlapUtils.js";class I{constructor(t){this.primitiveIndex=t}}class g{constructor(t){this.type=t,this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=l(),this.normal=l()}reset(){this.distance=Number.POSITIVE_INFINITY,this.hasNormal=!1}update(t,e,r,i){this.distance=t,this.primitiveIndex=e,o(this.point,r),this.hasNormal=null!=i,null!=i&&o(this.normal,i)}updateIfCloserFromValues(t,e,r,o){t<this.distance&&this.update(t,e,r,o)}updateIfCloser(t){const{distance:e,primitiveIndex:r,point:o,normal:i}=t;this.updateIfCloserFromValues(e,r,o,t.hasNormal?i:null)}get valid(){return Number.isFinite(this.distance)}}function y(t,e,r,o,i){if(!t.visible||0!==t.type)return null;const n=new g(4);let s;s=t.boundingInfo?b(t.readPrimitivePosition,t.boundingInfo,e,r,o,i):v(e,r,o,0,t.faceCount,t.readPrimitivePosition,i,null,0);for(const l of s)n.updateIfCloser(l);return n.valid?n:null}function*v(t,e,o,i,n,s,l,a=null,u=0){if(null==t.camera)return;const{camera:c,screenPolygonPrimitiveProcessor:p}=t;for(let d=i;d<n;++d){const t=(a?.[d]??d)+u,i=null==a?t:d,n=3*t;N(F[0],s,n+0,l,i,e),N(F[1],s,n+1,l,i,e),N(F[2],s,n+2,l,i,e);const h=O;let I;A.reset();const g=C;for(const e of p.processTriangle(F))if(g.length=0,m(c.frustum[4],e,()=>g.pushNew(),!1),!(g.length<3)){for(let t=0;t<g.length;t++)c.projectToScreen(g.at(t),V[t]);P(o,V,g.length)&&(j(c.eye,g,w),null==I&&(I=f(O,F[0],F[1],F[2])),A.updateIfCloserFromValues(r(c.eye,w),t,w,I?h:null))}A.valid&&(yield A)}}function*b(t,e,r,o,i,n){let s;if(null!=n?(a(x,e.box),n.applyToAabb(x),s=c(i.broadPhaseFrustum,x,o)):s=c(i.broadPhaseFrustum,e.box,o),!s)return;const{primitiveIndices:l}=e,u=l.length;if(u>d){const s=e.children;if(void 0!==s){for(const e of s)yield*b(t,e,r,o,i,n);return}}yield*v(r,o,i,0,u,t,n,l,0)}function N(t,e,r,o,s,l){const[a,u,c]=e(t,r);null!=o?o.applyToVertex(t,a,u,c,s):i(t,a,u,c),l&&n(t,t,l)}function P(t,e,r){for(let o=1;o<r-1;o++)if(h(t,e[0],e[o],e[o+1]))return!0;return!1}function j(t,e,r){let i=Number.POSITIVE_INFINITY;const n=e.at(0);for(let l=1;l<e.length-1;l++){p(S,t,n,e.at(l),e.at(l+1));const a=s(t,S);a<i&&(i=a,o(r,S))}}const x=u(),T=12,F=[l(),l(),l()],C=new t({allocator:t=>t??l()}),V=Array.from({length:T},()=>e()),w=l(),O=l(),S=l(),A=new g(4);export{I as DrapedHit,g as Hit,v as forEachTriangleRangeScreenPolygonHit,y as intersectTriangleGeometryScreenPolygon};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{BufferViewUint32 as t,BufferViewVec3f as e,BufferViewVec2Snorm16 as i,BufferViewSnorm16 as r,BufferViewFloat16 as s,BufferViewFloat as o,BufferViewVec2f as a,BufferViewVec4Unorm8 as n,BufferViewUnorm8 as h}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as c}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as u,is3DGeometry as f,isColor as p}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as l}from"../effects/geometry/olidUtils.js";import g from"../lib/GLMaterial.js";import{
|
|
2
|
+
import{BufferViewUint32 as t,BufferViewVec3f as e,BufferViewVec2Snorm16 as i,BufferViewSnorm16 as r,BufferViewFloat16 as s,BufferViewFloat as o,BufferViewVec2f as a,BufferViewVec4Unorm8 as n,BufferViewUnorm8 as h}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as c}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as u,is3DGeometry as f,isColor as p}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as l}from"../effects/geometry/olidUtils.js";import g from"../lib/GLMaterial.js";import{offsetPathVertexInfoFrameIndex as m}from"../lib/PathVertexInfo.js";import{intersectTriangleGeometry as d}from"../lib/RayIntersections.js";import{intersectTriangleGeometryScreenPolygon as b}from"../lib/screenPolygonTriangleIntersections.js";import{assert as y}from"../lib/Util.js";import{applyPolygonOffsetToHit as _}from"./intersectWithPolygonOffset.js";import{getLayout as S,getTextureLayout as F}from"./PathLayouts.js";import{PathPassParameters as w,PathTechnique as P}from"./PathTechnique.js";import{PathTechniqueConfiguration as V}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as x}from"./TriangleMaterial.js";import{writeAttributes as C,writePosition as j,writeBufferVec2 as z,writeBufferInt16 as O,writeBufferFloat16 as B,writeBufferFloat as R,writeColor as T,writeBufferUint8 as A,writeOlidColor as v}from"./internal/bufferWriterUtils.js";import{hasShadowHighlights as I}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as M}from"../../../../webscene/support/AlphaCutoff.js";class U extends x{constructor(t,e){super(t,D),this.supportsEdges=!0,this.produces=new Map([[2,t=>(this.parameters.castShadows&&u(t)||f(t))&&!this.transparent],[4,t=>(this.parameters.castShadows&&u(t)||f(t))&&this.transparent]]),this._configuration=new V(e.spherical)}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(t){super.updateConfiguration(t),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?0:this.parameters.cullFace,this._configuration.offsetBackfaces=this.transparent,p(t.output)?(this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.hasShadowHighlights=I(this._configuration,t),this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.snowCover=t.snowCover>0,this._configuration.upVectorAlignment=this.parameters.upVectorAlignment,this._configuration.pathCapType=this.parameters.pathCapType,this._configuration.pathProfileType=this.parameters.profile.type,this._configuration.hasPathSize=this.parameters.hasPathSize,this._configuration.hasPathColor=this.parameters.hasPathColor,this._configuration.hasPathOpacity=this.parameters.hasPathOpacity}isVisibleForOutput(t){return 5!==t&&7!==t&&6!==t||this.parameters.castShadows}get visible(){return this.parameters.opacity>=M}intersectRay(t,e,i,r,s,o){d(t,i,r,s,null,o)}intersectRayDraped(){}intersectScreenPolygonDraped(){return null}intersectScreenPolygon(t,e,i,r){return _(b(t,i,e,r,null),this._configuration,i.camera.eye)}createBufferWriter(){return new q(S(),F(this.parameters))}createGLMaterial(t){return new L(t)}get transparent(){const{parameters:t}=this;return t.drivenOpacity||t.opacity<1}}class L extends g{beginSlot(t){return this.getTechnique(P,t)}}class D extends w{constructor(){super(...arguments),this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1,this.upVectorAlignment=0,this.pathCapType=1,this.cullFace=2}}class q{constructor(t,e){this.layout=t,this.textureBufferLayout=e,this.maxTextureBufferItemIndex=c}elementCount(t){return t.get("pathVertexInfo")?.indices.length??0}elementCountTextureBuffer(t){return t.get("position")?.indices.length??0}write(t,e,i,r,s,o,a){null!=s&&this._writeVertexBuffer(t,e,i,s,o),null!=a&&this._writeTextureBuffer(t,i,r,a)}_writeVertexBuffer(e,i,r,s,o){C(r,null,this.layout,e,i,s);const a=o?.from??0,n=s.buffer.getField("pathVertexInfo",t),h=r.get("pathVertexInfo");if(n&&h){y(1===h.size);const{data:t,stride:e,indices:i}=h;for(let r=0;r<i.length;++r){const o=t[e*i[r]];n.set(s.offset+r,m(o,a))}}}_writeTextureBuffer(t,c,u,f){const p=f.offset,g=f.buffer.getField("position",e),m=c.get("position");g&&m&&(y(3===m.size),j(m,t,g,p));const d=f.buffer.getField("profileRight",i),b=c.get("profileRight");d&&b&&(y(2===b.size),z(b,d,p));const _=f.buffer.getField("profileUp",i),S=c.get("profileUp");_&&S&&(y(2===S.size),z(S,_,p));const F=f.buffer.getField("profileRotation",r),w=c.get("profileRotation");F&&w&&(y(1===w.size),O(w,F,p));const P=f.buffer.getField("pathRotationUp",i),V=c.get("pathRotationUp");P&&V&&(y(2===V.size),z(V,P,p));const x=f.buffer.getField("pathMaxStretchDistance",s),C=c.get("pathMaxStretchDistance");x&&C&&(y(1===C.size),B(C,x,p));const I=f.buffer.getField("sizeFeatureAttribute",o),M=c.get("sizeFeatureAttribute");I&&M&&R(M,I,p);const U=f.buffer.getField("size",a),L=c.get("size");U&&L&&(y(2===L.size),z(L,U,p));const D=f.buffer.getField("colorFeatureAttribute",o),q=c.get("colorFeatureAttribute");D&&q&&R(q,D,p);const G=f.buffer.getField("color",n),W=c.get("color");G&&W&&T(W,4,G,p);const H=f.buffer.getField("opacityFeatureAttribute",o),k=c.get("opacityFeatureAttribute");H&&k&&R(k,H,p);const E=f.buffer.getField("opacity",h),J=c.get("opacity");if(E&&J&&(y(1===J.size),A(J,E,p)),l()){const t=f.buffer.getField("olidColor",n),e=m?.indices.length??0;u&&t&&e&&v(u,t,e,p)}}}export{D as Parameters,q as PathBufferWriter,U as PathMaterial};
|
package/views/View2D.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ import type LayerView from "./layers/LayerView.js";
|
|
|
16
16
|
import type ColorBackground from "../webmap/background/ColorBackground.js";
|
|
17
17
|
import type { ViewpointProperties } from "../Viewpoint.js";
|
|
18
18
|
import type { ReadonlyArrayOrCollection } from "../core/Collection.js";
|
|
19
|
-
import type { ScreenPoint, ScreenRect } from "../core/types.js";
|
|
19
|
+
import type { ScreenPoint, ScreenPolygon, ScreenRect } from "../core/types.js";
|
|
20
20
|
import type { ExtentProperties } from "../geometry/Extent.js";
|
|
21
21
|
import type { SpatialReferenceProperties } from "../geometry/SpatialReference.js";
|
|
22
22
|
import type { TimeZone } from "../time/types.js";
|
|
@@ -958,7 +958,7 @@ export default abstract class View2D extends View2DSuperclass {
|
|
|
958
958
|
* }
|
|
959
959
|
* });
|
|
960
960
|
*/
|
|
961
|
-
hitTest(hitTarget: ScreenPoint | ScreenRect | MouseEvent, options?: HitTestOptions): Promise<ViewHitTestResult>;
|
|
961
|
+
hitTest(hitTarget: ScreenPoint | ScreenRect | ScreenPolygon | MouseEvent, options?: HitTestOptions): Promise<ViewHitTestResult>;
|
|
962
962
|
/**
|
|
963
963
|
* Converts the given screen point to a [map point](https://developers.arcgis.com/javascript/latest/references/core/geometry/Point/).
|
|
964
964
|
* The screen point represents a point in terms
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{makeHandle as t}from"../../../../core/handleUtils.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import s from"../../../../geometry/Polygon.js";import{toExtent as i}from"../../../../geometry/support/aaBoundingRect.js";import{TileKey as n}from"../../../../layers/support/TileKey.js";import{TileTreeDebugger as l}from"../../../support/TileTreeDebugger.js";let a=class extends l{constructor(e){super(e)}initialize(){const e=setInterval(()=>this._fetchDebugInfo(),2e3);this.addHandles(t(()=>clearInterval(e)))}getTiles(){if(!this._debugInfo)return[];const e=new Map,t=new Map;this._debugInfo.storedTiles.forEach(t=>e.set(n.fromJSON(t.key).id,t.featureCount)),this._debugInfo.pendingTiles.forEach(r=>{e.set(r.key.id,r.featureCount),t.set(r.key.id,r.state)});const r=r=>{const o=t.get(r),s=e.get(r)??"?";return o?`${o}:${s}\n${r}`:`store:${s}\n${r}`},o=new Map;return this._debugInfo.storedTiles.forEach(e=>{const t=n.fromJSON(e.key);o.set(t.id,t)}),this._debugInfo.pendingTiles.forEach(e=>{o.set(e.key.id,e.key)}),
|
|
2
|
+
import{__decorate as e}from"tslib";import{makeHandle as t}from"../../../../core/handleUtils.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import s from"../../../../geometry/Polygon.js";import{toExtent as i}from"../../../../geometry/support/aaBoundingRect.js";import{TileKey as n}from"../../../../layers/support/TileKey.js";import{TileTreeDebugger as l}from"../../../support/TileTreeDebugger.js";let a=class extends l{constructor(e){super(e)}initialize(){const e=setInterval(()=>this._fetchDebugInfo(),2e3);this.addHandles(t(()=>clearInterval(e)))}getTiles(){if(!this._debugInfo)return[];const e=new Map,t=new Map;this._debugInfo.storedTiles.forEach(t=>e.set(n.fromJSON(t.key).id,t.featureCount)),this._debugInfo.pendingTiles.forEach(r=>{e.set(r.key.id,r.featureCount),t.set(r.key.id,r.state)});const r=r=>{const o=t.get(r),s=e.get(r)??"?";return o?`${o}:${s}\n${r}`:`store:${s}\n${r}`},o=new Map;return this._debugInfo.storedTiles.forEach(e=>{const t=n.fromJSON(e.key);o.set(t.id,t)}),this._debugInfo.pendingTiles.forEach(e=>{o.set(e.key.id,e.key)}),o.values().map(e=>({lij:[e.level,e.row,e.col],level:e.level,geometry:s.fromExtent(i(e.extent,this.view.spatialReference)),label:r(e.id)})).toArray()}_fetchDebugInfo(){this.handle.getDebugInfo(null).then(e=>{this._debugInfo=e,this.update()})}};e([r({constructOnly:!0})],a.prototype,"handle",void 0),a=e([o("esri.views.interactive.snapping.featureSources.WorkerTileTreeDebugger")],a);export{a as WorkerTileTreeDebugger};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Logger.js";import{disposeMaybe as t}from"../../core/maybe.js";import{BufferObject as r}from"./BufferObject.js";import{webglDebugEnabled as i}from"./checkWebGLError.js";import{ResourceType as s,ColorAttachment0 as n,PixelType as h,StencilAttachment as o,SizedDepthStencilFormat as c,DepthStencilAttachment as a,SizedDepthFormat as l,DepthAttachment as f}from"./enums.js";import{Renderbuffer as u}from"./Renderbuffer.js";import _ from"./Texture.js";const m=()=>e.getLogger("esri.views.webgl.FramebufferObject");class d{constructor(e,t,r){if(this._context=e,this._level=0,this._glName=null,this._colorAttachments=new Map,this._depthStencilBuffer=null,this._depthStencilTexture=null,e.instanceCounter.increment(s.FramebufferObject,this),null!=t){const r=N(e,t);null!=r&&(this._colorAttachments.set(n,r),T(r)?this._validateTextureDescriptor(r.descriptor):this._validateRenderbufferDescriptor(r.descriptor)),this._validateColorAttachmentPoint(n)}if(null!=r)if(x(r))this._depthStencilTexture=T(r)?r:new _(e,r),this._validateTextureDescriptor(this._depthStencilTexture.descriptor);else{const t=g(r)?r:new u(e,r);this._depthStencilBuffer=t,this._validateRenderbufferDescriptor(t.descriptor)}}get glName(){return this._glName}get colorTexture(){const e=this._colorAttachments.get(n);return T(e)?e:null}get depthStencil(){return this._depthStencilTexture||this._depthStencilBuffer}get depthStencilTexture(){return this._depthStencilTexture}get width(){const e=this._colorAttachments.get(n)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.width??0}get height(){const e=this._colorAttachments.get(n)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.height??0}get usedMemory(){return[...this._colorAttachments].reduce((e,[t,r])=>e+r.usedMemory,this.depthStencil?.usedMemory??0)}get level(){return this._level}set level(e){this._level!==e&&(this._level=e,this._glName&&this._context.temporaryBindFramebuffer(this,()=>this._initializeAttachments()))}static{this._MAX_COLOR_ATTACHMENTS=-1}getColorTexture(e){const t=this._colorAttachments.get(e);return t&&T(t)?t:null}get colorAttachments(){return Array.from(this._colorAttachments.keys())}attachColorTexture(e,t=n){if(!e)return;this._validateColorAttachmentPoint(t);const{descriptor:r}=e;this._validateTextureDescriptor(r),this.detachColorTexture(t)?.dispose(),this._colorAttachments.set(t,e),this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,t))}detachColorTexture(e=n){const t=this._colorAttachments.get(e);if(!t)return;const r=T(t);return this._glName&&this._context.temporaryBindFramebuffer(this,()=>{if(r)this._framebufferTexture2D(null,e);else{const t=this._context.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)}}),this._colorAttachments.delete(e),r?t:void 0}detachColorTextures(...e){if(0!==e.length){if(this._glName){const t=this._context.gl;this._context.temporaryBindFramebuffer(this,()=>{e.forEach(e=>{T(this._colorAttachments.get(e))?this._framebufferTexture2D(null,e):t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)})})}e.forEach(e=>this._colorAttachments.delete(e))}}setColorTextureTarget(e,t=n,r=0){const i=this._colorAttachments.get(t);i&&(35866===e?this._framebufferTextureLayer(i.glName,t,36160,r):this._framebufferTexture2D(i.glName,t,e,36160))}attachDepthStencil(e){if(e)switch(e.type){case 1:return this._attachDepthStencilTexture(e);case 2:return this._attachDepthStencilBuffer(e)}}_attachDepthStencilTexture(e){if(null==e)return;const{descriptor:t}=e,{pixelFormat:r,dataType:i}=t;34041===r||6402===r?34041!==r||i===h.UNSIGNED_INT_24_8?6402!==r||i===h.UNSIGNED_INT||i===h.UNSIGNED_SHORT?(this._validateTextureDescriptor(t),this._disposeDepthStencilAttachments(),this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,D(r))),this._depthStencilTexture?.dispose(),this._depthStencilTexture=e):console.error("Depth texture must have data type of UNSIGNED_INT or UNSIGNED_SHORT!"):console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"):console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!")}detachDepthStencilTexture(){const e=this._depthStencilTexture;return e&&this._glName&&this._context.temporaryBindFramebuffer(this,()=>{this._framebufferTexture2D(null,D(e.descriptor.pixelFormat))}),this._depthStencilTexture=null,e}_attachDepthStencilBuffer(e){if(null==e)return;const t=e.descriptor;if(this._validateRenderbufferDescriptor(t),this._disposeDepthStencilAttachments(),this._glName){this._context.bindFramebuffer(this);const{gl:r}=this._context,i=this._getGLAttachmentPoint(t);r.framebufferRenderbuffer(36160,i,r.RENDERBUFFER,e.glName)}this._depthStencilBuffer=e}detachDepthStencilBuffer(){const e=this._depthStencilBuffer;if(e&&this._glName){const{_context:t}=this,r=t.boundFramebuffer;t.bindFramebuffer(this);const{gl:i}=t,s=this._getGLAttachmentPoint(e.descriptor);i.framebufferRenderbuffer(36160,s,i.RENDERBUFFER,null),t.bindFramebuffer(r)}return this._depthStencilBuffer=null,e}invalidateAttachments(e){const{_context:t}=this;t.temporaryBindFramebuffer(this,()=>t.gl.invalidateFramebuffer(36160,e),!0)}copyToTexture(e,t,r,i,s,n,h){(e<0||t<0||s<0||n<0)&&console.error("Offsets cannot be negative!"),(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!");const o=h.descriptor;3553!==h.descriptor.target&&console.error("Texture target must be TEXTURE_2D!"),(null==o?.width||null==o?.height||e+r>this.width||t+i>this.height||s+r>o.width||n+i>o.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const c=this._context,a=c.bindTexture(h,_.TEXTURE_UNIT_FOR_UPDATES);c.setActiveTexture(_.TEXTURE_UNIT_FOR_UPDATES),c.bindFramebuffer(this),c.gl.copyTexSubImage2D(3553,0,s,n,e,t,r,i),c.bindTexture(a,_.TEXTURE_UNIT_FOR_UPDATES)}readPixels(e,t,r,i,s,n,h){(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!"),h||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(e,t,r,i,s,n,h)}async readPixelsAsync(e,t,i,s,n,h,o,c){const{gl:a}=this._context,l=r.createPixelPack(this._context,35041,o.byteLength);this._context.bindBuffer(l);const f=this._context.boundFramebuffer;this._context.bindFramebuffer(this),a.readPixels(e,t,i,s,n,h,0),this._context.unbindBuffer(35051),this._context.bindFramebuffer(f);try{await l.getSubDataAsync(o,void 0,void 0,void 0,c)}finally{l.dispose()}}resize(e,t){if(this.width===e&&this.height===t)return;const r={width:e,height:t};if(F(r,this._context.parameters.maxTextureSize),this._colorAttachments.forEach(e=>e.resize(r.width,r.height)),this._depthStencilTexture?.resize(r.width,r.height),this._glName&&(F(r,this._context.parameters.maxRenderbufferSize),this._depthStencilBuffer?.resize(r.width,r.height),i())){const{gl:e}=this._context;e.checkFramebufferStatus(36160)!==e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}}initializeAndBind(e=36160){const{gl:t}=this._context;this._glName?t.bindFramebuffer(e,this._glName):(this._glName&&t.deleteFramebuffer(this._glName),this._glName=t.createFramebuffer(),t.bindFramebuffer(e,this._glName),this._initializeAttachments(e))}_initializeAttachments(e=36160){const{gl:t}=this._context;if(this._colorAttachments.forEach((t,r)=>{if(T(t)){const i=A(t);35866===i?this._framebufferTextureLayer(t.glName,r,e):this._framebufferTexture2D(t.glName,r,i,e)}else if(g(t)){const i=this._context.gl;i.framebufferRenderbuffer(e,r,i.RENDERBUFFER,t.glName)}}),this._depthStencilBuffer){const r=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);t.framebufferRenderbuffer(e,r,t.RENDERBUFFER,this._depthStencilBuffer.glName)}else if(this._depthStencilTexture){const t=D(this._depthStencilTexture.descriptor.pixelFormat);this._framebufferTexture2D(this._depthStencilTexture.glName,t,A(this._depthStencilTexture),e)}if(i()){t.checkFramebufferStatus(e)!==t.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}}_framebufferTexture2D(e,t=n,r=3553,i=36160){this._context.gl.framebufferTexture2D(i,t,r,e,this._level)}_framebufferTextureLayer(e,t=n,r=36160,i=0){this._context.gl.framebufferTextureLayer(r,t,e,this._level,i)}_disposeDepthStencilAttachments(){const e=this._context.gl;if(this._depthStencilBuffer){if(this._glName){this._context.bindFramebuffer(this);const t=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);e.framebufferRenderbuffer(36160,t,e.RENDERBUFFER,null)}this._depthStencilBuffer=t(this._depthStencilBuffer)}this._depthStencilTexture&&(this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,D(this._depthStencilTexture.descriptor.pixelFormat))),this._depthStencilTexture=t(this._depthStencilTexture))}_validateTextureDescriptor(e){3553!==e.target&&34067!==e.target&&35866!==e.target&&console.error("Texture type must be TEXTURE_2D, TEXTURE_2D_ARRAY or TEXTURE_CUBE_MAP!"),F(e,this._context.parameters.maxTextureSize),this._validateBufferDimensions(e)}_validateRenderbufferDescriptor(e){F(e,this._context.parameters.maxRenderbufferSize),this._validateBufferDimensions(e)}_validateBufferDimensions(e){e.width<=0&&(e.width=this.width),e.height<=0&&(e.height=this.height),this.width>0&&this.height>0&&(this.width===e.width&&this.height===e.height||console.error("Attachment size must match framebuffer size!"))}_getGLAttachmentPoint(e){switch(e.internalFormat){case l.DEPTH_COMPONENT16:case l.DEPTH_COMPONENT24:case l.DEPTH_COMPONENT32F:return f;case c.DEPTH24_STENCIL8:case c.DEPTH32F_STENCIL8:return a;case 36168:return o;default:return n}}_validateColorAttachmentPoint(t){if(-1===d._MAX_COLOR_ATTACHMENTS){const{gl:e}=this._context;d._MAX_COLOR_ATTACHMENTS=e.getParameter(e.MAX_COLOR_ATTACHMENTS)}const r=t-n;r+1>d._MAX_COLOR_ATTACHMENTS&&e.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${r+1}. Implementation supports up to ${d._MAX_COLOR_ATTACHMENTS} color attachments`)}}class p extends d{constructor(e,t,r){super(e,t,r)}dispose(){const{_colorAttachments:e,_glName:t,_context:r}=this;if(r.instanceCounter.decrement(s.FramebufferObject,this),0===e.size&&!this._depthStencilBuffer&&!this._depthStencilTexture&&!t)return;const i=r.boundFramebuffer,n=Array.from(e.values());this.detachColorTextures(...e.keys()),n.forEach(e=>e.dispose()),this.detachDepthStencilBuffer()?.dispose(),this.detachDepthStencilTexture()?.dispose(),r.gl.deleteFramebuffer(this._glName),this._glName=null,r.bindFramebuffer(i===this?null:i)}}function T(e){return 1===E(e)}function g(e){return 2===E(e)}function x(e){return T(e)||b(e)}function b(e){return 0===E(e)}function S(e){return 3===E(e)||null!=e&&"samples"in e}function E(e){return null!=e&&"type"in e?e.type:null}function N(e,t){return T(t)||g(t)?t:b(t)?new _(e,t):S(t)?new u(e,t):null}function F(e,t){const r=Math.max(e.width,e.height);if(r>t){m().warnOnce(`Resizing FBO attachment size ${e.width}x${e.height} to device limit ${t}`);const i=t/r;return e.width=Math.round(e.width*i),e.height=Math.round(e.height*i),!1}return!0}function A(e){return 34067===e.descriptor.target?34069:35866===e.descriptor.target?35866:3553}function D(e){return 6402===e?f:a}export{p as DisposableFramebufferObject,d as FramebufferObject,F as ensureAttachmentMaxSize};
|
|
2
|
+
import e from"../../core/Logger.js";import{disposeMaybe as t}from"../../core/maybe.js";import{BufferObject as r}from"./BufferObject.js";import{webglDebugEnabled as i}from"./checkWebGLError.js";import{ResourceType as s,ColorAttachment0 as n,PixelType as h,StencilAttachment as o,SizedDepthStencilFormat as c,DepthStencilAttachment as a,SizedDepthFormat as l,DepthAttachment as f}from"./enums.js";import{Renderbuffer as u}from"./Renderbuffer.js";import _ from"./Texture.js";const m=()=>e.getLogger("esri.views.webgl.FramebufferObject");class d{constructor(e,t,r){if(this._context=e,this._level=0,this._glName=null,this._colorAttachments=new Map,this._depthStencilBuffer=null,this._depthStencilTexture=null,e.instanceCounter.increment(s.FramebufferObject,this),null!=t){const r=N(e,t);null!=r&&(this._colorAttachments.set(n,r),T(r)?this._validateTextureDescriptor(r.descriptor):this._validateRenderbufferDescriptor(r.descriptor)),this._validateColorAttachmentPoint(n)}if(null!=r)if(x(r))this._depthStencilTexture=T(r)?r:new _(e,r),this._validateTextureDescriptor(this._depthStencilTexture.descriptor);else{const t=g(r)?r:new u(e,r);this._depthStencilBuffer=t,this._validateRenderbufferDescriptor(t.descriptor)}}get glName(){return this._glName}get colorTexture(){const e=this._colorAttachments.get(n);return T(e)?e:null}get depthStencil(){return this._depthStencilTexture||this._depthStencilBuffer}get depthStencilTexture(){return this._depthStencilTexture}get width(){const e=this._colorAttachments.get(n)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.width??0}get height(){const e=this._colorAttachments.get(n)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.height??0}get usedMemory(){return this._colorAttachments.values().reduce((e,t)=>e+t.usedMemory,this.depthStencil?.usedMemory??0)}get level(){return this._level}set level(e){this._level!==e&&(this._level=e,this._glName&&this._context.temporaryBindFramebuffer(this,()=>this._initializeAttachments()))}static{this._MAX_COLOR_ATTACHMENTS=-1}getColorTexture(e){const t=this._colorAttachments.get(e);return t&&T(t)?t:null}get colorAttachments(){return Array.from(this._colorAttachments.keys())}attachColorTexture(e,t=n){if(!e)return;this._validateColorAttachmentPoint(t);const{descriptor:r}=e;this._validateTextureDescriptor(r),this.detachColorTexture(t)?.dispose(),this._colorAttachments.set(t,e),this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,t))}detachColorTexture(e=n){const t=this._colorAttachments.get(e);if(!t)return;const r=T(t);return this._glName&&this._context.temporaryBindFramebuffer(this,()=>{if(r)this._framebufferTexture2D(null,e);else{const t=this._context.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)}}),this._colorAttachments.delete(e),r?t:void 0}detachColorTextures(...e){if(0!==e.length){if(this._glName){const t=this._context.gl;this._context.temporaryBindFramebuffer(this,()=>{e.forEach(e=>{T(this._colorAttachments.get(e))?this._framebufferTexture2D(null,e):t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)})})}e.forEach(e=>this._colorAttachments.delete(e))}}setColorTextureTarget(e,t=n,r=0){const i=this._colorAttachments.get(t);i&&(35866===e?this._framebufferTextureLayer(i.glName,t,36160,r):this._framebufferTexture2D(i.glName,t,e,36160))}attachDepthStencil(e){if(e)switch(e.type){case 1:return this._attachDepthStencilTexture(e);case 2:return this._attachDepthStencilBuffer(e)}}_attachDepthStencilTexture(e){if(null==e)return;const{descriptor:t}=e,{pixelFormat:r,dataType:i}=t;34041===r||6402===r?34041!==r||i===h.UNSIGNED_INT_24_8?6402!==r||i===h.UNSIGNED_INT||i===h.UNSIGNED_SHORT?(this._validateTextureDescriptor(t),this._disposeDepthStencilAttachments(),this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,D(r))),this._depthStencilTexture?.dispose(),this._depthStencilTexture=e):console.error("Depth texture must have data type of UNSIGNED_INT or UNSIGNED_SHORT!"):console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"):console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!")}detachDepthStencilTexture(){const e=this._depthStencilTexture;return e&&this._glName&&this._context.temporaryBindFramebuffer(this,()=>{this._framebufferTexture2D(null,D(e.descriptor.pixelFormat))}),this._depthStencilTexture=null,e}_attachDepthStencilBuffer(e){if(null==e)return;const t=e.descriptor;if(this._validateRenderbufferDescriptor(t),this._disposeDepthStencilAttachments(),this._glName){this._context.bindFramebuffer(this);const{gl:r}=this._context,i=this._getGLAttachmentPoint(t);r.framebufferRenderbuffer(36160,i,r.RENDERBUFFER,e.glName)}this._depthStencilBuffer=e}detachDepthStencilBuffer(){const e=this._depthStencilBuffer;if(e&&this._glName){const{_context:t}=this,r=t.boundFramebuffer;t.bindFramebuffer(this);const{gl:i}=t,s=this._getGLAttachmentPoint(e.descriptor);i.framebufferRenderbuffer(36160,s,i.RENDERBUFFER,null),t.bindFramebuffer(r)}return this._depthStencilBuffer=null,e}invalidateAttachments(e){const{_context:t}=this;t.temporaryBindFramebuffer(this,()=>t.gl.invalidateFramebuffer(36160,e),!0)}copyToTexture(e,t,r,i,s,n,h){(e<0||t<0||s<0||n<0)&&console.error("Offsets cannot be negative!"),(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!");const o=h.descriptor;3553!==h.descriptor.target&&console.error("Texture target must be TEXTURE_2D!"),(null==o?.width||null==o?.height||e+r>this.width||t+i>this.height||s+r>o.width||n+i>o.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const c=this._context,a=c.bindTexture(h,_.TEXTURE_UNIT_FOR_UPDATES);c.setActiveTexture(_.TEXTURE_UNIT_FOR_UPDATES),c.bindFramebuffer(this),c.gl.copyTexSubImage2D(3553,0,s,n,e,t,r,i),c.bindTexture(a,_.TEXTURE_UNIT_FOR_UPDATES)}readPixels(e,t,r,i,s,n,h){(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!"),h||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(e,t,r,i,s,n,h)}async readPixelsAsync(e,t,i,s,n,h,o,c){const{gl:a}=this._context,l=r.createPixelPack(this._context,35041,o.byteLength);this._context.bindBuffer(l);const f=this._context.boundFramebuffer;this._context.bindFramebuffer(this),a.readPixels(e,t,i,s,n,h,0),this._context.unbindBuffer(35051),this._context.bindFramebuffer(f);try{await l.getSubDataAsync(o,void 0,void 0,void 0,c)}finally{l.dispose()}}resize(e,t){if(this.width===e&&this.height===t)return;const r={width:e,height:t};if(F(r,this._context.parameters.maxTextureSize),this._colorAttachments.forEach(e=>e.resize(r.width,r.height)),this._depthStencilTexture?.resize(r.width,r.height),this._glName&&(F(r,this._context.parameters.maxRenderbufferSize),this._depthStencilBuffer?.resize(r.width,r.height),i())){const{gl:e}=this._context;e.checkFramebufferStatus(36160)!==e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}}initializeAndBind(e=36160){const{gl:t}=this._context;this._glName?t.bindFramebuffer(e,this._glName):(this._glName&&t.deleteFramebuffer(this._glName),this._glName=t.createFramebuffer(),t.bindFramebuffer(e,this._glName),this._initializeAttachments(e))}_initializeAttachments(e=36160){const{gl:t}=this._context;if(this._colorAttachments.forEach((t,r)=>{if(T(t)){const i=A(t);35866===i?this._framebufferTextureLayer(t.glName,r,e):this._framebufferTexture2D(t.glName,r,i,e)}else if(g(t)){const i=this._context.gl;i.framebufferRenderbuffer(e,r,i.RENDERBUFFER,t.glName)}}),this._depthStencilBuffer){const r=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);t.framebufferRenderbuffer(e,r,t.RENDERBUFFER,this._depthStencilBuffer.glName)}else if(this._depthStencilTexture){const t=D(this._depthStencilTexture.descriptor.pixelFormat);this._framebufferTexture2D(this._depthStencilTexture.glName,t,A(this._depthStencilTexture),e)}if(i()){t.checkFramebufferStatus(e)!==t.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}}_framebufferTexture2D(e,t=n,r=3553,i=36160){this._context.gl.framebufferTexture2D(i,t,r,e,this._level)}_framebufferTextureLayer(e,t=n,r=36160,i=0){this._context.gl.framebufferTextureLayer(r,t,e,this._level,i)}_disposeDepthStencilAttachments(){const e=this._context.gl;if(this._depthStencilBuffer){if(this._glName){this._context.bindFramebuffer(this);const t=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);e.framebufferRenderbuffer(36160,t,e.RENDERBUFFER,null)}this._depthStencilBuffer=t(this._depthStencilBuffer)}this._depthStencilTexture&&(this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,D(this._depthStencilTexture.descriptor.pixelFormat))),this._depthStencilTexture=t(this._depthStencilTexture))}_validateTextureDescriptor(e){3553!==e.target&&34067!==e.target&&35866!==e.target&&console.error("Texture type must be TEXTURE_2D, TEXTURE_2D_ARRAY or TEXTURE_CUBE_MAP!"),F(e,this._context.parameters.maxTextureSize),this._validateBufferDimensions(e)}_validateRenderbufferDescriptor(e){F(e,this._context.parameters.maxRenderbufferSize),this._validateBufferDimensions(e)}_validateBufferDimensions(e){e.width<=0&&(e.width=this.width),e.height<=0&&(e.height=this.height),this.width>0&&this.height>0&&(this.width===e.width&&this.height===e.height||console.error("Attachment size must match framebuffer size!"))}_getGLAttachmentPoint(e){switch(e.internalFormat){case l.DEPTH_COMPONENT16:case l.DEPTH_COMPONENT24:case l.DEPTH_COMPONENT32F:return f;case c.DEPTH24_STENCIL8:case c.DEPTH32F_STENCIL8:return a;case 36168:return o;default:return n}}_validateColorAttachmentPoint(t){if(-1===d._MAX_COLOR_ATTACHMENTS){const{gl:e}=this._context;d._MAX_COLOR_ATTACHMENTS=e.getParameter(e.MAX_COLOR_ATTACHMENTS)}const r=t-n;r+1>d._MAX_COLOR_ATTACHMENTS&&e.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${r+1}. Implementation supports up to ${d._MAX_COLOR_ATTACHMENTS} color attachments`)}}class p extends d{constructor(e,t,r){super(e,t,r)}dispose(){const{_colorAttachments:e,_glName:t,_context:r}=this;if(r.instanceCounter.decrement(s.FramebufferObject,this),0===e.size&&!this._depthStencilBuffer&&!this._depthStencilTexture&&!t)return;const i=r.boundFramebuffer,n=Array.from(e.values());this.detachColorTextures(...e.keys()),n.forEach(e=>e.dispose()),this.detachDepthStencilBuffer()?.dispose(),this.detachDepthStencilTexture()?.dispose(),r.gl.deleteFramebuffer(this._glName),this._glName=null,r.bindFramebuffer(i===this?null:i)}}function T(e){return 1===E(e)}function g(e){return 2===E(e)}function x(e){return T(e)||b(e)}function b(e){return 0===E(e)}function S(e){return 3===E(e)||null!=e&&"samples"in e}function E(e){return null!=e&&"type"in e?e.type:null}function N(e,t){return T(t)||g(t)?t:b(t)?new _(e,t):S(t)?new u(e,t):null}function F(e,t){const r=Math.max(e.width,e.height);if(r>t){m().warnOnce(`Resizing FBO attachment size ${e.width}x${e.height} to device limit ${t}`);const i=t/r;return e.width=Math.round(e.width*i),e.height=Math.round(e.height*i),!1}return!0}function A(e){return 34067===e.descriptor.target?34069:35866===e.descriptor.target?35866:3553}function D(e){return 6402===e?f:a}export{p as DisposableFramebufferObject,d as FramebufferObject,F as ensureAttachmentMaxSize};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import o from"../../../renderers/support/HeatmapColorStop.js";function r(r){if(!r.colorStops)return[];const e=
|
|
2
|
+
import o from"../../../renderers/support/HeatmapColorStop.js";function r(r){if(!r.colorStops)return[];const e=r.colorStops.filter(o=>o.color?.a>0);let t=e.length-1;if(e&&e[0]){const r=e[t];r&&1!==r.ratio&&(e.push(new o({ratio:1,color:r.color})),t++)}return e.map((o,e)=>{let l="";return 0===e?l=r.legendOptions?.minLabel||"low":e===t&&(l=r.legendOptions?.maxLabel||"high"),{color:o.color,label:l,ratio:o.ratio}}).reverse()}export{r as getHeatmapRampStops};
|
|
File without changes
|