@arcgis/core 4.34.0-next.3 → 4.34.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{b70f65ccee01d48a610e.js → 1bc4cb6366e733a7c7ef.js} +1 -1
- package/config.js +1 -1
- package/kernel.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/Bitmap.js +1 -1
- package/views/2d/engine/flow/styles/Imagery.js +1 -1
- package/views/2d/engine/vectorTiles/GlyphMosaic.js +1 -1
- package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
- package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
- package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushTileDebugInfo.js +1 -1
- package/views/2d/engine/webgl/effects/highlight/HighlightGradient.js +1 -1
- package/views/2d/engine/webgl/effects/post-processing/Colorize.js +1 -1
- package/views/2d/engine/webgl/effects/post-processing/DropShadow.js +1 -1
- package/views/2d/engine/webgl/effects/post-processing/Opacity.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/blend/BlendTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityResources.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/magnifier/MagnifierTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/textureUtils.js +1 -1
- package/views/3d/environment/LocalAtmosphere.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/support/engineContent/marker.js +1 -1
- package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/materials/stippleTextureRepository.js +1 -1
- package/views/support/imageReprojection.js +1 -1
- package/views/webgl/rasterUtils.js +1 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{AttributeDataType as i,dataDrivenUnit2 as s,dataDrivenUnit1 as r,dataDrivenUnit0 as a,visualVariableUnit as n,localTimeOriginUnit as u,gpgpuUnit as h,animationUnit as o,filterFlagsUnit as l}from"./definitions.js";import{getDisplayIdTexel as d}from"./DisplayId.js";import{getPixelArrayCtor as g,getPixelBytes as p}from"./Utils.js";import{TextureWrapMode as _,TextureSamplingMode as c}from"../../../webgl/enums.js";import{FramebufferObject as x}from"../../../webgl/FramebufferObject.js";import{Texture as f}from"../../../webgl/Texture.js";import{TextureDescriptor as b}from"../../../webgl/TextureDescriptor.js";const T=()=>e.getLogger("esri.views.2d.engine.webgl.AttributeStoreView");class m{constructor(t,e,i){this._texture=null,this._lastTexture=null,this._fbos={},this.texelSize=4;const{buffer:s,pixelType:r,textureOnly:a}=t,n=g(r);this.blockIndex=i,this.pixelType=r,this.size=e,this.textureOnly=a,a||(this.data=new n(s)),this._resetRange()}destroy(){this._texture?.dispose();for(const t in this._fbos){const e=this._fbos[t];e&&("0"===t&&e.detachColorTexture(),e.dispose()),this._fbos[t]=null}this._texture=null}get _textureDesc(){const t=new b;return t.wrapMode=_.CLAMP_TO_EDGE,t.samplingMode=c.NEAREST,t.dataType=this.pixelType,t
|
|
5
|
+
import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{AttributeDataType as i,dataDrivenUnit2 as s,dataDrivenUnit1 as r,dataDrivenUnit0 as a,visualVariableUnit as n,localTimeOriginUnit as u,gpgpuUnit as h,animationUnit as o,filterFlagsUnit as l}from"./definitions.js";import{getDisplayIdTexel as d}from"./DisplayId.js";import{getPixelArrayCtor as g,getPixelBytes as p}from"./Utils.js";import{TextureWrapMode as _,TextureSamplingMode as c}from"../../../webgl/enums.js";import{FramebufferObject as x}from"../../../webgl/FramebufferObject.js";import{Texture as f}from"../../../webgl/Texture.js";import{TextureDescriptor as b}from"../../../webgl/TextureDescriptor.js";const T=()=>e.getLogger("esri.views.2d.engine.webgl.AttributeStoreView");class m{constructor(t,e,i){this._texture=null,this._lastTexture=null,this._fbos={},this.texelSize=4;const{buffer:s,pixelType:r,textureOnly:a}=t,n=g(r);this.blockIndex=i,this.pixelType=r,this.size=e,this.textureOnly=a,a||(this.data=new n(s)),this._resetRange()}destroy(){this._texture?.dispose();for(const t in this._fbos){const e=this._fbos[t];e&&("0"===t&&e.detachColorTexture(),e.dispose()),this._fbos[t]=null}this._texture=null}get _textureDesc(){const t=new b(this.size);return t.wrapMode=_.CLAMP_TO_EDGE,t.samplingMode=c.NEAREST,t.dataType=this.pixelType,t}setData(t,e,i){const s=d(t),r=this.data,a=s*this.texelSize+e;!r||a>=r.length||(r[a]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s))}getData(t,e){if(null==this.data)return null;const i=d(t)*this.texelSize+e;return!this.data||i>=this.data.length?null:this.data[i]}getTexture(t){return this._texture??this._initTexture(t)}getFBO(t,e=0){if(!this._fbos[e]){const i=0===e?this.getTexture(t):this._textureDesc;this._fbos[e]=new x(t,i)}return this._fbos[e]}get hasDirty(){const t=this.dirtyStart;return this.dirtyEnd>=t}updateTexture(e,i){try{const s=this.dirtyStart,r=this.dirtyEnd;if(!this.hasDirty)return;has("esri-2d-update-debug")&&console.debug(`Version[${i}] AttributeStoreView.updateTexture`,{start:s,end:r,firstBytes:new Uint8Array(this.data.buffer.slice(0,16)),block:this}),this._resetRange();const a=this.data.buffer,n=this.getTexture(e),u=4,h=(s-s%this.size)/this.size,o=(r-r%this.size)/this.size,l=h,d=this.size,p=o,_=h*this.size*u,c=(d+p*this.size)*u-_,x=g(this.pixelType),f=new x(a,_*x.BYTES_PER_ELEMENT,c),b=this.size,m=p-l+1;if(m>this.size)return void T().error(new t("mapview-webgl","Out-of-bounds index when updating AttributeData"));n.updateData(0,0,l,b,m,f)}catch(s){}}update(t){const{data:e,start:i,end:s}=t;if(null!=e&&null!=this.data){const s=this.data,r=i*this.texelSize;for(let i=0;i<e.length;i++){const a=1<<i%this.texelSize;t.layout&a&&(s[r+i]=e[i])}}this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,s)}resize(t,e){const i=this.size;if(this.size=e,this.textureOnly)return void(i!==this.size&&(this._lastTexture=this._texture,this._texture=null));const s=g(this.pixelType);this.destroy(),this.data=new s(t.buffer)}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}_initTexture(t){const e=new f(t,this._textureDesc,this.data??void 0);if(null!=this._lastTexture&&this._fbos[0]){const i=this._lastTexture.descriptor.width,s=this._lastTexture.descriptor.height,r=this._lastTexture.descriptor.dataType,a=this._lastTexture.descriptor.pixelFormat,n=this.getFBO(t),u=p(r),h=new(g(r))(new ArrayBuffer(i*s*u*this.texelSize)),o=t.getBoundFramebufferObject(),{x:l,y:d,width:_,height:c}=t.getViewport();t.bindFramebuffer(n),n.readPixels(0,0,i,s,a,r,h),e.updateData(0,0,0,2*i,s/2,h),t.setViewport(l,d,_,c),t.bindFramebuffer(o)}return this.destroy(),this._texture=e,this._texture}}class y{constructor(){this.size=0,this._pendingAttributeUpdates=[],this._version=0,this._epoch=0,this._locked=!1}get locked(){return this._locked}_initialize(t){if(!t)throw new Error("InternalError: initArgs must be defined");const e=t.blockDescriptors;if(this.size=t.blockSize,has("esri-2d-update-debug")&&console.debug("AttributeStoreView.initialize",{message:t}),null==this._data)this._data=e.map(((t,e)=>null!=t?new m(t,this.size,e):null));else for(let i=0;i<this._data.length;i++){const t=this._data[i],s=e[i];null!=s&&(null==t?this._data[i]=new m(s,this.size,i):t.resize(s,this.size))}}destroy(){for(const t of this._data??[])t?.destroy();this._defaultTexture?.dispose(),this._defaultTexture=null,this._pendingAttributeUpdates=[]}isEmpty(){return null==this._data}getBlock(t){if(null==this._data)return null;return this._data[t]}setLabelMinZoom(t,e){this.setData(t,i.FilterFlags,1,e)}setLocalTimeOrigin(t,e){this.setData(t,i.LocalTimeOrigin,0,e)}getLabelMinZoom(t){return this.getData(t,i.FilterFlags,1,255)}getFilterFlags(t){return this.getData(t,i.FilterFlags,0,0)}getVisualVariableData(t,e){return this.getData(t,i.VV,e,0)}getData(t,e,i,s){if(!this._data)return 0;const r=this._data[e];if(null==r)return 0;const a=r.getData(t,i);return null!=a?a:s}setData(t,e,i,s){this._data[e].setData(t,i,s)}lockTextureUploads(){this._locked=!0}unlockTextureUploads(){this._locked=!1,this.update()}requestUpdate(t){this._version=t.version,this._pendingAttributeUpdates.push(t),has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] AttributeStoreView.requestUpdate`,{message:t})}get currentEpoch(){return this._epoch}get hasPendingUpdates(){return this._pendingAttributeUpdates.length>0}update(){if(this._locked)return;const t=this._pendingAttributeUpdates;this._pendingAttributeUpdates=[];for(const e of t){const{blockData:t,initArgs:i,sendUpdateEpoch:s,version:r}=e;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] Epoch[${s}] AttributeStoreView.applyUpdate`),this._version=r,this._epoch=s,null!=i&&this._initialize(i);const a=this._data;for(let e=0;e<t.length;e++){const i=t[e],s=a[e];null!=s&&null!=i&&(has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] CpuBlock[${e}] AttributeStoreView.update`,{block:i}),s.update(i))}}}getUniforms(t){return{filterFlags:{texture:this._getTexture(t,i.FilterFlags),unit:l},animation:{texture:this._getTexture(t,i.Animation),unit:o},gpgpu:{texture:this._getTexture(t,i.GPGPU),unit:h},localTimeOrigin:{texture:this._getTexture(t,i.LocalTimeOrigin),unit:u},visualVariableData:{texture:this._getTexture(t,i.VV),unit:n},dataDriven0:{texture:this._getTexture(t,i.DD0),unit:a},dataDriven1:{texture:this._getTexture(t,i.DD1),unit:r},dataDriven2:{texture:this._getTexture(t,i.DD2),unit:s},size:this.size}}_getTexture(t,e){const i=this._data?.[e];return i?(i.updateTexture(t,this._version),i.getTexture(t)):this._getDefaultTexture(t)}_getDefaultTexture(t){if(null==this._defaultTexture){const e=new b(1);e.wrapMode=_.CLAMP_TO_EDGE,e.samplingMode=c.NEAREST,this._defaultTexture=new f(t,e,new Uint8Array(4))}return this._defaultTexture}}export{y as AttributeStoreView};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../core/has.js";import{throwIfNotAbortError as t}from"../../../../core/promiseUtils.js";import e from"./Rect.js";import i from"./RectangleBinPack.js";import{PixelFormat as h,TextureWrapMode as s}from"../../../webgl/enums.js";import{Texture as r}from"../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../webgl/TextureDescriptor.js";const n=256,o=t=>Math.floor(t/256);function c(t){const e=new Set;for(const i of t)e.add(o(i));return e}function l(e,i,h){return e.has(i)||e.set(i,h().then((()=>{e.delete(i)})).catch((h=>{e.delete(i),t(h)}))),e.get(i)}const g=t=>({rect:new e(0,0,0,0),page:0,metrics:{left:0,width:0,height:0,advance:0,top:0},code:t,sdf:!0});class p{constructor(t,e,h){this.width=0,this.height=0,this._dirties=[],this._glyphData=[],this._currentPage=0,this._glyphCache={},this._textures=[],this._rangePromises=new Map,this._preloadCache={},this.width=t,this.height=e,this._glyphSource=h,this._binPack=new i(t-4,e-4),this._glyphData.push(new Uint8Array(t*e)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs()}dispose(){this._binPack=null;for(const t of this._textures)t&&t.dispose();this._textures.length=0,this._glyphData.length=0}_initDecorationGlyphs(){const t=[117,149,181,207,207,181,149,117],e=[],i=[];for(let r=0;r<t.length;r++){const h=t[r];for(let t=0;t<11;t++){const s=r>=3&&r<5&&t>=3&&t<8?255:0;e.push(h),i.push(s)}}const h={metrics:{width:5,height:2,left:0,top:0,advance:0},bitmap:new Uint8Array(e)},s={metrics:{width:5,height:2,left:0,top:0,advance:0},bitmap:new Uint8Array(i)};this._recordGlyph(h),this._recordGlyph(s)}getTexture(t,e){if(!this._textures[e]){const i=new a;i.pixelFormat=h.ALPHA,i.wrapMode=s.CLAMP_TO_EDGE,
|
|
5
|
+
import has from"../../../../core/has.js";import{throwIfNotAbortError as t}from"../../../../core/promiseUtils.js";import e from"./Rect.js";import i from"./RectangleBinPack.js";import{PixelFormat as h,TextureWrapMode as s}from"../../../webgl/enums.js";import{Texture as r}from"../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../webgl/TextureDescriptor.js";const n=256,o=t=>Math.floor(t/256);function c(t){const e=new Set;for(const i of t)e.add(o(i));return e}function l(e,i,h){return e.has(i)||e.set(i,h().then((()=>{e.delete(i)})).catch((h=>{e.delete(i),t(h)}))),e.get(i)}const g=t=>({rect:new e(0,0,0,0),page:0,metrics:{left:0,width:0,height:0,advance:0,top:0},code:t,sdf:!0});class p{constructor(t,e,h){this.width=0,this.height=0,this._dirties=[],this._glyphData=[],this._currentPage=0,this._glyphCache={},this._textures=[],this._rangePromises=new Map,this._preloadCache={},this.width=t,this.height=e,this._glyphSource=h,this._binPack=new i(t-4,e-4),this._glyphData.push(new Uint8Array(t*e)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs()}dispose(){this._binPack=null;for(const t of this._textures)t&&t.dispose();this._textures.length=0,this._glyphData.length=0}_initDecorationGlyphs(){const t=[117,149,181,207,207,181,149,117],e=[],i=[];for(let r=0;r<t.length;r++){const h=t[r];for(let t=0;t<11;t++){const s=r>=3&&r<5&&t>=3&&t<8?255:0;e.push(h),i.push(s)}}const h={metrics:{width:5,height:2,left:0,top:0,advance:0},bitmap:new Uint8Array(e)},s={metrics:{width:5,height:2,left:0,top:0,advance:0},bitmap:new Uint8Array(i)};this._recordGlyph(h),this._recordGlyph(s)}getTexture(t,e){if(!this._textures[e]){const i=new a(this.width,this.height);i.pixelFormat=h.ALPHA,i.wrapMode=s.CLAMP_TO_EDGE,this._textures[e]=new r(t,i,new Uint8Array(this.width*this.height))}return this._dirties[e]&&(this._textures[e].setData(this._glyphData[e]),this._dirties[e]=!1),this._textures[e]}async getGlyphItems(t,e,i){const h=this._getGlyphCache(t);return await this._fetchRanges(t,e,i),e.map((e=>this._getMosaicItem(h,t,e)))}bind(t,e,i,h){const s=this.getTexture(t,i);s.setSamplingMode(e),t.bindTexture(s,h)}preloadASCIIGlyphCache(t){const e=this._preloadCache[t];if(null!=e)return e;const i=this._glyphSource.preloadASCIIRange(t).then((()=>{const e=this._getGlyphCache(t);for(let i=0;i<256;i++)this._getMosaicItem(e,t,i)}));return this._preloadCache[t]=i,i}_getGlyphCache(t){return this._glyphCache[t]||(this._glyphCache[t]={}),this._glyphCache[t]}_invalidate(){this._dirties[this._currentPage]=!0}async _fetchRanges(t,e,i){const h=c(e),s=[];h.forEach((e=>{s.push(this._fetchRange(t,e,i))})),await Promise.all(s)}async _fetchRange(t,e,i){if(e>n)return;const h=t+e;return l(this._rangePromises,h,(()=>this._glyphSource.getRange(t,e,i)))}_getMosaicItem(t,e,i){if(!t[i]){const h=this._glyphSource.getGlyph(e,i);if(!h?.metrics)return g(i);const s=this._recordGlyph(h),r=this._currentPage,a=h.metrics;t[i]={rect:s,page:r,metrics:a,code:i,sdf:!0},this._invalidate()}return t[i]}_recordGlyph(t){const h=t.metrics;let s;if(0===h.width)s=new e(0,0,0,0);else{const e=3,r=h.width+2*e,a=h.height+2*e;s=this._binPack.allocate(r,a),s.isEmpty&&(this._dirties[this._currentPage]||(this._glyphData[this._currentPage]=null),this._currentPage=this._glyphData.length,this._glyphData.push(new Uint8Array(this.width*this.height)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs(),this._binPack=new i(this.width-4,this.height-4),s=this._binPack.allocate(r,a));const n=this._glyphData[this._currentPage],o=t.bitmap;let c,l;if(o)for(let t=0;t<a;t++){c=r*t,l=this.width*(s.y+t)+s.x;for(let t=0;t<r;t++)n[l+t]=o[c+t]}has("esri-glyph-debug")&&this._showDebugPage(n)}return s}_showDebugPage(t){const e=document.createElement("canvas"),i=e.getContext("2d"),h=new ImageData(this.width,this.height),s=h.data;e.width=this.width,e.height=this.height,e.style.border="1px solid black";for(let r=0;r<t.length;++r)s[4*r]=t[r],s[4*r+1]=0,s[4*r+2]=0,s[4*r+3]=255;i.putImageData(h,0,0),document.body.appendChild(e)}}export{p as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import r from"../../../../core/Handles.js";import s from"../../../../core/Logger.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{getProjectiveTransform as n}from"../../../../core/perspectiveUtils.js";import{watch as o,when as a,initial as d}from"../../../../core/reactiveUtils.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isVideoElement as p}from"../../../../support/mediaLayerUtils.js";import{AnimatedSymbolRepeatType as u}from"../../../../symbols/cim/enums.js";import{DisplayObject as c}from"../DisplayObject.js";import{play as f}from"./animatedFormats/utils.js";import{TextureWrapMode as w}from"../../../webgl/enums.js";import{Texture as y}from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";const v=[1,1],
|
|
5
|
+
import e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import r from"../../../../core/Handles.js";import s from"../../../../core/Logger.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{getProjectiveTransform as n}from"../../../../core/perspectiveUtils.js";import{watch as o,when as a,initial as d}from"../../../../core/reactiveUtils.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isVideoElement as p}from"../../../../support/mediaLayerUtils.js";import{AnimatedSymbolRepeatType as u}from"../../../../symbols/cim/enums.js";import{DisplayObject as c}from"../DisplayObject.js";import{play as f}from"./animatedFormats/utils.js";import{TextureWrapMode as w}from"../../../webgl/enums.js";import{Texture as y}from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";const v=[1,1],R=l(),g={none:u.None,loop:u.Loop,oscillate:u.Oscillate};function q(e){return e?{type:"CIMAnimatedSymbolProperties",...e,playAnimation:e.playing,repeatType:e.repeatType?g[e.repeatType]:void 0}:{type:"CIMAnimatedSymbolProperties"}}class _ extends c{constructor(n){super(),this.elementView=n,this.isWrapAround=!1,this.wrapAroundShift=0,this.perspectiveTransform=h(),this._handles=new r,this._vertices=new Float32Array(8),this._indices=new Uint16Array([0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1]),this._handles.add([o((()=>this.elementView.element.opacity),(e=>this.opacity=e),d),o((()=>[this.elementView.coords]),(()=>{this.requestRender()}),d),o((()=>["animationOptions"in this.elementView.element&&this.elementView.element.animationOptions]),(()=>{this._handles.remove("play"),this.texture=i(this.texture),this.requestRender()}),d),a((()=>this.elementView.element.loaded),(()=>{const e=this.elementView.element;this.ready(),p(e)&&null!=e.content&&(this._handles.add([t(e.content,"play",(()=>this.requestRender())),t(e.content,"loadeddata",(()=>this.requestRender())),t(e.content,"loaded",(()=>this.requestRender()))]),"requestVideoFrameCallback"in e.content?e.content.requestVideoFrameCallback((()=>this.requestRender())):this._handles.add([t(e.content,"seeked",(()=>this.requestRender()))]),this.requestRender())}),d)]),n.element.load().catch((t=>{s.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new e("element-load-error","Element cannot be displayed",{element:n,error:t}))}))}getMesh(e){throw new Error("Method not implemented.")}destroy(){this._handles.destroy(),this.texture=i(this.texture)}get textureSize(){return v}get dvsMat3(){return this.parent.dvsMat3}beforeRender(e){const{context:t}=e,r=this.elementView.element.content;if(null!=r){const e=r instanceof HTMLImageElement,s=r instanceof HTMLVideoElement,i=e?r.naturalWidth:s?r.videoWidth:r.width,n=e?r.naturalHeight:s?r.videoHeight:r.height;if(this._updatePerspectiveTransform(i,n),this.texture){if(s)if(r.readyState>=r.HAVE_CURRENT_DATA)this._updateTextureAndRequestRender(r);else{const e=()=>{this._updateTextureAndRequestRender(r),r.removeEventListener("canplay",e),r.removeEventListener("seeked",e)};r.addEventListener("canplay",e),r.addEventListener("seeked",e)}}else{const e=new x(i,n);if(e.wrapMode=w.CLAMP_TO_EDGE,e.preMultiplyAlpha=!0,"getFrame"in r){const s=r=>{this.texture?this.texture.setData(r):this.texture=new y(t,e,r),this.requestRender()};"animationOptions"in this.elementView.element&&this._handles.add(f(r,q(this.elementView.element.animationOptions),null,s),"play")}else this.texture=new y(t,e,r);this.texture.generateMipmap(),s&&("requestVideoFrameCallback"in r?r.requestVideoFrameCallback((()=>this.requestRender())):r.paused||this.requestRender())}}super.beforeRender(e)}_updateTextureAndRequestRender(e){this.texture.setData(e),this.texture.generateMipmap(),"requestVideoFrameCallback"in e?e.requestVideoFrameCallback((()=>this.requestRender())):e.paused||this.requestRender()}_createTransforms(){return null}draw(e,t){this.isReady&&null!=this.texture?t.render(e,{transform:{dvs:this.dvsMat3},config:{perspective:this.perspectiveTransform,texSize:v,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity,texture:{texture:this.texture,unit:0}},position:this._vertices,tex:this._indices}):this.requestRender()}updateDrawCoords(e,t,r,s){const{coords:i,bounds:n}=this.elementView;if(null==i||null==n)return;const[o,a,d,l]=i.rings[0],m=this._vertices,{x:h,y:p}=e;m.set([a[0]-h,a[1]-p,o[0]-h,o[1]-p,d[0]-h,d[1]-p,l[0]-h,l[1]-p]);let u=t;if(s){const[e,,t]=n,{worldWidth:r,xBounds:i}=s,[o,a]=i;e<o&&t>o?u=r:t>a&&e<a&&(u=-r)}this.wrapAroundShift=u,this.isWrapAround=0!==u}_updatePerspectiveTransform(e,t){const r=this._vertices;n(R,[0,0,e,0,0,t,e,t],[r[0],r[1],r[4],r[5],r[2],r[3],r[6],r[7]]),m(this.perspectiveTransform,R[6]/R[8]*e,R[7]/R[8]*t)}}export{_ as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{on as t}from"../../../../core/events.js";import e from"../../../../core/Handles.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{when as i,initial as s}from"../../../../core/reactiveUtils.js";import{createScreenPoint as o}from"../../../../core/screenUtils.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import a from"../../../../geometry/Point.js";import h from"../../../../geometry/Polygon.js";import{project as l}from"../../../../geometry/projectionUtils.js";import{DisplayObject as u}from"../DisplayObject.js";import m from"../../../layers/support/Geometry.js";import{TextureWrapMode as d}from"../../../webgl/enums.js";import{Texture as c}from"../../../webgl/Texture.js";import{TextureDescriptor as p}from"../../../webgl/TextureDescriptor.js";const f=2;class x extends u{constructor(r){super(),this.element=r,this._handles=new e,this.isWrapAround=!1,this.perspectiveTransform=n(),this.wrapAroundShift=0,this.clipGeometry=null,this._handles.add(i((()=>this.element),(()=>{const e=this.element;this.ready(),e&&this._handles.add(t(e,"play",(()=>this.requestRender())))}),s))}getMesh(t){throw new Error("Method not implemented.")}destroy(){this._handles.destroy(),this.texture=r(this.texture)}get textureSize(){if(!this.texture)return[1,1];const t=this.texture.descriptor;return[t.width,t.height]}get dvsMat3(){return this.parent.dvsMat3}beforeRender(t){const e=this.element;if(null==e)return;const{context:r}=t,{videoWidth:i,videoHeight:s}=e;if(0!==i&&0!==s){if(this.texture)e.paused||this.texture.setData(e);else{const t=new p;t.wrapMode=d.CLAMP_TO_EDGE,t.preMultiplyAlpha=!0,
|
|
5
|
+
import{on as t}from"../../../../core/events.js";import e from"../../../../core/Handles.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{when as i,initial as s}from"../../../../core/reactiveUtils.js";import{createScreenPoint as o}from"../../../../core/screenUtils.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import a from"../../../../geometry/Point.js";import h from"../../../../geometry/Polygon.js";import{project as l}from"../../../../geometry/projectionUtils.js";import{DisplayObject as u}from"../DisplayObject.js";import m from"../../../layers/support/Geometry.js";import{TextureWrapMode as d}from"../../../webgl/enums.js";import{Texture as c}from"../../../webgl/Texture.js";import{TextureDescriptor as p}from"../../../webgl/TextureDescriptor.js";const f=2;class x extends u{constructor(r){super(),this.element=r,this._handles=new e,this.isWrapAround=!1,this.perspectiveTransform=n(),this.wrapAroundShift=0,this.clipGeometry=null,this._handles.add(i((()=>this.element),(()=>{const e=this.element;this.ready(),e&&this._handles.add(t(e,"play",(()=>this.requestRender())))}),s))}getMesh(t){throw new Error("Method not implemented.")}destroy(){this._handles.destroy(),this.texture=r(this.texture)}get textureSize(){if(!this.texture)return[1,1];const t=this.texture.descriptor;return[t.width,t.height]}get dvsMat3(){return this.parent.dvsMat3}beforeRender(t){const e=this.element;if(null==e)return;const{context:r}=t,{videoWidth:i,videoHeight:s}=e;if(0!==i&&0!==s){if(this.texture)e.paused||this.texture.setData(e);else{const t=new p(i,s);t.wrapMode=d.CLAMP_TO_EDGE,t.preMultiplyAlpha=!0,this.texture=new c(r,t,e)}e.paused||(this.texture.generateMipmap(),this.requestRender()),super.beforeRender(t)}}_createTransforms(){return null}updateDrawCoords(t,e,r,i){const s=this.element,o=this._getFrameInfo();if(!s||!o)return;this._initializeData(t,o,r);const{controlPoints:n,horizon:a}=o,u=Math.sqrt(n.length),d=u,{x:c,y:p}=t,x=this._vertices,y=n[0],g=n[u-1],P=n[(d-1)*u],w=n[(d-1)*u+u-1],_=l(a?a[0].mapPoint:y.mapPoint,r),v=l(a?a[1].mapPoint:g.mapPoint,r),j=l(P.mapPoint,r),A=l(w.mapPoint,r);this.clipGeometry=a?new m({geometry:h.fromJSON({rings:[[[j.x,j.y],[A.x,A.y],[v.x,v.y],[_.x,_.y],[j.x,j.y]]],spatialReference:r})}):null;for(let h=0;h<n.length;h++){const t=n[h],{sourcePoint:e,mapPoint:i}=t;if(null==e||null==i)continue;const s=l(i,r);x[h*f+0]=s.x-c,x[h*f+1]=s.y-p}let M=e;if(i){const t=Math.min(_.x,v.x,j.x,A.x),e=Math.max(_.x,v.x,j.x,A.x),{worldWidth:r,xBounds:s}=i,[o,n]=s;t<o&&e>o?M=r:e>n&&t<n&&(M=-r)}this.wrapAroundShift=M,this.isWrapAround=0!==M}draw(t,e){this.visible&&(this.isReady&&this._vertices&&this._indices&&this._texCoords?e.render(t,{transform:{dvs:this.dvsMat3},config:{perspective:this.perspectiveTransform,texSize:this.textureSize,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity,texture:{texture:this.texture,unit:0}},position:this._vertices,tex:this._texCoords,index:this._indices}):this.requestRender())}_initializeData(t,e,r){if(null!=this._vertices&&null!=this._indices)return;const{controlPoints:i}=e,s=Math.sqrt(i.length),o=s,n=new Float32Array(f*i.length),a=new Uint16Array(2*i.length);for(let m=0;m<i.length;m++){const e=i[m],{sourcePoint:s,mapPoint:o}=e;if(null==s||null==o)continue;const h=l(o,r);n[m*f+0]=h.x-t.x,n[m*f+1]=h.y-t.y,a[2*m+0]=s.x,a[2*m+1]=s.y}const h=new Uint16Array(o*s+(o-2)*(s+2));let u=0;for(let l=0;l<o;l++){for(let t=0;t<s;t++)h[u++]=l*s+t,h[u++]=(l+1)*s+t;l<o-2&&(h[u++]=(l+1)*s+(s-1),h[u++]=(l+1)*s)}this._vertices=n,this._texCoords=a,this._indices=h}_getFrameInfo(){if(!this.groundControlPoints)return null;const t=this._getFrameControlPoints(),e=this.frameHorizonPoints;let r=null;if(e){const t=e.startX,i=e.startY,s=e.endX,n=e.endY;r=[{sourcePoint:o(t,i),mapPoint:new a(e.startLongitude,e.startLatitude)},{sourcePoint:o(s,n),mapPoint:new a(e.endLongitude,e.endLatitude)}]}return{controlPoints:t,horizon:r}}_getFrameControlPoints(){const t=this.groundControlPoints,e=t?.length;if(!e)return[];const r=new Array(e),i=Math.max(...t.map((({x:t})=>t))),s=this.element.videoWidth/i;for(let n=0;n<e;n++){const{x:e,y:i,lat:h,lon:l}=t[n];r[n]={sourcePoint:o(e*s,-i*s),mapPoint:new a(l,h)}}return r}}export{x as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import{spritePadding as e}from"./definitions.js";import{log2 as i}from"./GeometryUtils.js";import s from"./Rect.js";import a from"./RectangleBinPack.js";import{TextureWrapMode as r}from"../../../webgl/enums.js";import{Texture as o}from"../../../webgl/Texture.js";import{TextureDescriptor as h}from"../../../webgl/TextureDescriptor.js";function c(t){return t&&"static"===t.type}class n{constructor(t,e,i=0){this._mosaicPages=[],this._maxItemSize=0,this._currentPage=0,this._pageWidth=0,this._pageHeight=0,this._mosaicRects=new Map,this._spriteCopyQueue=[],this.pixelRatio=1,this._pageWidth=t,this._pageHeight=e,i>0&&(this._maxItemSize=i),this.pixelRatio=window.devicePixelRatio||1,this._binPack=new a(this._pageWidth,this._pageHeight);const s=Math.floor(this._pageWidth),r=Math.floor(this._pageHeight);this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(s*r)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0})}getWidth(t){return t>=this._mosaicPages.length?-1:this._mosaicPages[t].size[0]}getHeight(t){return t>=this._mosaicPages.length?-1:this._mosaicPages[t].size[1]}getPageTexture(t){return t<this._mosaicPages.length?this._mosaicPages[t].texture:null}has(t){return this._mosaicRects.has(t)}get itemCount(){return this._mosaicRects.size}getSpriteItem(t){return this._mosaicRects.get(t)}addSpriteItem(t,i,a,r,o,h,n=1,g="Linear",p=.5,m=1){if(this._mosaicRects.has(t))return this._mosaicRects.get(t);let d,u,l;if(c(a))[d,u,l]=this._allocateImage(i[0],i[1]);else{d=new s(0,0,i[0],i[1]),u=this._mosaicPages.length;const t=void 0;this._mosaicPages.push({mosaicsData:a,size:[i[0]+2*e,i[1]+2*e],dirty:!0,texture:t})}if(d.width<=0||d.height<=0)return null;const _={type:"sprite",rect:d,width:i[0],height:i[1],sdf:o,simplePattern:h,rasterizationScale:n,samplingMode:g,sdfPaddingRatio:p,sdfDecodeCoeff:m,page:u};return this._mosaicRects.set(t,_),c(a)&&(has("esri-mosaic-debug")&&this._showDebugSprite(i,a.data),this._copy({rect:d,spriteSize:i,spriteData:a.data,page:u,pageSize:l,repeat:r,sdf:o})),_}hasItemsToProcess(){return 0!==this._spriteCopyQueue.length}processNextItem(){const t=this._spriteCopyQueue.pop();t&&this._copy(t)}getMosaicItemPosition(t){const i=this.getSpriteItem(t),s=i?.rect;if(!s)return null;s.width=i.width,s.height=i.height;const a=i.width,r=i.height,o=e,h=this._mosaicPages[i.page].size;return{size:[i.width,i.height],tl:[(s.x+o)/h[0],(s.y+o)/h[1]],br:[(s.x+o+a)/h[0],(s.y+o+r)/h[1]],page:i.page}}bind(t,e,i=0,s=0){const a=this._mosaicPages[i],r=a.mosaicsData;let o=a.texture;if(o||(o=p(t,a.size),a.texture=o),o.setSamplingMode(e),c(r))t.bindTexture(o,s),a.dirty&&(o.setData(new Uint8Array(r.data.buffer)),o.generateMipmap(),has("esri-mosaic-debug")&&this._showDebugPage(i));else{r.data.loadFrame(o),t.bindTexture(o,s),o.generateMipmap()}a.dirty=!1}getTexture(t,e=0){const i=this._mosaicPages[e],s=i.mosaicsData;let a=i.texture;if(a||(a=p(t,i.size),i.texture=a),c(s))i.dirty&&(a.setData(new Uint8Array(s.data.buffer)),a.generateMipmap(),has("esri-mosaic-debug")&&this._showDebugPage(e));else{s.data.loadFrame(a),a.generateMipmap()}return i.dirty=!1,a}dispose(){this._binPack=null;for(const t of this._mosaicPages){const e=t.texture;e&&e.dispose();const i=t.mosaicsData;if(!c(i)){i.data.destroy()}}this._mosaicPages=null,this._mosaicRects.clear()}static _copyBits(t,e,i,s,a,r,o,h,c,n,g){let p=s*e+i,m=h*r+o;if(g){m-=r;for(let o=-1;o<=n;o++,p=((o+n)%n+s)*e+i,m+=r)for(let e=-1;e<=c;e++)a[m+e]=t[p+(e+c)%c]}else for(let d=0;d<n;d++){for(let e=0;e<c;e++)a[m+e]=t[p+e];p+=e,m+=r}}_copy(i){if(i.page>=this._mosaicPages.length)return;const s=this._mosaicPages[i.page],a=s.mosaicsData;if(!c(s.mosaicsData))throw new t("mapview-invalid-resource","unsuitable data type!");const r=i.spriteData,o=a.data;n._copyBits(r,i.spriteSize[0],0,0,o,i.pageSize[0],i.rect.x+e,i.rect.y+e,i.spriteSize[0],i.spriteSize[1],i.repeat),s.dirty=!0}_allocateImage(t,r){t+=2*e,r+=2*e;const o=Math.max(t,r);if(this._maxItemSize&&this._maxItemSize<o){const e=2**Math.ceil(i(t)),a=2**Math.ceil(i(r)),o=new s(0,0,t,r);return this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(e*a)},size:[e,a],dirty:!0,texture:void 0}),[o,this._mosaicPages.length-1,[e,a]]}const h=this._binPack.allocate(t,r);if(h.width<=0){const e=this._mosaicPages[this._currentPage];return!e.dirty&&c(e.mosaicsData)&&(e.mosaicsData.data=null),this._currentPage=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(this._pageWidth*this._pageHeight)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0}),this._binPack=new a(this._pageWidth,this._pageHeight),this._allocateImage(t,r)}return[h,this._currentPage,[this._pageWidth,this._pageHeight]]}_showDebugSprite([t,e],i){const s=document.createElement("canvas");s.width=t,s.height=e,s.setAttribute("style",`position: absolute; top: ${4+204*g++}px; right: 208px; width: 200px; height: 200px; border: 1px solid black;`);const a=s.getContext("2d"),r=new ImageData(t,e);r.data.set(new Uint8Array(i.buffer)),a.putImageData(r,0,0),document.body.appendChild(s)}_showDebugPage(t){const e=this._mosaicPages[t],{size:[i,s],mosaicsData:a}=e;if(!c(a))return;const r=`mosaicDebugPage${t}`,o=document.getElementById(r)??document.createElement("canvas");o.id=r,o.width=i,o.height=s,o.setAttribute("style",`position: absolute; top: ${4+204*t}px; right: 4px; width: 200px; height: 200px; border: 1px solid black;`);const h=o.getContext("2d"),n=new ImageData(i,s);n.data.set(new Uint8Array(a.data.buffer)),h.putImageData(n,0,0),document.body.appendChild(o)}}let g=0;function p(t,e){const i=new h
|
|
5
|
+
import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import{spritePadding as e}from"./definitions.js";import{log2 as i}from"./GeometryUtils.js";import s from"./Rect.js";import a from"./RectangleBinPack.js";import{TextureWrapMode as r}from"../../../webgl/enums.js";import{Texture as o}from"../../../webgl/Texture.js";import{TextureDescriptor as h}from"../../../webgl/TextureDescriptor.js";function c(t){return t&&"static"===t.type}class n{constructor(t,e,i=0){this._mosaicPages=[],this._maxItemSize=0,this._currentPage=0,this._pageWidth=0,this._pageHeight=0,this._mosaicRects=new Map,this._spriteCopyQueue=[],this.pixelRatio=1,this._pageWidth=t,this._pageHeight=e,i>0&&(this._maxItemSize=i),this.pixelRatio=window.devicePixelRatio||1,this._binPack=new a(this._pageWidth,this._pageHeight);const s=Math.floor(this._pageWidth),r=Math.floor(this._pageHeight);this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(s*r)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0})}getWidth(t){return t>=this._mosaicPages.length?-1:this._mosaicPages[t].size[0]}getHeight(t){return t>=this._mosaicPages.length?-1:this._mosaicPages[t].size[1]}getPageTexture(t){return t<this._mosaicPages.length?this._mosaicPages[t].texture:null}has(t){return this._mosaicRects.has(t)}get itemCount(){return this._mosaicRects.size}getSpriteItem(t){return this._mosaicRects.get(t)}addSpriteItem(t,i,a,r,o,h,n=1,g="Linear",p=.5,m=1){if(this._mosaicRects.has(t))return this._mosaicRects.get(t);let d,u,l;if(c(a))[d,u,l]=this._allocateImage(i[0],i[1]);else{d=new s(0,0,i[0],i[1]),u=this._mosaicPages.length;const t=void 0;this._mosaicPages.push({mosaicsData:a,size:[i[0]+2*e,i[1]+2*e],dirty:!0,texture:t})}if(d.width<=0||d.height<=0)return null;const _={type:"sprite",rect:d,width:i[0],height:i[1],sdf:o,simplePattern:h,rasterizationScale:n,samplingMode:g,sdfPaddingRatio:p,sdfDecodeCoeff:m,page:u};return this._mosaicRects.set(t,_),c(a)&&(has("esri-mosaic-debug")&&this._showDebugSprite(i,a.data),this._copy({rect:d,spriteSize:i,spriteData:a.data,page:u,pageSize:l,repeat:r,sdf:o})),_}hasItemsToProcess(){return 0!==this._spriteCopyQueue.length}processNextItem(){const t=this._spriteCopyQueue.pop();t&&this._copy(t)}getMosaicItemPosition(t){const i=this.getSpriteItem(t),s=i?.rect;if(!s)return null;s.width=i.width,s.height=i.height;const a=i.width,r=i.height,o=e,h=this._mosaicPages[i.page].size;return{size:[i.width,i.height],tl:[(s.x+o)/h[0],(s.y+o)/h[1]],br:[(s.x+o+a)/h[0],(s.y+o+r)/h[1]],page:i.page}}bind(t,e,i=0,s=0){const a=this._mosaicPages[i],r=a.mosaicsData;let o=a.texture;if(o||(o=p(t,a.size),a.texture=o),o.setSamplingMode(e),c(r))t.bindTexture(o,s),a.dirty&&(o.setData(new Uint8Array(r.data.buffer)),o.generateMipmap(),has("esri-mosaic-debug")&&this._showDebugPage(i));else{r.data.loadFrame(o),t.bindTexture(o,s),o.generateMipmap()}a.dirty=!1}getTexture(t,e=0){const i=this._mosaicPages[e],s=i.mosaicsData;let a=i.texture;if(a||(a=p(t,i.size),i.texture=a),c(s))i.dirty&&(a.setData(new Uint8Array(s.data.buffer)),a.generateMipmap(),has("esri-mosaic-debug")&&this._showDebugPage(e));else{s.data.loadFrame(a),a.generateMipmap()}return i.dirty=!1,a}dispose(){this._binPack=null;for(const t of this._mosaicPages){const e=t.texture;e&&e.dispose();const i=t.mosaicsData;if(!c(i)){i.data.destroy()}}this._mosaicPages=null,this._mosaicRects.clear()}static _copyBits(t,e,i,s,a,r,o,h,c,n,g){let p=s*e+i,m=h*r+o;if(g){m-=r;for(let o=-1;o<=n;o++,p=((o+n)%n+s)*e+i,m+=r)for(let e=-1;e<=c;e++)a[m+e]=t[p+(e+c)%c]}else for(let d=0;d<n;d++){for(let e=0;e<c;e++)a[m+e]=t[p+e];p+=e,m+=r}}_copy(i){if(i.page>=this._mosaicPages.length)return;const s=this._mosaicPages[i.page],a=s.mosaicsData;if(!c(s.mosaicsData))throw new t("mapview-invalid-resource","unsuitable data type!");const r=i.spriteData,o=a.data;n._copyBits(r,i.spriteSize[0],0,0,o,i.pageSize[0],i.rect.x+e,i.rect.y+e,i.spriteSize[0],i.spriteSize[1],i.repeat),s.dirty=!0}_allocateImage(t,r){t+=2*e,r+=2*e;const o=Math.max(t,r);if(this._maxItemSize&&this._maxItemSize<o){const e=2**Math.ceil(i(t)),a=2**Math.ceil(i(r)),o=new s(0,0,t,r);return this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(e*a)},size:[e,a],dirty:!0,texture:void 0}),[o,this._mosaicPages.length-1,[e,a]]}const h=this._binPack.allocate(t,r);if(h.width<=0){const e=this._mosaicPages[this._currentPage];return!e.dirty&&c(e.mosaicsData)&&(e.mosaicsData.data=null),this._currentPage=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(this._pageWidth*this._pageHeight)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0}),this._binPack=new a(this._pageWidth,this._pageHeight),this._allocateImage(t,r)}return[h,this._currentPage,[this._pageWidth,this._pageHeight]]}_showDebugSprite([t,e],i){const s=document.createElement("canvas");s.width=t,s.height=e,s.setAttribute("style",`position: absolute; top: ${4+204*g++}px; right: 208px; width: 200px; height: 200px; border: 1px solid black;`);const a=s.getContext("2d"),r=new ImageData(t,e);r.data.set(new Uint8Array(i.buffer)),a.putImageData(r,0,0),document.body.appendChild(s)}_showDebugPage(t){const e=this._mosaicPages[t],{size:[i,s],mosaicsData:a}=e;if(!c(a))return;const r=`mosaicDebugPage${t}`,o=document.getElementById(r)??document.createElement("canvas");o.id=r,o.width=i,o.height=s,o.setAttribute("style",`position: absolute; top: ${4+204*t}px; right: 4px; width: 200px; height: 200px; border: 1px solid black;`);const h=o.getContext("2d"),n=new ImageData(i,s);n.data.set(new Uint8Array(a.data.buffer)),h.putImageData(n,0,0),document.body.appendChild(o)}}let g=0;function p(t,e){const i=new h(e[0],e[1]);return i.wrapMode=r.CLAMP_TO_EDGE,new o(t,i,null)}export{n as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{fromValues as e}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{Pos2b as t}from"../DefaultVertexAttributeLayouts.js";import{FeatureTile as r}from"../FeatureTile.js";import o from"./WGLBrush.js";import{background as i}from"../shaders/BackgroundPrograms.js";import{tileInfo as s}from"../shaders/TileInfoPrograms.js";import{BufferObject as n}from"../../../../webgl/BufferObject.js";import{BlendFactor as a,PrimitiveType as l,Usage as f,TextureWrapMode as m,TextureSamplingMode as u}from"../../../../webgl/enums.js";import{createProgram as c}from"../../../../webgl/ProgramTemplate.js";import{Texture as d}from"../../../../webgl/Texture.js";import{TextureDescriptor as
|
|
5
|
+
import{fromValues as e}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{Pos2b as t}from"../DefaultVertexAttributeLayouts.js";import{FeatureTile as r}from"../FeatureTile.js";import o from"./WGLBrush.js";import{background as i}from"../shaders/BackgroundPrograms.js";import{tileInfo as s}from"../shaders/TileInfoPrograms.js";import{BufferObject as n}from"../../../../webgl/BufferObject.js";import{BlendFactor as a,PrimitiveType as l,Usage as f,TextureWrapMode as m,TextureSamplingMode as u}from"../../../../webgl/enums.js";import{createProgram as c}from"../../../../webgl/ProgramTemplate.js";import{Texture as d}from"../../../../webgl/Texture.js";import{TextureDescriptor as g}from"../../../../webgl/TextureDescriptor.js";import{VertexArrayObject as h}from"../../../../webgl/VertexArrayObject.js";const _=512,x=512,b=16,p=8,T=(x-2*p)/5;class y extends o{constructor(){super(...arguments),this._color=e(1,0,0,1)}dispose(){this._outlineProgram?.dispose(),this._outlineProgram=null,this._tileInfoProgram?.dispose(),this._tileInfoProgram=null,this._outlineVertexArrayObject?.dispose(),this._outlineVertexArrayObject=null,this._tileInfoVertexArrayObject?.dispose(),this._tileInfoVertexArrayObject=null,this._ctx=null}prepareState({context:e}){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(a.ONE,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA),e.setColorMask(!0,!0,!0,!0),e.setStencilWriteMask(0),e.setStencilTestEnabled(!1)}draw(e,t){const{context:o,requestRender:i,allowDelayedRender:s}=e;if(!t.isReady&&t instanceof r&&t.hasData)return;if(this._loadWGLResources(o),s&&null!=i&&(!this._outlineProgram.compiled||!this._tileInfoProgram.compiled))return void i();o.bindVAO(this._outlineVertexArrayObject),o.useProgram(this._outlineProgram),this._outlineProgram.setUniformMatrix3fv("u_dvsMat3",t.transforms.displayViewScreenMat3),this._outlineProgram.setUniform2f("u_coord_range",t.rangeX,t.rangeY),this._outlineProgram.setUniform1f("u_depth",0),this._outlineProgram.setUniform4fv("u_color",this._color),o.drawArrays(l.LINE_STRIP,0,4);const n=this._getTexture(o,t);n?(o.bindVAO(this._tileInfoVertexArrayObject),o.useProgram(this._tileInfoProgram),o.bindTexture(n,0),this._tileInfoProgram.setUniformMatrix3fv("u_dvsMat3",t.transforms.displayViewScreenMat3),this._tileInfoProgram.setUniform1f("u_depth",0),this._tileInfoProgram.setUniform2f("u_coord_ratio",t.rangeX/t.width,t.rangeY/t.height),this._tileInfoProgram.setUniform2f("u_delta",0,0),this._tileInfoProgram.setUniform2f("u_dimensions",n.descriptor.width,n.descriptor.height),o.drawArrays(l.TRIANGLE_STRIP,0,4),o.bindVAO()):o.bindVAO()}_loadWGLResources(e){if(this._outlineProgram&&this._tileInfoProgram)return;const r=c(e,i),o=c(e,s),a=new Int8Array([0,0,1,0,1,1,0,1]),l=n.createVertex(e,f.STATIC_DRAW,a),m=new h(e,i.attributes,t,new Map([["geometry",l]])),u=new Int8Array([0,0,1,0,0,1,1,1]),d=n.createVertex(e,f.STATIC_DRAW,u),g=new h(e,s.attributes,t,new Map([["geometry",d]]));this._outlineProgram=r,this._tileInfoProgram=o,this._outlineVertexArrayObject=m,this._tileInfoVertexArrayObject=g}_getTexture(e,t){if(!this._ctx){const e=document.createElement("canvas");e.width=_,e.height=x,this._ctx=e.getContext("2d")}if(!t.tileDebugInfoTexture){const r=new g(_,x);r.wrapMode=m.CLAMP_TO_EDGE,r.samplingMode=u.LINEAR,r.isImmutable=!0,t.tileDebugInfoTexture=new d(e,r)}const r=this._ctx;r.clearRect(0,0,r.canvas.width,r.canvas.height),r.textAlign="left",r.textBaseline="top",r.font=b-2+"px sans-serif",r.lineWidth=2,r.fillStyle="white",r.strokeStyle="black";const{debugSlot:o}=t;let i=p+T*o;const s=`${o}) ${t.key.id} (${t.constructor.name})`;r.strokeText(s,p,i),r.fillText(s,p,i),i+=b;const{debugInfo:n}=t;if(n){const{length:e,minOrderedLength:t,minUnorderedLength:o,triangleCount:s}=n.display;if(e>0){const t=`Length: ${e}`;r.strokeText(t,p,i),r.fillText(t,p,i),i+=b}if(t){const e=`Min ordered length: ${t}`;r.strokeText(e,p,i),r.fillText(e,p,i),i+=b}if(o){const e=`Min unordered length: ${o}`;r.strokeText(e,p,i),r.fillText(e,p,i),i+=b}if(s>0){s>1e5&&(r.fillStyle="red",r.strokeStyle="white");const e=`Triangle count: ${s}`;r.strokeText(e,p,i),r.fillText(e,p,i),i+=b}const{bytesUsed:a,bytesReserved:l}=n.memory;if(r.fillStyle="white",r.strokeStyle="black",a>0||l>0){const e=`Memory usage: ${a} of ${l} bytes`;r.strokeText(e,p,i),r.fillText(e,p,i),i+=b}}return t.tileDebugInfoTexture.setData(r.canvas),t.tileDebugInfoTexture}}export{y as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import o from"../../../../../../core/Logger.js";import{textureBindingHighlight1 as i,maxHighlightReasons as t}from"../../definitions.js";import{shadeTextureSize as e,sigma as l}from"./parameters.js";import r from"../../../../../support/HighlightOptions.js";import{TextureWrapMode as h}from"../../../../../webgl/enums.js";import{Texture as n}from"../../../../../webgl/Texture.js";import{TextureDescriptor as s}from"../../../../../webgl/TextureDescriptor.js";const a=()=>o.getLogger("esri.views.2d.engine.webgl.painter.highlight.HighlightGradient");function u(o,i){i.fillColor[0]=o.color.r/255,i.fillColor[1]=o.color.g/255,i.fillColor[2]=o.color.b/255,i.fillColor[3]=o.color.a,o.haloColor?(i.outlineColor[0]=o.haloColor.r/255,i.outlineColor[1]=o.haloColor.g/255,i.outlineColor[2]=o.haloColor.b/255,i.outlineColor[3]=o.haloColor.a):(i.outlineColor[0]=i.fillColor[0],i.outlineColor[1]=i.fillColor[1],i.outlineColor[2]=i.fillColor[2],i.outlineColor[3]=i.fillColor[3]),i.fillColor[3]*=o.fillOpacity,i.outlineColor[3]*=o.haloOpacity,i.fillColor[0]*=i.fillColor[3],i.fillColor[1]*=i.fillColor[3],i.fillColor[2]*=i.fillColor[3],i.outlineColor[0]*=i.outlineColor[3],i.outlineColor[1]*=i.outlineColor[3],i.outlineColor[2]*=i.outlineColor[3],i.outlineWidth=(1-o.haloBlur)*o.haloWidth,i.outerHaloWidth=o.haloBlur*o.haloWidth/2,i.innerHaloWidth=o.haloBlur*o.haloWidth/2,i.outlinePosition=0}const d=[0,0,0,0];class g{constructor(){this.type="single",this._highlightOptions=new r,this._convertedHighlightOptions={fillColor:[0,0,0,0],outlineColor:[0,0,0,0],outlinePosition:0,outlineWidth:0,innerHaloWidth:0,outerHaloWidth:0},this._optionsShadeTexKey="",this._texelData=new Uint8Array(4*e),this._minMaxDistance=[0,0]}setHighlightOptions(o){this._highlightOptions=o}applyHighlightOptions(o,t){this._updateGradientTexture(o),o.bindTexture(this._shadeTex,i),t.setUniform2fv("u_minMaxDistance",this._minMaxDistance)}destroy(){this._shadeTex?.dispose(),this._shadeTex=null}getReasonsWithGradients(){return[{activeReasons:(1<<t)-1,activeGradient:this}]}_updateGradientTexture(o){const i=f(this._highlightOptions);if(i===this._optionsShadeTexKey)return;this._optionsShadeTexKey=i,u(this._highlightOptions,this._convertedHighlightOptions);const t=this._convertedHighlightOptions,r=t.outlinePosition-t.outlineWidth/2-t.outerHaloWidth,g=t.outlinePosition-t.outlineWidth/2,p=t.outlinePosition+t.outlineWidth/2,C=t.outlinePosition+t.outlineWidth/2+t.innerHaloWidth,c=Math.sqrt(Math.PI/2)*l,m=Math.abs(r)>c?Math.round(10*(Math.abs(r)-c))/10:0,x=Math.abs(C)>c?Math.round(10*(Math.abs(C)-c))/10:0;let _;m&&!x?a().error("The outer rim of the highlight is "+m+"px away from the edge of the feature; consider reducing some width values or shifting the outline position towards positive values (inwards)."):!m&&x?a().error("The inner rim of the highlight is "+x+"px away from the edge of the feature; consider reducing some width values or shifting the outline position towards negative values (outwards)."):m&&x&&a().error("The highlight is "+Math.max(m,x)+"px away from the edge of the feature; consider reducing some width values.");const w=[void 0,void 0,void 0,void 0];function T(o,i,t){w[0]=(1-t)*o[0]+t*i[0],w[1]=(1-t)*o[1]+t*i[1],w[2]=(1-t)*o[2]+t*i[2],w[3]=(1-t)*o[3]+t*i[3]}const{_texelData:v}=this;for(let l=0;l<e;++l)_=r+l/(e-1)*(C-r),_<r?(w[0]=0,w[1]=0,w[2]=0,w[3]=0):_<g?T(d,t.outlineColor,(_-r)/(g-r)):_<p?[w[0],w[1],w[2],w[3]]=t.outlineColor:_<C?T(t.outlineColor,t.fillColor,(_-p)/(C-p)):[w[0],w[1],w[2],w[3]]=t.fillColor,v[4*l]=255*w[0],v[4*l+1]=255*w[1],v[4*l+2]=255*w[2],v[4*l+3]=255*w[3];if(this._minMaxDistance[0]=r,this._minMaxDistance[1]=C,!this._shadeTex){const i=new s;i.wrapMode=h.CLAMP_TO_EDGE,
|
|
5
|
+
import o from"../../../../../../core/Logger.js";import{textureBindingHighlight1 as i,maxHighlightReasons as t}from"../../definitions.js";import{shadeTextureSize as e,sigma as l}from"./parameters.js";import r from"../../../../../support/HighlightOptions.js";import{TextureWrapMode as h}from"../../../../../webgl/enums.js";import{Texture as n}from"../../../../../webgl/Texture.js";import{TextureDescriptor as s}from"../../../../../webgl/TextureDescriptor.js";const a=()=>o.getLogger("esri.views.2d.engine.webgl.painter.highlight.HighlightGradient");function u(o,i){i.fillColor[0]=o.color.r/255,i.fillColor[1]=o.color.g/255,i.fillColor[2]=o.color.b/255,i.fillColor[3]=o.color.a,o.haloColor?(i.outlineColor[0]=o.haloColor.r/255,i.outlineColor[1]=o.haloColor.g/255,i.outlineColor[2]=o.haloColor.b/255,i.outlineColor[3]=o.haloColor.a):(i.outlineColor[0]=i.fillColor[0],i.outlineColor[1]=i.fillColor[1],i.outlineColor[2]=i.fillColor[2],i.outlineColor[3]=i.fillColor[3]),i.fillColor[3]*=o.fillOpacity,i.outlineColor[3]*=o.haloOpacity,i.fillColor[0]*=i.fillColor[3],i.fillColor[1]*=i.fillColor[3],i.fillColor[2]*=i.fillColor[3],i.outlineColor[0]*=i.outlineColor[3],i.outlineColor[1]*=i.outlineColor[3],i.outlineColor[2]*=i.outlineColor[3],i.outlineWidth=(1-o.haloBlur)*o.haloWidth,i.outerHaloWidth=o.haloBlur*o.haloWidth/2,i.innerHaloWidth=o.haloBlur*o.haloWidth/2,i.outlinePosition=0}const d=[0,0,0,0];class g{constructor(){this.type="single",this._highlightOptions=new r,this._convertedHighlightOptions={fillColor:[0,0,0,0],outlineColor:[0,0,0,0],outlinePosition:0,outlineWidth:0,innerHaloWidth:0,outerHaloWidth:0},this._optionsShadeTexKey="",this._texelData=new Uint8Array(4*e),this._minMaxDistance=[0,0]}setHighlightOptions(o){this._highlightOptions=o}applyHighlightOptions(o,t){this._updateGradientTexture(o),o.bindTexture(this._shadeTex,i),t.setUniform2fv("u_minMaxDistance",this._minMaxDistance)}destroy(){this._shadeTex?.dispose(),this._shadeTex=null}getReasonsWithGradients(){return[{activeReasons:(1<<t)-1,activeGradient:this}]}_updateGradientTexture(o){const i=f(this._highlightOptions);if(i===this._optionsShadeTexKey)return;this._optionsShadeTexKey=i,u(this._highlightOptions,this._convertedHighlightOptions);const t=this._convertedHighlightOptions,r=t.outlinePosition-t.outlineWidth/2-t.outerHaloWidth,g=t.outlinePosition-t.outlineWidth/2,p=t.outlinePosition+t.outlineWidth/2,C=t.outlinePosition+t.outlineWidth/2+t.innerHaloWidth,c=Math.sqrt(Math.PI/2)*l,m=Math.abs(r)>c?Math.round(10*(Math.abs(r)-c))/10:0,x=Math.abs(C)>c?Math.round(10*(Math.abs(C)-c))/10:0;let _;m&&!x?a().error("The outer rim of the highlight is "+m+"px away from the edge of the feature; consider reducing some width values or shifting the outline position towards positive values (inwards)."):!m&&x?a().error("The inner rim of the highlight is "+x+"px away from the edge of the feature; consider reducing some width values or shifting the outline position towards negative values (outwards)."):m&&x&&a().error("The highlight is "+Math.max(m,x)+"px away from the edge of the feature; consider reducing some width values.");const w=[void 0,void 0,void 0,void 0];function T(o,i,t){w[0]=(1-t)*o[0]+t*i[0],w[1]=(1-t)*o[1]+t*i[1],w[2]=(1-t)*o[2]+t*i[2],w[3]=(1-t)*o[3]+t*i[3]}const{_texelData:v}=this;for(let l=0;l<e;++l)_=r+l/(e-1)*(C-r),_<r?(w[0]=0,w[1]=0,w[2]=0,w[3]=0):_<g?T(d,t.outlineColor,(_-r)/(g-r)):_<p?[w[0],w[1],w[2],w[3]]=t.outlineColor:_<C?T(t.outlineColor,t.fillColor,(_-p)/(C-p)):[w[0],w[1],w[2],w[3]]=t.fillColor,v[4*l]=255*w[0],v[4*l+1]=255*w[1],v[4*l+2]=255*w[2],v[4*l+3]=255*w[3];if(this._minMaxDistance[0]=r,this._minMaxDistance[1]=C,!this._shadeTex){const i=new s(e,1);i.wrapMode=h.CLAMP_TO_EDGE,this._shadeTex=new n(o,i)}this._shadeTex.updateData(0,0,0,e,1,this._texelData)}}function f(o){return`${o.color};${o.haloColor};${o.haloOpacity};${o.fillOpacity};${o.haloWidth};${o.haloBlur}`}export{g as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{disposeMaybe as e}from"../../../../../../core/maybe.js";import t from"../../VertexStream.js";import{BlendFactor as r,PixelFormat as s,TextureWrapMode as i}from"../../../../../webgl/enums.js";import{Texture as o}from"../../../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../../../webgl/TextureDescriptor.js";class n{constructor(){this._layerFBOTexture=null,this._size=[0,0],this._programDesc={vsPath:"post-processing/pp",fsPath:"post-processing/filterEffect",attributes:new Map([["a_position",0]])}}dispose(){this._layerFBOTexture=e(this._layerFBOTexture)}draw(e,t,s){const{width:i,height:o}=t;this._createOrResizeResources(e,i,o);const{context:a,painter:n}=e,{materialManager:c}=n,l=this._programDesc,u=this._quad,_=s.colorMatrix;u.bind();const h=this._layerFBOTexture;a.bindFramebuffer(t),t.copyToTexture(0,0,i,o,0,0,h),a.setBlendingEnabled(!1),a.setStencilTestEnabled(!1);const m=c.getProgram(l);a.useProgram(m),a.bindTexture(h,2),m.setUniformMatrix4fv("u_coefficients",_),m.setUniform1i("u_colorTexture",2),u.draw(),a.setBlendingEnabled(!0),a.setBlendFunction(r.ONE,r.ONE_MINUS_SRC_ALPHA),a.setStencilTestEnabled(!0),u.unbind()}_createOrResizeResources(e,r,n){const{context:c}=e;if(!this._layerFBOTexture||this._size[0]!==r||this._size[1]!==n){if(this._size[0]=r,this._size[1]=n,this._layerFBOTexture)this._layerFBOTexture.resize(r,n);else{const e=new a;e.internalFormat=s.RGBA,e.wrapMode=i.CLAMP_TO_EDGE,
|
|
5
|
+
import{disposeMaybe as e}from"../../../../../../core/maybe.js";import t from"../../VertexStream.js";import{BlendFactor as r,PixelFormat as s,TextureWrapMode as i}from"../../../../../webgl/enums.js";import{Texture as o}from"../../../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../../../webgl/TextureDescriptor.js";class n{constructor(){this._layerFBOTexture=null,this._size=[0,0],this._programDesc={vsPath:"post-processing/pp",fsPath:"post-processing/filterEffect",attributes:new Map([["a_position",0]])}}dispose(){this._layerFBOTexture=e(this._layerFBOTexture)}draw(e,t,s){const{width:i,height:o}=t;this._createOrResizeResources(e,i,o);const{context:a,painter:n}=e,{materialManager:c}=n,l=this._programDesc,u=this._quad,_=s.colorMatrix;u.bind();const h=this._layerFBOTexture;a.bindFramebuffer(t),t.copyToTexture(0,0,i,o,0,0,h),a.setBlendingEnabled(!1),a.setStencilTestEnabled(!1);const m=c.getProgram(l);a.useProgram(m),a.bindTexture(h,2),m.setUniformMatrix4fv("u_coefficients",_),m.setUniform1i("u_colorTexture",2),u.draw(),a.setBlendingEnabled(!0),a.setBlendFunction(r.ONE,r.ONE_MINUS_SRC_ALPHA),a.setStencilTestEnabled(!0),u.unbind()}_createOrResizeResources(e,r,n){const{context:c}=e;if(!this._layerFBOTexture||this._size[0]!==r||this._size[1]!==n){if(this._size[0]=r,this._size[1]=n,this._layerFBOTexture)this._layerFBOTexture.resize(r,n);else{const e=new a(r,n);e.internalFormat=s.RGBA,e.wrapMode=i.CLAMP_TO_EDGE,this._layerFBOTexture=new o(c,e)}this._quad||(this._quad=new t(c,[-1,-1,1,-1,-1,1,1,1]))}}}export{n as Colorize};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{disposeMaybe as e}from"../../../../../../core/maybe.js";import{pt2px as t}from"../../../../../../core/screenUtils.js";import r from"../../VertexStream.js";import{BlendFactor as s,PixelFormat as i,TextureWrapMode as o}from"../../../../../webgl/enums.js";import{FramebufferObject as a}from"../../../../../webgl/FramebufferObject.js";import{Texture as n}from"../../../../../webgl/Texture.js";import{TextureDescriptor as l}from"../../../../../webgl/TextureDescriptor.js";const u=[1,0],h=[0,1];class _{constructor(){this._layerFBOTexture=null,this._horizontalBlurFBO=null,this._verticalBlurFBO=null,this._size=[0,0],this._quad=null,this._programDesc={blur:{vsPath:"post-processing/pp",fsPath:"post-processing/blur/gaussianBlur",attributes:new Map([["a_position",0]])},composite:{vsPath:"post-processing/pp",fsPath:"post-processing/drop-shadow/composite",attributes:new Map([["a_position",0]])},blit:{vsPath:"post-processing/pp",fsPath:"post-processing/blit",attributes:new Map([["a_position",0]])}}}dispose(){this._layerFBOTexture=e(this._layerFBOTexture),this._horizontalBlurFBO=e(this._horizontalBlurFBO),this._verticalBlurFBO=e(this._verticalBlurFBO)}draw(e,i,o){const{context:a,state:n,painter:l}=e,{materialManager:_}=l,c=this._programDesc,p=i.width,m=i.height,f=[Math.round(p),Math.round(m)],{blurRadius:B,offsetX:d,offsetY:b,color:O}=o,F=[t(d),t(b)];this._createOrResizeResources(e,p,m,f);const
|
|
5
|
+
import{disposeMaybe as e}from"../../../../../../core/maybe.js";import{pt2px as t}from"../../../../../../core/screenUtils.js";import r from"../../VertexStream.js";import{BlendFactor as s,PixelFormat as i,TextureWrapMode as o}from"../../../../../webgl/enums.js";import{FramebufferObject as a}from"../../../../../webgl/FramebufferObject.js";import{Texture as n}from"../../../../../webgl/Texture.js";import{TextureDescriptor as l}from"../../../../../webgl/TextureDescriptor.js";const u=[1,0],h=[0,1];class _{constructor(){this._layerFBOTexture=null,this._horizontalBlurFBO=null,this._verticalBlurFBO=null,this._size=[0,0],this._quad=null,this._programDesc={blur:{vsPath:"post-processing/pp",fsPath:"post-processing/blur/gaussianBlur",attributes:new Map([["a_position",0]])},composite:{vsPath:"post-processing/pp",fsPath:"post-processing/drop-shadow/composite",attributes:new Map([["a_position",0]])},blit:{vsPath:"post-processing/pp",fsPath:"post-processing/blit",attributes:new Map([["a_position",0]])}}}dispose(){this._layerFBOTexture=e(this._layerFBOTexture),this._horizontalBlurFBO=e(this._horizontalBlurFBO),this._verticalBlurFBO=e(this._verticalBlurFBO)}draw(e,i,o){const{context:a,state:n,painter:l}=e,{materialManager:_}=l,c=this._programDesc,p=i.width,m=i.height,f=[Math.round(p),Math.round(m)],{blurRadius:B,offsetX:d,offsetY:b,color:O}=o,F=[t(d),t(b)];this._createOrResizeResources(e,p,m,f);const T=this._horizontalBlurFBO,w=this._verticalBlurFBO;a.setStencilWriteMask(0),a.setStencilTestEnabled(!1),a.setDepthWriteEnabled(!1),a.setDepthTestEnabled(!1);const x=this._layerFBOTexture;i.copyToTexture(0,0,p,m,0,0,x),this._quad||(this._quad=new r(a,[-1,-1,1,-1,-1,1,1,1])),a.setViewport(0,0,f[0],f[1]);const g=this._quad;g.bind(),a.setBlendingEnabled(!1);const z=_.getProgram(c.blur,[{name:"radius",value:Math.ceil(B)}]);a.useProgram(z),a.bindFramebuffer(T),a.bindTexture(i.colorTexture,4),z.setUniform1i("u_colorTexture",4),z.setUniform2fv("u_texSize",f),z.setUniform2fv("u_direction",u),z.setUniform1f("u_sigma",B),g.draw(),a.bindFramebuffer(w),a.bindTexture(T?.colorTexture,5),z.setUniform1i("u_colorTexture",5),z.setUniform2fv("u_direction",h),g.draw(),a.bindFramebuffer(i),a.setViewport(0,0,p,m);const M=_.getProgram(c.composite);a.useProgram(M),a.bindTexture(w?.colorTexture,2),M.setUniform1i("u_blurTexture",2),a.bindTexture(x,3),M.setUniform1i("u_layerFBOTexture",3),M.setUniform4fv("u_shadowColor",[O[3]*(O[0]/255),O[3]*(O[1]/255),O[3]*(O[2]/255),O[3]]),M.setUniformMatrix3fv("u_displayViewMat3",n.displayMat3),M.setUniform2fv("u_shadowOffset",F),g.draw(),a.setBlendingEnabled(!0),a.setStencilTestEnabled(!0),a.setBlendFunction(s.ONE,s.ONE_MINUS_SRC_ALPHA),g.unbind()}_createOrResizeResources(e,t,r,s){const{context:u}=e;if(!this._horizontalBlurFBO||this._size[0]!==t||this._size[1]!==r){if(this._size[0]=t,this._size[1]=r,this._horizontalBlurFBO)this._horizontalBlurFBO.resize(s[0],s[1]);else{const e=new l(s[0],s[1]);e.internalFormat=i.RGBA,e.wrapMode=o.CLAMP_TO_EDGE,this._horizontalBlurFBO=new a(u,e)}if(this._verticalBlurFBO)this._verticalBlurFBO.resize(s[0],s[1]);else{const e=new l(s[0],s[1]);e.internalFormat=i.RGBA,e.wrapMode=o.CLAMP_TO_EDGE,this._verticalBlurFBO=new a(u,e)}if(this._layerFBOTexture)this._layerFBOTexture.resize(t,r);else{const e=new l(t,r);e.internalFormat=i.RGBA,e.wrapMode=o.CLAMP_TO_EDGE,this._layerFBOTexture=new n(u,e)}}}}export{_ as DropShadow};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{disposeMaybe as e}from"../../../../../../core/maybe.js";import{TextureSamplingMode as t,PixelFormat as r,TextureWrapMode as s}from"../../../../../webgl/enums.js";import{Texture as i}from"../../../../../webgl/Texture.js";import{TextureDescriptor as o}from"../../../../../webgl/TextureDescriptor.js";class l{constructor(){this._size=[0,0],this._layerFBOTexture=null}dispose(){this._layerFBOTexture=e(this._layerFBOTexture)}draw(e,r,s){const{width:i,height:o}=r;this._createOrResizeResources(e,i,o);const{context:l,painter:a}=e,{amount:n}=s,
|
|
5
|
+
import{disposeMaybe as e}from"../../../../../../core/maybe.js";import{TextureSamplingMode as t,PixelFormat as r,TextureWrapMode as s}from"../../../../../webgl/enums.js";import{Texture as i}from"../../../../../webgl/Texture.js";import{TextureDescriptor as o}from"../../../../../webgl/TextureDescriptor.js";class l{constructor(){this._size=[0,0],this._layerFBOTexture=null}dispose(){this._layerFBOTexture=e(this._layerFBOTexture)}draw(e,r,s){const{width:i,height:o}=r;this._createOrResizeResources(e,i,o);const{context:l,painter:a}=e,{amount:n}=s,u=l.gl,T=this._layerFBOTexture;l.bindFramebuffer(r),r.copyToTexture(0,0,i,o,0,0,T),l.setBlendingEnabled(!0),l.setStencilTestEnabled(!1),l.setDepthTestEnabled(!1),l.setClearColor(0,0,0,0),l.clear(u.COLOR_BUFFER_BIT),a.blitTexture(l,T,t.NEAREST,n)}_createOrResizeResources(e,l,a){const{context:n}=e;if(!this._layerFBOTexture||this._size[0]!==l||this._size[1]!==a)if(this._size[0]=l,this._size[1]=a,this._layerFBOTexture)this._layerFBOTexture.resize(l,a);else{const e=new o(l,a);e.internalFormat=r.RGBA,e.wrapMode=s.CLAMP_TO_EDGE,e.samplingMode=t.NEAREST,this._layerFBOTexture=new i(n,e)}}}export{l as Opacity};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{simplePipelineState as e}from"../../utils.js";import{Technique as t}from"../Technique.js";import{TechniqueType as r}from"../TechniqueType.js";import{BlendShader as s}from"../shaders/BlendShader.js";import{OpacityShader as
|
|
5
|
+
import{simplePipelineState as e}from"../../utils.js";import{Technique as t}from"../Technique.js";import{TechniqueType as r}from"../TechniqueType.js";import{BlendShader as s}from"../shaders/BlendShader.js";import{OpacityShader as u}from"../shaders/OpacityShader.js";import{BlendFactor as i,PixelFormat as o,TextureWrapMode as n}from"../../../../../../webgl/enums.js";import{Texture as a}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as c}from"../../../../../../webgl/TextureDescriptor.js";class f extends t{constructor(){super(...arguments),this.type=r.Blend,this._backBufferTexture=null,this.shaders={blend:new s,opacity:new u}}shutdown(){super.shutdown(),null!==this._backBufferTexture&&(this._backBufferTexture.dispose(),this._backBufferTexture=null)}render(t,r){const{context:s,state:u,pixelRatio:o,inFadeTransition:n,painter:a}=t,{size:c}=u,f=s.getBoundFramebufferObject();let l,h;null!=f?(l=f.width,h=f.height):(l=Math.round(o*c[0]),h=Math.round(o*c[1]));const{blendMode:d}=r;if("normal"===d){const t={shader:this.shaders.opacity,uniforms:{config:{layerTexture:{texture:r.colorTexture,unit:0},opacity:r.config.opacity}},defines:null,optionalAttributes:null,useComputeBuffer:!1};return a.setPipelineState(e),void a.submitDrawMesh(s,t,a.quadMesh)}const p=this._createOrResizeTexture(t,l,h);f.copyToTexture(0,0,l,h,0,0,p);const x={color:{write:[!0,!0,!0,!0],blendMode:"custom",blendParameters:{srcRGB:i.ONE,dstRGB:i.ZERO,srcAlpha:i.ONE,dstAlpha:i.ZERO}},depth:!1,stencil:!1};a.setPipelineState(x);const b={backbufferTexture:{texture:p,unit:0},layerTexture:{texture:r.colorTexture,unit:1},inFadeOpacity:n?1:0,...r.config},T={shader:this.shaders.blend,uniforms:{config:b},defines:{blendMode:d},optionalAttributes:null,useComputeBuffer:!1};a.submitDrawMesh(s,T,a.quadMesh)}_createOrResizeTexture(e,t,r){const{context:s}=e;if(null!==this._backBufferTexture&&this._backBufferTexture.descriptor?.width===t&&this._backBufferTexture.descriptor?.height===r)return this._backBufferTexture;if(null===this._backBufferTexture){const e=new c(t,r);e.internalFormat=o.RGBA,e.wrapMode=n.CLAMP_TO_EDGE,this._backBufferTexture=new a(s,e)}else this._backBufferTexture.resize(t,r);return this._backBufferTexture}}export{f as BlendTechnique};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../../../../../core/RandomLCG.js";import{tileSize as e}from"../../../definitions.js";import{SimpleMesh as s}from"../../../meshing/SimpleMesh.js";import{TextureSamplingMode as o,TextureWrapMode as r,SizedDepthStencilFormat as i,DataType as n,PrimitiveType as
|
|
5
|
+
import t from"../../../../../../../core/RandomLCG.js";import{tileSize as e}from"../../../definitions.js";import{SimpleMesh as s}from"../../../meshing/SimpleMesh.js";import{TextureSamplingMode as o,TextureWrapMode as r,SizedDepthStencilFormat as i,DataType as n,PrimitiveType as d,PixelType as h}from"../../../../../../webgl/enums.js";import{FramebufferObject as u}from"../../../../../../webgl/FramebufferObject.js";import{Renderbuffer as l}from"../../../../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as _}from"../../../../../../webgl/RenderbufferDescriptor.js";import{Texture as T}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as m}from"../../../../../../webgl/TextureDescriptor.js";const p={pos:{count:2,type:n.UNSIGNED_SHORT}};class f{constructor(){this._dotTextureSize=0,this._dotTextures=null,this._dotMesh=null}destroy(){this._disposeTextures(),this._dotFBO&&this._dotFBO.dispose(),this._dotMesh&&this._dotMesh.destroy()}getFBO(t){if(null==this._dotFBO){const s=e,n=e,d=new m(s,n);d.samplingMode=o.NEAREST,d.wrapMode=r.CLAMP_TO_EDGE;const h=new l(t,new _(i.DEPTH24_STENCIL8,s,n));this._dotFBO=new u(t,d,h)}return this._dotFBO}getDotDensityMesh(t){if(null==this._dotMesh){const o=e,r=o*o,i=2,n=new Int16Array(r*i);for(let t=0;t<o;t++)for(let e=0;e<o;e++)n[i*(e+t*o)]=e,n[i*(e+t*o)+1]=t;this._dotMesh=s.create(t,{primitive:d.POINTS,vertex:n,count:r,layout:p})}return this._dotMesh}getDotDensityTextures(e,s,o){if(this._dotTextureSize===s&&this._seed===o||(this._disposeTextures(),this._dotTextureSize=s,this._seed=o),null===this._dotTextures){const r=new t(o);this._dotTextures=[this._allocDotDensityTexture(e,s,r),this._allocDotDensityTexture(e,s,r)]}return this._dotTextures}_disposeTextures(){if(this._dotTextures){for(let t=0;t<this._dotTextures.length;t++)this._dotTextures[t].dispose();this._dotTextures=null}}_allocDotDensityTexture(t,e,s){const r=new Float32Array(e*e*4);for(let o=0;o<r.length;o++)r[o]=s.getFloat();const i=new m(e);return i.dataType=h.FLOAT,i.samplingMode=o.NEAREST,new T(t,i,r)}}export{f as DotDensityResources};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clamp as e}from"../../../../../../../core/mathUtils.js";import{disposeMaybe as t}from"../../../../../../../core/maybe.js";import{isSVG as i}from"../../../../../../../core/urlUtils.js";import{simplePipelineState as r}from"../../utils.js";import{Technique as s}from"../Technique.js";import{TechniqueType as o}from"../TechniqueType.js";import{MagnifierShader as a}from"../shaders/MagnifierShader.js";import{PixelFormat as
|
|
5
|
+
import{clamp as e}from"../../../../../../../core/mathUtils.js";import{disposeMaybe as t}from"../../../../../../../core/maybe.js";import{isSVG as i}from"../../../../../../../core/urlUtils.js";import{simplePipelineState as r}from"../../utils.js";import{Technique as s}from"../Technique.js";import{TechniqueType as o}from"../TechniqueType.js";import{MagnifierShader as a}from"../shaders/MagnifierShader.js";import{PixelFormat as u,TextureWrapMode as n,TextureSamplingMode as l}from"../../../../../../webgl/enums.js";import{Texture as h}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as p}from"../../../../../../webgl/TextureDescriptor.js";class c extends s{constructor(){super(...arguments),this.type=o.Magnifier,this._resourcePixelRatio=1,this._position=[0,0,0,0],this.shaders={magnifier:new a}}updateResources(t,i,r,s){t.pixelRatio!==this._resourcePixelRatio&&this._destroyResources(),this._readbackTexture||this._initializeResources(t,i,r,s);const{context:o,pixelRatio:a}=t,{factor:u,offset:n,position:l}=s,{size:h}=t.state,p=s.size*a,c=1/u,x=Math.ceil(c*p);this._readbackTexture.resize(x,x);const m=a*h[0],d=a*h[1],_=.5*x,T=.5*x,f=e(a*l.x,_,m-_-1),R=e(d-a*l.y,T,d-T-1),g=f-_,b=R-T,y=this._readbackTexture;o.bindTexture(y,0),o.gl.copyTexImage2D(y.descriptor.target,0,y.descriptor.pixelFormat,g,b,x,x,0);const w=(f+n.x*a)/m*2-1,k=(R-n.y*a)/d*2-1,M=p/m*2,j=p/d*2;this._position[0]=w,this._position[1]=k,this._position[2]=M,this._position[3]=j}render(e,t){const{context:i,painter:s}=e;s.setPipelineState(r);const o={readbackTexture:{texture:this._readbackTexture,unit:0},maskTexture:{texture:this._maskTexture,unit:7},overlayTexture:{texture:this._overlayTexture,unit:6},drawPos:this._position,...t};s.submitDrawMesh(i,{shader:this.shaders.magnifier,uniforms:{config:o},defines:null,optionalAttributes:null,useComputeBuffer:!1},s.quadMesh)}shutdown(){this._destroyResources()}_initializeResources(e,t,r,s){const o=e.context;this._resourcePixelRatio=e.pixelRatio;const a=Math.ceil(s.size*e.pixelRatio);r.width=a,r.height=a;const c=new p(Math.ceil(a/s.factor));c.internalFormat=u.RGBA,c.wrapMode=n.CLAMP_TO_EDGE,c.samplingMode=l.NEAREST,c.flipped=!0,c.preMultiplyAlpha=!i(r.src)||!e.context.driverTest.svgPremultipliesAlpha.result,this._overlayTexture=new h(o,c,r),t.width=a,t.height=a,c.pixelFormat=c.internalFormat=u.ALPHA,this._maskTexture=new h(o,c,t),c.pixelFormat=c.internalFormat=u.RGBA,c.samplingMode=l.LINEAR,c.flipped=!1,this._readbackTexture=new h(o,c)}_destroyResources(){t(this._maskTexture),t(this._overlayTexture),t(this._readbackTexture),this._maskTexture=null,this._overlayTexture=null,this._readbackTexture=null}}export{c as MagnifierTechnique};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{SizedPixelFormat as e,TextureSamplingMode as r,PixelType as t,TextureWrapMode as n}from"../../../../../../../webgl/enums.js";import{FramebufferObject as o}from"../../../../../../../webgl/FramebufferObject.js";import{Texture as m}from"../../../../../../../webgl/Texture.js";import{TextureDescriptor as
|
|
5
|
+
import{SizedPixelFormat as e,TextureSamplingMode as r,PixelType as t,TextureWrapMode as n}from"../../../../../../../webgl/enums.js";import{FramebufferObject as o}from"../../../../../../../webgl/FramebufferObject.js";import{Texture as m}from"../../../../../../../webgl/Texture.js";import{TextureDescriptor as s}from"../../../../../../../webgl/TextureDescriptor.js";function u(o,m){const u=new s(o,m);return u.internalFormat=e.RGBA32F,u.samplingMode=r.NEAREST,u.dataType=t.FLOAT,u.isImmutable=!0,u.wrapMode=n.CLAMP_TO_EDGE,u}function i(e,r,t){const n=u(r,t);return new m(e,n)}function a(e,r,t){const n=u(r,t);return new o(e,n)}export{a as createNewFBO,i as createProcessedTexture};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{watch as r,initial as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{watch as r,initial as s}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{copy as o}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{InternalRenderCategory as n}from"../webgl.js";import{S as a}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as p}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as c,SimpleAtmosphereGeometry as f}from"./SimpleAtmosphereTechniqueConfiguration.js";import{earthAtmosphereTextureSimple as l}from"./resources/SimpleAtmosphereTexture.js";import{glLayout as u}from"../support/buffer/glUtil.js";import{newLayout as h}from"../support/buffer/InterleavedLayout.js";import{OpaqueEnvironment as b}from"../webgl-engine/effects/OpaqueEnvironment.js";import{RenderRequestType as g}from"../webgl-engine/lib/basicInterfaces.js";import{Default3D as j}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createPolySphereData as _}from"../webgl-engine/lib/GeometryUtil.js";import{VertexArrayObject as d}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as w}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as v}from"../../webgl/BufferObject.js";import{TextureWrapMode as x,PrimitiveType as A,Usage as T}from"../../webgl/enums.js";import{Texture as P}from"../../webgl/Texture.js";import{TextureDescriptor as y}from"../../webgl/TextureDescriptor.js";import{vertexCount as C}from"../../webgl/Util.js";let E=class extends b{constructor(){super(...arguments),this._configuration=new c,this._passParameters=new a,this._vao=null,this._vaoCount=0}initialize(){this._configuration.geometry=f.Cylinder,this.addHandles([r((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),s)])}destroy(){this._passParameters.texture=t(this._passParameters.texture),this._vao=t(this._vao)}precompile(){this.techniques.precompile(p,this._configuration)}render(e){const t=e.find((({name:e})=>e===n.OPAQUE_ENVIRONMENT)),r=this.techniques.get(p,this._configuration);if(!r.compiled)return this.requestRender(g.UPDATE),t;const s=this.renderingContext;if(this._vao||(this._vao=O(s),this._vaoCount=C(this._vao,"geometry")),!this._passParameters.texture){const e=new y(1,512);e.wrapMode=x.CLAMP_TO_EDGE,e.flipped=!0,this._passParameters.texture=new P(s,e,l)}const i=s.bindTechnique(r,this.bindParameters,this._passParameters);return S(L,this.bindParameters.camera.viewMatrix),i.setUniformMatrix4fv("view",L),s.bindVAO(this._vao),i.assertCompatibleVertexAttributeLocations(this._vao),s.drawArrays(A.TRIANGLES,0,this._vaoCount),t}};function O(e){const t=_(1,2,!1),{data:r,indices:s}=t[0][1],i=q.createBuffer(s.length),o=i.position;for(let m=0;m<s.length;++m){const e=3*s[m%3==0?m+2:m%3==2?m-2:m];o.set(m,0,r[e]),o.set(m,1,r[e+1]),o.set(m,2,r[e+2])}return new d(e,j,new Map([["geometry",u(q)]]),new Map([["geometry",v.createVertex(e,T.STATIC_DRAW,i.buffer)]]))}function S(e,t){o(e,t),e[12]=0,e[13]=0,e[14]=0,e[15]=1}E=e([i("esri.views.3d.environment.LocalAtmosphere")],E);const L=m(),q=h().vec3f(w.POSITION);export{E as LocalAtmosphere};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{lerp as t,clamp as r}from"../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import{watch as i,initial as o}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{lookAt as n}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{l as p,g as c,f as u,j as l,h as f,k as _}from"../../../chunks/vec32.js";import{create as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{newFloatArray as b}from"../../../geometry/support/FloatArray.js";import{InternalRenderCategory as j}from"../webgl.js";import{computeInnerAltitudeFade as x}from"./atmosphereUtils.js";import{S as V}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as w}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as v,SimpleAtmosphereGeometry as A}from"./SimpleAtmosphereTechniqueConfiguration.js";import{marsAtmosphereTextureSimple as P}from"./resources/MarsAtmosphereTexture.js";import{makePiecewiseLinearFunction as R}from"../support/mathUtils.js";import{glLayout as y}from"../support/buffer/glUtil.js";import{newLayout as S}from"../support/buffer/InterleavedLayout.js";import{OpaqueEnvironment as T}from"../webgl-engine/effects/OpaqueEnvironment.js";import{RenderRequestType as M}from"../webgl-engine/lib/basicInterfaces.js";import{Default3D as U}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as q}from"../webgl-engine/lib/glUtil3D.js";import{project as F}from"../webgl-engine/lib/Util.js";import{VertexArrayObject as C}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as E}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as O}from"../../webgl/BufferObject.js";import{TextureWrapMode as I,PrimitiveType as D,Usage as L}from"../../webgl/enums.js";import{Texture as N}from"../../webgl/Texture.js";import{TextureDescriptor as W}from"../../webgl/TextureDescriptor.js";import{vertexCount as k}from"../../webgl/Util.js";const G=128,B=-1e4,z=0,H=50,Q=()=>1-511/512,J=R([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);let K=class extends T{constructor(e){super(e),this._passParameters=new V,this._configuration=new v,this._vao=null,this._vaoCount=0,this._fadeVao=null,this._fadeVaoCount=0,this._texV1=1;const t=e.view,r=g(t.spatialReference),{outerAtmosphereRimWidth:s,radius:i}=r;this._planetRadius=i,this._innerRimFactor=1+B/i,this._middleRimFactor=1+z/i,this._outerRimFactor=1+s/i,this._texV0=z/s,this._texVScale=this._texV1-this._texV0;const o=t.stage.renderView.techniques;o.precompile(w,this._configuration),this._configuration.geometry=A.Underground,o.precompile(w,this._configuration)}initialize(){this.addHandles(i((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),o))}destroy(){this._passParameters.texture=s(this._passParameters.texture),this._fadeVao=s(this._fadeVao),this._vao=s(this._vao)}render(e){const t=e.find((({name:e})=>e===j.OPAQUE_ENVIRONMENT));this._update();const r=this.renderingContext;if(!this._passParameters.texture){const e=new W;e.wrapMode=I.CLAMP_TO_EDGE,e.flipped=!0,
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{lerp as t,clamp as r}from"../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import{watch as i,initial as o}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{lookAt as n}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{l as p,g as c,f as u,j as l,h as f,k as _}from"../../../chunks/vec32.js";import{create as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{newFloatArray as b}from"../../../geometry/support/FloatArray.js";import{InternalRenderCategory as j}from"../webgl.js";import{computeInnerAltitudeFade as x}from"./atmosphereUtils.js";import{S as V}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as w}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as v,SimpleAtmosphereGeometry as A}from"./SimpleAtmosphereTechniqueConfiguration.js";import{marsAtmosphereTextureSimple as P}from"./resources/MarsAtmosphereTexture.js";import{makePiecewiseLinearFunction as R}from"../support/mathUtils.js";import{glLayout as y}from"../support/buffer/glUtil.js";import{newLayout as S}from"../support/buffer/InterleavedLayout.js";import{OpaqueEnvironment as T}from"../webgl-engine/effects/OpaqueEnvironment.js";import{RenderRequestType as M}from"../webgl-engine/lib/basicInterfaces.js";import{Default3D as U}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as q}from"../webgl-engine/lib/glUtil3D.js";import{project as F}from"../webgl-engine/lib/Util.js";import{VertexArrayObject as C}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as E}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as O}from"../../webgl/BufferObject.js";import{TextureWrapMode as I,PrimitiveType as D,Usage as L}from"../../webgl/enums.js";import{Texture as N}from"../../webgl/Texture.js";import{TextureDescriptor as W}from"../../webgl/TextureDescriptor.js";import{vertexCount as k}from"../../webgl/Util.js";const G=128,B=-1e4,z=0,H=50,Q=()=>1-511/512,J=R([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);let K=class extends T{constructor(e){super(e),this._passParameters=new V,this._configuration=new v,this._vao=null,this._vaoCount=0,this._fadeVao=null,this._fadeVaoCount=0,this._texV1=1;const t=e.view,r=g(t.spatialReference),{outerAtmosphereRimWidth:s,radius:i}=r;this._planetRadius=i,this._innerRimFactor=1+B/i,this._middleRimFactor=1+z/i,this._outerRimFactor=1+s/i,this._texV0=z/s,this._texVScale=this._texV1-this._texV0;const o=t.stage.renderView.techniques;o.precompile(w,this._configuration),this._configuration.geometry=A.Underground,o.precompile(w,this._configuration)}initialize(){this.addHandles(i((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),o))}destroy(){this._passParameters.texture=s(this._passParameters.texture),this._fadeVao=s(this._fadeVao),this._vao=s(this._vao)}render(e){const t=e.find((({name:e})=>e===j.OPAQUE_ENVIRONMENT));this._update();const r=this.renderingContext;if(!this._passParameters.texture){const e=new W(1,512);e.wrapMode=I.CLAMP_TO_EDGE,e.flipped=!0,this._passParameters.texture=new N(r,e,P)}if(this._passParameters.undergroundFadeAlpha<1){this._vao||(this._vao=this._createRibbon(r),this._vaoCount=k(this._vao,"geometry")),this._configuration.geometry=A.Cone;const e=this.techniques.get(w,this._configuration);if(!e.compiled)return this.requestRender(M.UPDATE),t;r.bindTechnique(e,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(D.TRIANGLES,0,this._vaoCount)}if(this._passParameters.undergroundFadeAlpha>0){this._fadeVao||(this._fadeVao=q(r),this._fadeVaoCount=k(this._fadeVao,"geometry")),this._configuration.geometry=A.Underground;const e=this.techniques.get(w,this._configuration);if(!e.compiled)return this.requestRender(M.UPDATE),t;r.bindTechnique(e,this.bindParameters,this._passParameters),r.bindVAO(this._fadeVao),r.drawArrays(D.TRIANGLE_STRIP,0,this._fadeVaoCount)}return t}_update(){const e=this.bindParameters.camera,s=d(),i=this._planetRadius,o=p(e.eye),a=o-i;if(a<0){const e=Math.min(-a/5e3,1);this._passParameters.undergroundFadeAlpha=e}else this._passParameters.undergroundFadeAlpha=0;const n=Math.max(H,a),m=i+B;this._passParameters.innerScale=ee(i+n,i,m)-1,this._passParameters.altitudeFade=x(a),c(s,e.eye,(i+H)/o),X(s,e.center,e.up,i,this._passParameters.silhouette);const u=this._computeScreenRimWidth(e,s,e.up,this._passParameters.silhouette),l=Q(),f=J(a);let _=this._texV0+l*this._texVScale,g=this._texV0+u*f*this._texVScale;if(a>H){X(e.eye,e.center,e.up,i,this._passParameters.silhouette);const s=this._computeScreenRimWidth(e,e.eye,e.up,this._passParameters.silhouette),o=r((s-1.5)/(u-1.5),0,1);_=this._texV0+o*l*this._texVScale,g=this._texV0+t(this._texV1,u*f,o)*this._texVScale}h(this._passParameters.texV,_,g)}_createRibbon(e){const t=b(3+3*G*3),r=new Uint32Array(3*G*5);t[0]=0,t[1]=0,t[2]=-1;for(let o=0;o<G;o++){const e=9*o+3;t[e]=o,t[e+1]=this._innerRimFactor,t[e+2]=-1,t[e+3]=o,t[e+4]=this._middleRimFactor,t[e+5]=0,t[e+6]=o,t[e+7]=this._outerRimFactor,t[e+8]=1;const s=3*o+1,i=o===G-1?1:s+3,a=15*o;r[a]=s,r[a+1]=s+1,r[a+2]=i+1,r[a+3]=i+1,r[a+4]=i,r[a+5]=s,r[a+6]=s+1,r[a+7]=s+2,r[a+8]=i+2,r[a+9]=i+2,r[a+10]=i+1,r[a+11]=s+1,r[a+12]=s,r[a+13]=i,r[a+14]=0}const s=te.createBuffer(r.length),i=s.position;for(let o=0;o<r.length;++o){const e=3*r[o];i.set(o,0,t[e]),i.set(o,1,t[e+1]),i.set(o,2,t[e+2])}return new C(e,U,new Map([["geometry",y(te)]]),new Map([["geometry",O.createVertex(e,L.STATIC_DRAW,s.buffer)]]))}_computeScreenRimWidth(e,t,r,s){return u(Z,s.center,s.v2),c($,Z,this._outerRimFactor),n(Y,t,Z,r),F(Z,Y,e.projectionMatrix,e.viewport,Z),F($,Y,e.projectionMatrix,e.viewport,$),l(Z,$)/e.height}};function X(e,t,r,s,i){const o=p(e),a=s*Math.sqrt(o*o-s*s)/o,n=Math.sqrt(s*s-a*a),m=i.v1,h=i.v2;return c(i.center,e,n/o),f(m,e,t),_(m)<1&&f(m,e,r),c(m,m,a/p(m)),f(h,m,e),c(h,h,a/p(h)),a}K=e([a("esri.views.3d.environment.MarsAtmosphere")],K);const Y=m(),Z=d(),$=d();function ee(e,t,r){return e*e/(Math.sqrt(e*e-t*t)*Math.sqrt(e*e-r*r)+t*r)}const te=S().vec3f(E.POSITION),re=K;export{re as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{createPrimitive as r}from"./sdfPrimitives.js";import{PixelFormat as e,TextureWrapMode as t}from"../../../webgl/enums.js";import{Texture as o}from"../../../webgl/Texture.js";import{TextureDescriptor as
|
|
5
|
+
import{createPrimitive as r}from"./sdfPrimitives.js";import{PixelFormat as e,TextureWrapMode as t}from"../../../webgl/enums.js";import{Texture as o}from"../../../webgl/Texture.js";import{TextureDescriptor as m}from"../../../webgl/TextureDescriptor.js";const s=64,i=s/2,n=i/5,p=s/n,f=.25;function u(p,f){const u=r(p,s,i,n),w=new m(s);return w.internalFormat=e.RGBA,w.wrapMode=t.CLAMP_TO_EDGE,new o(f,w,u)}export{u as createMarkerTexture,p as markerSizePerLineWidth,i as markerSymbolSize,s as markerTextureSize,n as markerThickness,f as markerTipThicknessFactor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{createTask as s}from"../../../../../core/asyncUtils.js";import{clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as t,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{createScreenPointArray as o,createRenderScreenPointArray as m,screenPointObjectToArray as n}from"../../../../../core/screenUtils.js";import{isSVG as h}from"../../../../../core/urlUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as p}from"../../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as u}from"../../../../../support/requestImageUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import _ from"../../../webgl/RenderNode.js";import{MagnifierTechnique as g}from"./MagnifierTechnique.js";import{RenderRequestType as d}from"../../lib/basicInterfaces.js";import{Default3D as f}from"../../lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as T,Layout as v}from"../../lib/glUtil3D.js";import{M as P}from"../../../../../chunks/Magnifier.glsl.js";import{loadMagnifierResources as k}from"../../../../magnifier/resources.js";import{PrimitiveType as b,PixelFormat as y,TextureWrapMode as j}from"../../../../webgl/enums.js";import{Texture as x}from"../../../../webgl/Texture.js";import{TextureDescriptor as R}from"../../../../webgl/TextureDescriptor.js";let S=class extends _{constructor(){super(...arguments),this.produces=c.MAGNIFIER,this.consumes={required:[c.MAGNIFIER]},this._imageSources=null,this._imageLoadTask=null,this._passParameters=new P,this._vao=null,this._magnifier=null,this._tmpScreenPoint=o(),this._tmpRenderPoint=m()}initialize(){this.addHandles([t((()=>this.view.magnifier),(e=>this._update(e)),a)])}_update(e){if(e===this._magnifier)return;this.removeAllHandles(),this._magnifier=e;const s=()=>{const e=this._validMagnifier;e?(this._loadResources(e),this.produces=c.MAGNIFIER):this.produces="disabled",this.requestRender()};this._magnifier&&this.addHandles(t((()=>this._magnifier?.version),s)),s()}get _validMagnifier(){return this._magnifier?.visible&&this._magnifier?.position&&this._magnifier?.size>0?this._magnifier:null}get _factor(){return this._magnifier?.factor||1}destroy(){this._magnifier=null,null!=this._imageLoadTask&&(this._imageLoadTask.task.abort(),this._imageLoadTask=null),this._disposeTextures(),this._vao=i(this._vao)}_disposeTextures(){this._passParameters.mask=i(this._passParameters.mask),this._passParameters.overlay=i(this._passParameters.overlay),this._passParameters.input=i(this._passParameters.input)}precompile(){this._imageSources&&this.techniques.precompile(g)}render(e){const s=this._validMagnifier,i=e.find((({name:e})=>e===c.MAGNIFIER));if(null==s)return i;if(null==this._imageSources)return this.requestRender(d.UPDATE),i;const t=this.renderingContext,a=this.camera.pixelRatio,o=Math.ceil(a*s.size);this._vao??=T(t,v.Pos2,f,0,1);const m=this.techniques.get(g);if(this._ensureTextureResources(t,o),!m.compiled||!this._passParameters.input)return this.requestRender(d.UPDATE),i;const h=Math.ceil(1/this._factor*o),l=this._passParameters.input;l.resize(h,h),n(s.position,this._tmpScreenPoint);const p=this.camera.screenToRender(this._tmpScreenPoint,this._tmpRenderPoint),u=this.camera.fullWidth,_=this.camera.fullHeight,P=.5*h,k=.5*h;p[0]=r(p[0],P,u-P-1),p[1]=r(p[1],k,_-k-1);const y=Math.floor(p[0]-P),j=Math.floor(p[1]-k);t.bindFramebuffer(i.fbo);return m.program.bindTexture("textureInput",l),t.gl.copyTexImage2D(l.descriptor.target,0,l.descriptor.pixelFormat,y,j,h,h,0),this._passParameters.magnifier=s,t.bindTechnique(m,this.bindParameters,this._passParameters),t.bindVAO(this._vao),t.drawArrays(b.TRIANGLE_STRIP,0,4),i}_loadResources(e){const{maskUrl:r,overlayUrl:i}=e;this._imageLoadTask?.maskUrl===r&&this._imageLoadTask?.overlayUrl===i||(this._imageLoadTask?.task.abort(),this._imageLoadTask=this._imageSources=null),this._imageSources||this._imageLoadTask||(this._imageLoadTask={maskUrl:r,overlayUrl:i,task:s((async e=>{const s=null==r||null==i?k(e):null,t=null!=r?u(r,{signal:e}):s.then((e=>e.mask)),a=null!=i?u(i,{signal:e}):s.then((e=>e.overlay));this._imageSources={mask:await t,overlay:await a}}))})}_ensureTextureResources(e,s){null==this._imageSources||this._passParameters.size===s&&this._passParameters.input&&this._passParameters.mask&&this._passParameters.overlay||(this._disposeTextures(),this._imageSources.overlay.width=this._imageSources.mask.width=s,this._imageSources.overlay.height=this._imageSources.mask.height=s,this._passParameters.overlay=new x(e,this._createTextureDescriptor(s,y.RGBA,this._imageSources.overlay),this._imageSources.overlay),this._passParameters.mask=new x(e,this._createTextureDescriptor(s,y.ALPHA,this._imageSources.mask),this._imageSources.mask),this._passParameters.input=new x(e,this._createTextureDescriptor(s,y.RGBA,null)))}_createTextureDescriptor(e,s,r){const i=this.renderingContext,t=new R(e
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{createTask as s}from"../../../../../core/asyncUtils.js";import{clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as t,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{createScreenPointArray as o,createRenderScreenPointArray as m,screenPointObjectToArray as n}from"../../../../../core/screenUtils.js";import{isSVG as h}from"../../../../../core/urlUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as p}from"../../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as u}from"../../../../../support/requestImageUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import _ from"../../../webgl/RenderNode.js";import{MagnifierTechnique as g}from"./MagnifierTechnique.js";import{RenderRequestType as d}from"../../lib/basicInterfaces.js";import{Default3D as f}from"../../lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as T,Layout as v}from"../../lib/glUtil3D.js";import{M as P}from"../../../../../chunks/Magnifier.glsl.js";import{loadMagnifierResources as k}from"../../../../magnifier/resources.js";import{PrimitiveType as b,PixelFormat as y,TextureWrapMode as j}from"../../../../webgl/enums.js";import{Texture as x}from"../../../../webgl/Texture.js";import{TextureDescriptor as R}from"../../../../webgl/TextureDescriptor.js";let S=class extends _{constructor(){super(...arguments),this.produces=c.MAGNIFIER,this.consumes={required:[c.MAGNIFIER]},this._imageSources=null,this._imageLoadTask=null,this._passParameters=new P,this._vao=null,this._magnifier=null,this._tmpScreenPoint=o(),this._tmpRenderPoint=m()}initialize(){this.addHandles([t((()=>this.view.magnifier),(e=>this._update(e)),a)])}_update(e){if(e===this._magnifier)return;this.removeAllHandles(),this._magnifier=e;const s=()=>{const e=this._validMagnifier;e?(this._loadResources(e),this.produces=c.MAGNIFIER):this.produces="disabled",this.requestRender()};this._magnifier&&this.addHandles(t((()=>this._magnifier?.version),s)),s()}get _validMagnifier(){return this._magnifier?.visible&&this._magnifier?.position&&this._magnifier?.size>0?this._magnifier:null}get _factor(){return this._magnifier?.factor||1}destroy(){this._magnifier=null,null!=this._imageLoadTask&&(this._imageLoadTask.task.abort(),this._imageLoadTask=null),this._disposeTextures(),this._vao=i(this._vao)}_disposeTextures(){this._passParameters.mask=i(this._passParameters.mask),this._passParameters.overlay=i(this._passParameters.overlay),this._passParameters.input=i(this._passParameters.input)}precompile(){this._imageSources&&this.techniques.precompile(g)}render(e){const s=this._validMagnifier,i=e.find((({name:e})=>e===c.MAGNIFIER));if(null==s)return i;if(null==this._imageSources)return this.requestRender(d.UPDATE),i;const t=this.renderingContext,a=this.camera.pixelRatio,o=Math.ceil(a*s.size);this._vao??=T(t,v.Pos2,f,0,1);const m=this.techniques.get(g);if(this._ensureTextureResources(t,o),!m.compiled||!this._passParameters.input)return this.requestRender(d.UPDATE),i;const h=Math.ceil(1/this._factor*o),l=this._passParameters.input;l.resize(h,h),n(s.position,this._tmpScreenPoint);const p=this.camera.screenToRender(this._tmpScreenPoint,this._tmpRenderPoint),u=this.camera.fullWidth,_=this.camera.fullHeight,P=.5*h,k=.5*h;p[0]=r(p[0],P,u-P-1),p[1]=r(p[1],k,_-k-1);const y=Math.floor(p[0]-P),j=Math.floor(p[1]-k);t.bindFramebuffer(i.fbo);return m.program.bindTexture("textureInput",l),t.gl.copyTexImage2D(l.descriptor.target,0,l.descriptor.pixelFormat,y,j,h,h,0),this._passParameters.magnifier=s,t.bindTechnique(m,this.bindParameters,this._passParameters),t.bindVAO(this._vao),t.drawArrays(b.TRIANGLE_STRIP,0,4),i}_loadResources(e){const{maskUrl:r,overlayUrl:i}=e;this._imageLoadTask?.maskUrl===r&&this._imageLoadTask?.overlayUrl===i||(this._imageLoadTask?.task.abort(),this._imageLoadTask=this._imageSources=null),this._imageSources||this._imageLoadTask||(this._imageLoadTask={maskUrl:r,overlayUrl:i,task:s((async e=>{const s=null==r||null==i?k(e):null,t=null!=r?u(r,{signal:e}):s.then((e=>e.mask)),a=null!=i?u(i,{signal:e}):s.then((e=>e.overlay));this._imageSources={mask:await t,overlay:await a}}))})}_ensureTextureResources(e,s){null==this._imageSources||this._passParameters.size===s&&this._passParameters.input&&this._passParameters.mask&&this._passParameters.overlay||(this._disposeTextures(),this._imageSources.overlay.width=this._imageSources.mask.width=s,this._imageSources.overlay.height=this._imageSources.mask.height=s,this._passParameters.overlay=new x(e,this._createTextureDescriptor(s,y.RGBA,this._imageSources.overlay),this._imageSources.overlay),this._passParameters.mask=new x(e,this._createTextureDescriptor(s,y.ALPHA,this._imageSources.mask),this._imageSources.mask),this._passParameters.input=new x(e,this._createTextureDescriptor(s,y.RGBA,null)))}_createTextureDescriptor(e,s,r){const i=this.renderingContext,t=new R(e);return t.pixelFormat=t.internalFormat=s,t.wrapMode=j.CLAMP_TO_EDGE,t.flipped=!!r,t.preMultiplyAlpha=!(s!==y.RGBA||!r||h(r.src)&&i.driverTest.svgPremultipliesAlpha.result),t}};e([l()],S.prototype,"produces",void 0),e([l()],S.prototype,"consumes",void 0),e([l()],S.prototype,"_imageSources",void 0),e([l()],S.prototype,"_imageLoadTask",void 0),S=e([p("esri.views.3d.webgl-engine.effects.magnifier.Magnifier")],S);export{S as Magnifier};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{watch as s,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as n}from"../../../../../support/requestImageUtils.js";import{RenderCategory as c,InternalRenderCategory as
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{watch as s,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as n}from"../../../../../support/requestImageUtils.js";import{RenderCategory as c,InternalRenderCategory as m}from"../../../webgl.js";import u from"../../../webgl/RenderNode.js";import{ColorFormat as h}from"../../core/FBOCacheFormats.js";import{SMAABlendWeightsTechnique as l}from"./SMAABlendWeightsTechnique.js";import{SMAABlurTechnique as p}from"./SMAABlurTechnique.js";import{SMAAEdgeDetectTechnique as d}from"./SMAAEdgeDetectTechnique.js";import{SMAAPassParameters as f}from"./SMAAPassParameters.js";import{RenderRequestType as T}from"../../lib/basicInterfaces.js";import{PixelFormat as b,TextureSamplingMode as x,FramebufferBit as _,TextureWrapMode as A}from"../../../../webgl/enums.js";import{Texture as g}from"../../../../webgl/Texture.js";import{TextureDescriptor as C}from"../../../../webgl/TextureDescriptor.js";let j=class extends u{constructor(e){super(e),this.produces="disabled",this.consumes={required:[m.ANTIALIASING],optional:[c.COMPOSITE]},this._areaTexture=null,this._searchTexture=null,this._smaaParameters=new f}initialize(){this.addHandles([s((()=>this.isEnabled()),(e=>e?this.enable():this.disable()),i)])}async enable(){if(this.produces=m.ANTIALIASING,this._abortController||this._areaTexture&&this._searchTexture)return;this._abortController=new AbortController;const e=this._abortController.signal;try{const r=await import("./SMAAData.js");await this._loadTextures(r,e),this.requestRender(T.UPDATE)}catch{}this._abortController=null}async _loadTextures(e,r){t(r);const[s,i]=await Promise.allSettled([n(e.areaTexture,{signal:r}),n(e.searchTexure,{signal:r})]);if(t(r),"fulfilled"!==s.status||"fulfilled"!==i.status)return;const a=this.renderingContext;this._areaTexture=w(a,x.LINEAR,b.RGB,s.value),this._searchTexture=w(a,x.NEAREST,b.LUMINANCE,i.value)}disable(){this.produces="disabled"}destroy(){this._searchTexture=r(this._searchTexture),this._areaTexture=r(this._areaTexture)}precompile(){this.techniques.precompile(d),this.techniques.precompile(l),this.techniques.precompile(p)}render(e){const r=e.find((({name:e})=>e===m.ANTIALIASING));if(!this._areaTexture||!this._searchTexture)return this.requestRender(T.UPDATE),r;const t=this.techniques.get(d),s=this.techniques.get(l),i=this.techniques.get(p);if(!t.compiled||!s.compiled||!i.compiled)return this.requestRender(T.UPDATE),r;const a=e.find((({name:e})=>e===c.COMPOSITE));if(!a)return r;const o=a.fbo.width,n=a.fbo.height,u=this.renderingContext;u.setViewport(0,0,o,n);const f=this.fboCache.acquire(o,n,"smaa edges",h.RG8UNORM);u.bindFramebuffer(f.fbo),u.setClearColor(0,0,0,1),u.clear(_.COLOR),this._smaaParameters.color=a.getTexture();const b=this.bindParameters;u.bindTechnique(t,b,this._smaaParameters),u.screen.draw();const x=this.fboCache.acquire(o,n,"smaa blend");return u.bindFramebuffer(x.fbo),u.setClearColor(0,0,1,1),u.clear(_.COLOR),this._smaaParameters.inputTexture=f.getTexture(),this._smaaParameters.areaTexture=this._areaTexture,this._smaaParameters.searchTexture=this._searchTexture,u.bindTechnique(s,b,this._smaaParameters),u.screen.draw(),f.release(),u.bindFramebuffer(r.fbo),u.setClearColor(0,1,0,1),u.clear(_.COLOR),this._smaaParameters.inputTexture=x.getTexture(),u.bindTechnique(i,b,this._smaaParameters),u.screen.draw(),x.release(),r}};function w(e,r,t,s){const i=new C(s.width,s.height);return i.pixelFormat=t,i.wrapMode=A.CLAMP_TO_EDGE,i.samplingMode=r,new g(e,i,s)}e([a()],j.prototype,"produces",void 0),e([a()],j.prototype,"consumes",void 0),e([a({constructOnly:!0})],j.prototype,"isEnabled",void 0),e([a()],j.prototype,"_abortController",void 0),j=e([o("esri.views.3d.webgl-engine.effects.smaa.SMAA")],j);export{j as SMAA};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{watch as t}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as n}from"../../../webgl.js";import c from"../../../webgl/RenderNode.js";import{ColorFormat as p}from"../../core/FBOCacheFormats.js";import{distanceFadeEnd as h,distanceFadeStart as u}from"../../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{SSAOBlurTechnique as l}from"./SSAOBlurTechnique.js";import{noiseData as d}from"./SSAONoiseData.js";import{SSAOPassParameters as f,BlurDrawParameters as b}from"./SSAOParameters.js";import{SSAOTechnique as w}from"./SSAOTechnique.js";import{RenderRequestType as T}from"../../lib/basicInterfaces.js";import{g as _}from"../../../../../chunks/SSAO.glsl.js";import{TextureWrapMode as P,PixelFormat as S,DepthStencilAttachment as j,FramebufferBit as g}from"../../../../webgl/enums.js";import{Texture as x}from"../../../../webgl/Texture.js";import{TextureDescriptor as q}from"../../../../webgl/TextureDescriptor.js";const O=2;let A=class extends c{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=n.SSAO,this.isEnabled=()=>!1,this._enableTime=i(0),this._passParameters=new f,this._drawParameters=new b}initialize(){const e=Uint8Array.from(atob(d),(e=>e.charCodeAt(0))),r=new q;r.wrapMode=P.CLAMP_TO_EDGE,r.pixelFormat=S.RGB,r.wrapMode=P.REPEAT,r.hasMipmap=!0,
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{watch as t}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as n}from"../../../webgl.js";import c from"../../../webgl/RenderNode.js";import{ColorFormat as p}from"../../core/FBOCacheFormats.js";import{distanceFadeEnd as h,distanceFadeStart as u}from"../../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{SSAOBlurTechnique as l}from"./SSAOBlurTechnique.js";import{noiseData as d}from"./SSAONoiseData.js";import{SSAOPassParameters as f,BlurDrawParameters as b}from"./SSAOParameters.js";import{SSAOTechnique as w}from"./SSAOTechnique.js";import{RenderRequestType as T}from"../../lib/basicInterfaces.js";import{g as _}from"../../../../../chunks/SSAO.glsl.js";import{TextureWrapMode as P,PixelFormat as S,DepthStencilAttachment as j,FramebufferBit as g}from"../../../../webgl/enums.js";import{Texture as x}from"../../../../webgl/Texture.js";import{TextureDescriptor as q}from"../../../../webgl/TextureDescriptor.js";const O=2;let A=class extends c{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=n.SSAO,this.isEnabled=()=>!1,this._enableTime=i(0),this._passParameters=new f,this._drawParameters=new b}initialize(){const e=Uint8Array.from(atob(d),(e=>e.charCodeAt(0))),r=new q(32);r.wrapMode=P.CLAMP_TO_EDGE,r.pixelFormat=S.RGB,r.wrapMode=P.REPEAT,r.hasMipmap=!0,this._passParameters.noiseTexture=new x(this.renderingContext,r,e),this.techniques.precompile(w),this.techniques.precompile(l),this.addHandles(t((()=>this.isEnabled()),(()=>this._enableTime=i(0))))}destroy(){this._passParameters.noiseTexture=s(this._passParameters.noiseTexture)}render(e){const s=e.find((({name:e})=>"normals"===e)),t=s?.getTexture(),o=s?.getTexture(j);if(!t||!o)return;const a=this.techniques.get(w),c=this.techniques.get(l);if(!a.compiled||!c.compiled)return this._enableTime=i(performance.now()),void this.requestRender(T.UPDATE);0===this._enableTime&&(this._enableTime=i(performance.now()));const d=this.renderingContext,f=this.view.qualitySettings.fadeDuration,b=this.bindParameters,P=b.camera,S=P.relativeElevation,x=r((h-S)/(h-u),0,1),q=f>0?Math.min(f,performance.now()-this._enableTime)/f:1,A=q*x;this._passParameters.normalTexture=t,this._passParameters.depthTexture=o,this._passParameters.projScale=1/P.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*C/_(P)**6*A;const R=P.fullViewport[2],v=P.fullViewport[3],y=this.fboCache.acquire(R,v,"ssao input",p.RG8UNORM);d.bindFramebuffer(y.fbo),d.setViewport(0,0,R,v),d.bindTechnique(a,b,this._passParameters,this._drawParameters),d.screen.draw();const E=Math.round(R/O),M=Math.round(v/O),U=this.fboCache.acquire(E,M,"ssao blur",p.R8UNORM);d.bindFramebuffer(U.fbo),this._drawParameters.colorTexture=y.getTexture(),m(this._drawParameters.blurSize,0,O/v),d.bindTechnique(c,b,this._passParameters,this._drawParameters),d.setViewport(0,0,E,M),d.screen.draw(),y.release();const V=this.fboCache.acquire(E,M,n.SSAO,p.R8UNORM);return d.bindFramebuffer(V.fbo),d.setViewport(0,0,R,v),d.setClearColor(1,1,1,0),d.clear(g.COLOR),this._drawParameters.colorTexture=U.getTexture(),m(this._drawParameters.blurSize,O/R,0),d.bindTechnique(c,b,this._passParameters,this._drawParameters),d.setViewport(0,0,E,M),d.screen.draw(),d.setViewport4fv(P.fullViewport),U.release(),q<1&&this.requestRender(T.UPDATE),V}};e([o()],A.prototype,"consumes",void 0),e([o()],A.prototype,"produces",void 0),e([o({constructOnly:!0})],A.prototype,"isEnabled",void 0),A=e([a("esri.views.3d.webgl-engine.effects.ssao.SSAO")],A);const C=.5;export{A as SSAO,O as blurSizePixels};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{packFloatRGBA as t}from"../../../../core/floatRGBA.js";import{ProceduralTextureRepository as e}from"./ProceduralTextureRepository.js";import{PixelFormat as r,TextureWrapMode as o}from"../../../webgl/enums.js";import{Texture as n}from"../../../webgl/Texture.js";import{TextureDescriptor as i}from"../../../webgl/TextureDescriptor.js";function u(t,u){return new e((e=>{const{encodedData:u,textureSize:c}=a(e),f=new i;return f.internalFormat=r.RGBA,f.
|
|
5
|
+
import{packFloatRGBA as t}from"../../../../core/floatRGBA.js";import{ProceduralTextureRepository as e}from"./ProceduralTextureRepository.js";import{PixelFormat as r,TextureWrapMode as o}from"../../../webgl/enums.js";import{Texture as n}from"../../../webgl/Texture.js";import{TextureDescriptor as i}from"../../../webgl/TextureDescriptor.js";function u(t,u){return new e((e=>{const{encodedData:u,textureSize:c}=a(e),f=new i(c,1);return f.internalFormat=r.RGBA,f.wrapMode=o.REPEAT,new n(t,f,u)}),(t=>`${t.pattern.join(",")}-r${t.pixelRatio}`),u)}function a(e){const r=c(e),o=1/e.pixelRatio,n=f(e),i=s(e),u=(Math.floor(.5*(i-1))+.5)*o,a=[];let l=1;for(const t of r){for(let e=0;e<t;e++){const r=l*(Math.min(e,t-1-e)+.5)*o/u*.5+.5;a.push(r)}l=-l}const p=Math.round(r[0]/2),m=[...a.slice(p),...a.slice(0,p)],x=new Uint8Array(4*n);let d=0;for(const c of m)t(c,x,d),d+=4;return{encodedData:x,textureSize:n}}function c(t){return t.pattern.map((e=>Math.round(e*t.pixelRatio)))}function f(t){if(null==t)return 1;const e=c(t);return Math.floor(e.reduce(((t,e)=>t+e)))}function s(t){return c(t).reduce(((t,e)=>Math.max(t,e)))}export{s as computeLongestPattern,f as computeTextureSize,u as createStippleTextureRepository};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../request.js";import e from"../../geometry/Point.js";import{execute as r}from"../../geometry/operators/projectOperator.js";import{projectResolution as i,getProjectionOffsetGrid as a}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{isImageSource as s,rasterize as n}from"../2d/engine/Bitmap.js";import o from"../2d/engine/webgl/VertexStream.js";import{createProgramTemplate as m}from"../2d/engine/webgl/shaders/MaterialPrograms.js";import{TextureWrapMode as c,PixelFormat as p,PixelType as h}from"../webgl/enums.js";import{FramebufferObject as x}from"../webgl/FramebufferObject.js";import{createTransformTexture as u}from"../webgl/rasterUtils.js";import{RenderingContext as d}from"../webgl/RenderingContext.js";import{Texture as g}from"../webgl/Texture.js";import{TextureDescriptor as _}from"../webgl/TextureDescriptor.js";class f{static{this._instanceRefCount=0}constructor(t){if(this._ownsRctx=!1,t)this._ownsRctx=!1,this._rctx=t;else{if(f._instance)return f._instanceRefCount++,f._instance;f._instanceRefCount=1,f._instance=this,this._ownsRctx=!0;const t=document.createElement("canvas").getContext("webgl2");t.getExtension("OES_texture_float"),this._rctx=new d(t,{})}const e={applyProjection:!0,bilinear:!1,bicubic:!1},r=m("raster/reproject","raster/reproject",new Map([["a_position",0]]),e);this._program=this._rctx.programCache.acquire(r.shaders.vertexShader,r.shaders.fragmentShader,r.attributes),this._rctx.useProgram(this._program),this._program.setUniform1f("u_opacity",1),this._program.setUniform1i("u_image",0),this._program.setUniform1i("u_flipY",0),this._program.setUniform1i("u_transformGrid",1),this._quad=new o(this._rctx,[0,0,1,0,0,1,1,1])}reprojectTexture(t,s,n=!1){const o=r(t.extent,s),m=new e({x:(t.extent.xmax-t.extent.xmin)/t.texture.descriptor.width,y:(t.extent.ymax-t.extent.ymin)/t.texture.descriptor.height,spatialReference:t.extent.spatialReference}),{x:d,y:g}=i(m,s,t.extent);let f=(d+g)/2;const l=Math.round((o.xmax-o.xmin)/f),w=Math.round((o.ymax-o.ymin)/f);f=(o.width/l+o.height/w)/2;const b=new e({x:f,y:f,spatialReference:o.spatialReference}),j=a({projectedExtent:o,srcBufferExtent:t.extent,pixelSize:b,hasWrapAround:!0,spacing:[16,16]}),D=u(this._rctx,j),R=new _(l,w);R.wrapMode=c.CLAMP_TO_EDGE;const y=new x(this._rctx,R);this._rctx.bindFramebuffer(y),this._rctx.setViewport(0,0,l,w),this._rctx.useProgram(this._program),this._rctx.bindTexture(t.texture,0),this._rctx.bindTexture(D,1),this._quad.bind();const{width:C=0,height:E=0}=t.texture.descriptor;if(this._program.setUniform2f("u_srcImageSize",C,E),this._program.setUniform2fv("u_transformSpacing",j.spacing),this._program.setUniform2fv("u_transformGridSize",j.size),this._program.setUniform2f("u_targetImageSize",l,w),this._quad.draw(),this._quad.unbind(),this._rctx.useProgram(null),this._rctx.bindFramebuffer(null),D.dispose(),n){const{width:t,height:e}=y,r=new ImageData(t??0,e??0);y.readPixels(0,0,t??0,e??0,p.RGBA,h.UNSIGNED_BYTE,r.data);const i=y.detachColorTexture();return y.dispose(),{texture:i,extent:o,imageData:r}}const T=y.detachColorTexture();return y.dispose(),{texture:T,extent:o}}reprojectBitmapData(t,e){const r=s(t.bitmapData)?n(t.bitmapData):t.bitmapData,i=new _
|
|
5
|
+
import t from"../../request.js";import e from"../../geometry/Point.js";import{execute as r}from"../../geometry/operators/projectOperator.js";import{projectResolution as i,getProjectionOffsetGrid as a}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{isImageSource as s,rasterize as n}from"../2d/engine/Bitmap.js";import o from"../2d/engine/webgl/VertexStream.js";import{createProgramTemplate as m}from"../2d/engine/webgl/shaders/MaterialPrograms.js";import{TextureWrapMode as c,PixelFormat as p,PixelType as h}from"../webgl/enums.js";import{FramebufferObject as x}from"../webgl/FramebufferObject.js";import{createTransformTexture as u}from"../webgl/rasterUtils.js";import{RenderingContext as d}from"../webgl/RenderingContext.js";import{Texture as g}from"../webgl/Texture.js";import{TextureDescriptor as _}from"../webgl/TextureDescriptor.js";class f{static{this._instanceRefCount=0}constructor(t){if(this._ownsRctx=!1,t)this._ownsRctx=!1,this._rctx=t;else{if(f._instance)return f._instanceRefCount++,f._instance;f._instanceRefCount=1,f._instance=this,this._ownsRctx=!0;const t=document.createElement("canvas").getContext("webgl2");t.getExtension("OES_texture_float"),this._rctx=new d(t,{})}const e={applyProjection:!0,bilinear:!1,bicubic:!1},r=m("raster/reproject","raster/reproject",new Map([["a_position",0]]),e);this._program=this._rctx.programCache.acquire(r.shaders.vertexShader,r.shaders.fragmentShader,r.attributes),this._rctx.useProgram(this._program),this._program.setUniform1f("u_opacity",1),this._program.setUniform1i("u_image",0),this._program.setUniform1i("u_flipY",0),this._program.setUniform1i("u_transformGrid",1),this._quad=new o(this._rctx,[0,0,1,0,0,1,1,1])}reprojectTexture(t,s,n=!1){const o=r(t.extent,s),m=new e({x:(t.extent.xmax-t.extent.xmin)/t.texture.descriptor.width,y:(t.extent.ymax-t.extent.ymin)/t.texture.descriptor.height,spatialReference:t.extent.spatialReference}),{x:d,y:g}=i(m,s,t.extent);let f=(d+g)/2;const l=Math.round((o.xmax-o.xmin)/f),w=Math.round((o.ymax-o.ymin)/f);f=(o.width/l+o.height/w)/2;const b=new e({x:f,y:f,spatialReference:o.spatialReference}),j=a({projectedExtent:o,srcBufferExtent:t.extent,pixelSize:b,hasWrapAround:!0,spacing:[16,16]}),D=u(this._rctx,j),R=new _(l,w);R.wrapMode=c.CLAMP_TO_EDGE;const y=new x(this._rctx,R);this._rctx.bindFramebuffer(y),this._rctx.setViewport(0,0,l,w),this._rctx.useProgram(this._program),this._rctx.bindTexture(t.texture,0),this._rctx.bindTexture(D,1),this._quad.bind();const{width:C=0,height:E=0}=t.texture.descriptor;if(this._program.setUniform2f("u_srcImageSize",C,E),this._program.setUniform2fv("u_transformSpacing",j.spacing),this._program.setUniform2fv("u_transformGridSize",j.size),this._program.setUniform2f("u_targetImageSize",l,w),this._quad.draw(),this._quad.unbind(),this._rctx.useProgram(null),this._rctx.bindFramebuffer(null),D.dispose(),n){const{width:t,height:e}=y,r=new ImageData(t??0,e??0);y.readPixels(0,0,t??0,e??0,p.RGBA,h.UNSIGNED_BYTE,r.data);const i=y.detachColorTexture();return y.dispose(),{texture:i,extent:o,imageData:r}}const T=y.detachColorTexture();return y.dispose(),{texture:T,extent:o}}reprojectBitmapData(t,e){const r=s(t.bitmapData)?n(t.bitmapData):t.bitmapData,i=new _(t.bitmapData.width,t.bitmapData.height);i.wrapMode=c.CLAMP_TO_EDGE;const a=new g(this._rctx,i,r),o=this.reprojectTexture({texture:a,extent:t.extent},e,!0);o.texture.dispose();const m=document.createElement("canvas"),p=o.imageData;m.width=p.width,m.height=p.height;return m.getContext("2d").putImageData(p,0,0),{bitmapData:m,extent:o.extent}}async loadAndReprojectBitmapData(e,r,i){const a=(await t(e,{responseType:"image"})).data,s=document.createElement("canvas");s.width=a.width,s.height=a.height;const n=s.getContext("2d");n.drawImage(a,0,0);const o=n.getImageData(0,0,s.width,s.height);if(r.spatialReference.equals(i))return{bitmapData:o,extent:r};const m=this.reprojectBitmapData({bitmapData:o,extent:r},i);return{bitmapData:m.bitmapData,extent:m.extent}}destroy(){this._ownsRctx?(f._instanceRefCount--,0===f._instanceRefCount&&(this._quad.dispose(),this._program.dispose(),this._rctx.dispose(),f._instance=null)):(this._quad.dispose(),this._program.dispose())}}export{f as ImageReprojector};
|