@deck.gl/extensions 9.0.4 → 9.0.6
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/dist/dist.dev.js +7 -5
- package/dist/index.cjs +7 -5
- package/dist/index.cjs.map +2 -2
- package/dist/terrain/terrain-cover.d.ts.map +1 -1
- package/dist/terrain/terrain-cover.js +2 -1
- package/dist/terrain/utils.d.ts +1 -0
- package/dist/terrain/utils.d.ts.map +1 -1
- package/dist/terrain/utils.js +9 -6
- package/dist.min.js +12 -12
- package/package.json +2 -2
- package/src/collision-filter/collision-filter-effect.ts +1 -1
- package/src/terrain/terrain-cover.ts +2 -1
- package/src/terrain/utils.ts +11 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terrain-cover.d.ts","sourceRoot":"","sources":["../../src/terrain/terrain-cover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAE1C,OAAO,KAAK,EAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,eAAe,CAAC;AAGnD,OAAO,EAAiD,MAAM,EAAC,qCAAkC;AAMjG;;;;;;GAMG;AACH,qBAAa,YAAY;IACvB,OAAO,EAAE,OAAO,CAAQ;IACxB,sDAAsD;IACtD,WAAW,EAAE,KAAK,CAAC;IACnB,6CAA6C;IAC7C,cAAc,EAAE,QAAQ,GAAG,IAAI,CAAQ;IACvC,8DAA8D;IAC9D,MAAM,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE7B,OAAO,CAAC,GAAG,CAAC,CAAc;IAC1B,OAAO,CAAC,UAAU,CAAC,CAAc;IACjC,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,IAAI,CAAoB;IAChC,gDAAgD;IAChD,OAAO,CAAC,YAAY,CAAqC;IACzD,sCAAsC;IACtC,OAAO,CAAC,kBAAkB,CAAuB;gBAErC,WAAW,EAAE,KAAK;IAK9B,IAAI,EAAE,WAEL;IAED,4EAA4E;IAC5E,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,YAAY,CAAC,EACX,WAAW,EACX,QAAQ,EACR,MAAM,EACN,gBAAgB,EACjB,EAAE;QACD,WAAW,CAAC,EAAE,KAAK,CAAC;QACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;QACpB,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;QACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC5C,GAAG,OAAO;IAqBX,wEAAwE;IACxE,OAAO,CAAC,aAAa;IAuBrB,4FAA4F;IAC5F,OAAO,CAAC,eAAe;IAsDvB,oBAAoB,IAAI,WAAW,GAAG,IAAI;IAU1C,qBAAqB,IAAI,WAAW,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"terrain-cover.d.ts","sourceRoot":"","sources":["../../src/terrain/terrain-cover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAE1C,OAAO,KAAK,EAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,eAAe,CAAC;AAGnD,OAAO,EAAiD,MAAM,EAAC,qCAAkC;AAMjG;;;;;;GAMG;AACH,qBAAa,YAAY;IACvB,OAAO,EAAE,OAAO,CAAQ;IACxB,sDAAsD;IACtD,WAAW,EAAE,KAAK,CAAC;IACnB,6CAA6C;IAC7C,cAAc,EAAE,QAAQ,GAAG,IAAI,CAAQ;IACvC,8DAA8D;IAC9D,MAAM,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE7B,OAAO,CAAC,GAAG,CAAC,CAAc;IAC1B,OAAO,CAAC,UAAU,CAAC,CAAc;IACjC,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,IAAI,CAAoB;IAChC,gDAAgD;IAChD,OAAO,CAAC,YAAY,CAAqC;IACzD,sCAAsC;IACtC,OAAO,CAAC,kBAAkB,CAAuB;gBAErC,WAAW,EAAE,KAAK;IAK9B,IAAI,EAAE,WAEL;IAED,4EAA4E;IAC5E,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,YAAY,CAAC,EACX,WAAW,EACX,QAAQ,EACR,MAAM,EACN,gBAAgB,EACjB,EAAE;QACD,WAAW,CAAC,EAAE,KAAK,CAAC;QACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;QACpB,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;QACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC5C,GAAG,OAAO;IAqBX,wEAAwE;IACxE,OAAO,CAAC,aAAa;IAuBrB,4FAA4F;IAC5F,OAAO,CAAC,eAAe;IAsDvB,oBAAoB,IAAI,WAAW,GAAG,IAAI;IAU1C,qBAAqB,IAAI,WAAW,GAAG,IAAI;IAa3C,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE;IAI5B,MAAM;CAWP"}
|
|
@@ -134,7 +134,8 @@ export class TerrainCover {
|
|
|
134
134
|
}
|
|
135
135
|
if (!this.pickingFbo) {
|
|
136
136
|
this.pickingFbo = createRenderTarget(this.targetLayer.context.device, {
|
|
137
|
-
id: `${this.id}-picking
|
|
137
|
+
id: `${this.id}-picking`,
|
|
138
|
+
interpolate: false
|
|
138
139
|
});
|
|
139
140
|
}
|
|
140
141
|
return this.pickingFbo;
|
package/dist/terrain/utils.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/terrain/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAG1C,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE;IACJ,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/terrain/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAG1C,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE;IACJ,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,uCAyBF"}
|
package/dist/terrain/utils.js
CHANGED
|
@@ -10,12 +10,15 @@ export function createRenderTarget(device, opts) {
|
|
|
10
10
|
type: 5126
|
|
11
11
|
}),
|
|
12
12
|
mipmaps: false,
|
|
13
|
-
sampler:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
sampler: opts.interpolate === false
|
|
14
|
+
? {
|
|
15
|
+
minFilter: 'nearest',
|
|
16
|
+
magFilter: 'nearest'
|
|
17
|
+
}
|
|
18
|
+
: {
|
|
19
|
+
minFilter: 'linear',
|
|
20
|
+
magFilter: 'linear'
|
|
21
|
+
}
|
|
19
22
|
})
|
|
20
23
|
]
|
|
21
24
|
});
|
package/dist.min.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['deck'] = factory();
|
|
6
6
|
else root['deck'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var Rt=Object.create;var Q=Object.defineProperty;var Ct=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var kt=Object.getPrototypeOf,Nt=Object.prototype.hasOwnProperty;var Fe=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Le=(r,e)=>{for(var t in e)Q(r,t,{get:e[t],enumerable:!0})},X=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let
|
|
7
|
+
"use strict";var __exports__=(()=>{var Rt=Object.create;var Q=Object.defineProperty;var Ct=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var kt=Object.getPrototypeOf,Nt=Object.prototype.hasOwnProperty;var Fe=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Le=(r,e)=>{for(var t in e)Q(r,t,{get:e[t],enumerable:!0})},X=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of St(e))!Nt.call(r,s)&&s!==t&&Q(r,s,{get:()=>e[s],enumerable:!(i=Ct(e,s))||i.enumerable});return r},P=(r,e,t)=>(X(r,e,"default"),t&&X(t,e,"default")),d=(r,e,t)=>(t=r!=null?Rt(kt(r)):{},X(e||!r||!r.__esModule?Q(t,"default",{value:r,enumerable:!0}):t,r)),Bt=r=>X(Q({},"__esModule",{value:!0}),r);var m=Fe((xi,Oe)=>{Oe.exports=globalThis.deck});var ze=Fe((Ei,je)=>{je.exports=globalThis.luma});var Z={};Le(Z,{BrushingExtension:()=>F,ClipExtension:()=>D,CollisionFilterExtension:()=>z,DataFilterExtension:()=>L,FillStyleExtension:()=>w,Fp64Extension:()=>S,MaskExtension:()=>q,PathStyleExtension:()=>N,_TerrainExtension:()=>K,project64:()=>oe});var v={},Ie=d(m(),1);P(v,d(m(),1));if(!Ie.Layer)throw new Error("@deck.gl/core is not found");P(Z,v);var Se=d(m(),1);var Re=d(m(),1);var wt=`
|
|
8
8
|
uniform bool brushing_enabled;
|
|
9
9
|
uniform int brushing_target;
|
|
10
10
|
uniform vec2 brushing_mousePos;
|
|
@@ -61,7 +61,7 @@ brushing_setVisible(visible);
|
|
|
61
61
|
if (brushing_enabled && brushing_isVisible < 0.5) {
|
|
62
62
|
discard;
|
|
63
63
|
}
|
|
64
|
-
`},Ce={name:"brushing",dependencies:[Re.project],vs:wt,fs:Dt,inject:jt,getUniforms:r=>{if(!r||!("viewport"in r))return{};let{brushingEnabled:e=!0,brushingRadius:t=1e4,brushingTarget:i="source",mousePosition:
|
|
64
|
+
`},Ce={name:"brushing",dependencies:[Re.project],vs:wt,fs:Dt,inject:jt,getUniforms:r=>{if(!r||!("viewport"in r))return{};let{brushingEnabled:e=!0,brushingRadius:t=1e4,brushingTarget:i="source",mousePosition:s,viewport:o}=r;return{brushing_enabled:Boolean(e&&s&&o.containsPixel(s)),brushing_radius:t,brushing_target:Vt[i]||0,brushing_mousePos:s?o.unproject([s.x-o.x,s.y-o.y]):[0,0]}}};var zt={getBrushingTarget:{type:"accessor",value:[0,0]},brushingTarget:"source",brushingEnabled:!0,brushingRadius:1e4},J=class extends Se.LayerExtension{getShaders(){return{modules:[Ce]}}initializeState(e,t){let i=this.getAttributeManager();i&&i.add({brushingTargets:{size:2,accessor:"getBrushingTarget",shaderAttributes:{brushingTargets:{divisor:0},instanceBrushingTargets:{divisor:1}}}});let s=()=>{this.getCurrentLayer()?.setNeedsRedraw()};this.state.onMouseMove=s,e.deck&&e.deck.eventManager.on({pointermove:s,pointerleave:s})}finalizeState(e,t){if(e.deck){let i=this.state.onMouseMove;e.deck.eventManager.off({pointermove:i,pointerleave:i})}}},F=J;(()=>{J.defaultProps=zt})(),(()=>{J.extensionName="BrushingExtension"})();var T=d(m(),1);var ke=`
|
|
65
65
|
uniform DATAFILTER_TYPE filter_min;
|
|
66
66
|
uniform DATAFILTER_TYPE filter_softMin;
|
|
67
67
|
uniform DATAFILTER_TYPE filter_softMax;
|
|
@@ -137,7 +137,7 @@ dataFilter_value = 1.0;
|
|
|
137
137
|
`,Ne=`
|
|
138
138
|
uniform bool filter_transformColor;
|
|
139
139
|
in float dataFilter_value;
|
|
140
|
-
`;function Be(r){if(!r||!("extensions"in r))return{};let{filterRange:e=[-1,1],filterEnabled:t=!0,filterTransformSize:i=!0,filterTransformColor:
|
|
140
|
+
`;function Be(r){if(!r||!("extensions"in r))return{};let{filterRange:e=[-1,1],filterEnabled:t=!0,filterTransformSize:i=!0,filterTransformColor:s=!0}=r,o=r.filterSoftRange||e;return{...Number.isFinite(e[0])?{filter_min:e[0],filter_softMin:o[0],filter_softMax:o[1],filter_max:e[1]}:{filter_min:e.map(n=>n[0]),filter_softMin:o.map(n=>n[0]),filter_softMax:o.map(n=>n[1]),filter_max:e.map(n=>n[1])},filter_enabled:t,filter_useSoftMargin:Boolean(r.filterSoftRange),filter_transformSize:t&&i,filter_transformColor:t&&s}}function Gt(r){if(!r||!("extensions"in r))return{};let e=Be(r);if(Number.isFinite(e.filter_min)){let t=Math.fround(e.filter_min);e.filter_min-=t,e.filter_softMin-=t,e.filter_min64High=t;let i=Math.fround(e.filter_max);e.filter_max-=i,e.filter_softMax-=i,e.filter_max64High=i}else{let t=e.filter_min.map(Math.fround);e.filter_min=e.filter_min.map((s,o)=>s-t[o]),e.filter_softMin=e.filter_softMin.map((s,o)=>s-t[o]),e.filter_min64High=t;let i=e.filter_max.map(Math.fround);e.filter_max=e.filter_max.map((s,o)=>s-i[o]),e.filter_softMax=e.filter_softMax.map((s,o)=>s-i[o]),e.filter_max64High=i}return e}var we={"vs:#main-start":`
|
|
141
141
|
#ifdef DATAFILTER_DOUBLE
|
|
142
142
|
dataFilter_setValue(
|
|
143
143
|
DATAFILTER_ATTRIB - filter_min64High + DATAFILTER_ATTRIB_64LOW,
|
|
@@ -205,7 +205,7 @@ void main() {
|
|
|
205
205
|
}
|
|
206
206
|
fragColor = vColor;
|
|
207
207
|
}
|
|
208
|
-
`,Wt=["float32-renderable-webgl","texture-blend-float-webgl"];function Ue(r){return Wt.every(e=>r.features.has(e))}function qe(r,e){return e?r.createFramebuffer({width:1,height:1,colorAttachments:[r.createTexture({format:"rgba32float",type:5126,mipmaps:!1})]}):r.createFramebuffer({width:256,height:64,colorAttachments:[r.createTexture({format:"rgba8unorm",type:5126,mipmaps:!1})]})}function We(r,e,t){return e.defines.NON_INSTANCED_MODEL=1,t&&(e.defines.FLOAT_TARGET=1),new Ge.Model(r,{id:"data-filter-aggregation-model",vertexCount:1,isInstanced:!1,drawMode:0,vs:Ut,fs:qt,...e})}var He={blend:!0,blendFunc:[1,1,1,1],blendEquation:[32774,32774],depthTest:!1};var Yt={getFilterValue:{type:"accessor",value:0},getFilterCategory:{type:"accessor",value:0},onFilteredItemsChange:{type:"function",value:null,optional:!0},filterEnabled:!0,filterRange:[-1,1],filterSoftRange:null,filterCategories:[0],filterTransformSize:!0,filterTransformColor:!0},Kt={categorySize:1,filterSize:1,fp64:!1,countItems:!1},Ye={1:"float",2:"vec2",3:"vec3",4:"vec4"},ee=class extends T.LayerExtension{constructor(e={}){super({...Kt,...e})}getShaders(e){let{categorySize:t,filterSize:i,fp64:
|
|
208
|
+
`,Wt=["float32-renderable-webgl","texture-blend-float-webgl"];function Ue(r){return Wt.every(e=>r.features.has(e))}function qe(r,e){return e?r.createFramebuffer({width:1,height:1,colorAttachments:[r.createTexture({format:"rgba32float",type:5126,mipmaps:!1})]}):r.createFramebuffer({width:256,height:64,colorAttachments:[r.createTexture({format:"rgba8unorm",type:5126,mipmaps:!1})]})}function We(r,e,t){return e.defines.NON_INSTANCED_MODEL=1,t&&(e.defines.FLOAT_TARGET=1),new Ge.Model(r,{id:"data-filter-aggregation-model",vertexCount:1,isInstanced:!1,drawMode:0,vs:Ut,fs:qt,...e})}var He={blend:!0,blendFunc:[1,1,1,1],blendEquation:[32774,32774],depthTest:!1};var Yt={getFilterValue:{type:"accessor",value:0},getFilterCategory:{type:"accessor",value:0},onFilteredItemsChange:{type:"function",value:null,optional:!0},filterEnabled:!0,filterRange:[-1,1],filterSoftRange:null,filterCategories:[0],filterTransformSize:!0,filterTransformColor:!0},Kt={categorySize:1,filterSize:1,fp64:!1,countItems:!1},Ye={1:"float",2:"vec2",3:"vec3",4:"vec4"},ee=class extends T.LayerExtension{constructor(e={}){super({...Kt,...e})}getShaders(e){let{categorySize:t,filterSize:i,fp64:s}=e.opts;return{modules:[s?Ve:De],defines:{DATACATEGORY_TYPE:Ye[t],DATACATEGORY_CHANNELS:t,DATAFILTER_TYPE:Ye[i],DATAFILTER_DOUBLE:Boolean(s)}}}initializeState(e,t){let i=this.getAttributeManager(),{categorySize:s,filterSize:o,fp64:n}=t.opts;i&&i.add({filterValues:{size:o,type:n?"float64":"float32",accessor:"getFilterValue",shaderAttributes:{filterValues:{divisor:0},instanceFilterValues:{divisor:1}}},filterCategoryValues:{size:s,accessor:"getFilterCategory",transform:s===1?l=>t._getCategoryKey.call(this,l,0):l=>l.map((f,c)=>t._getCategoryKey.call(this,f,c)),shaderAttributes:{filterCategoryValues:{divisor:0},instanceFilterCategoryValues:{divisor:1}}}});let{device:a}=this.context;if(i&&t.opts.countItems){let l=Ue(a);i.add({filterIndices:{size:l?1:2,vertexOffset:1,type:"unorm8",accessor:(u,{index:_})=>{let p=u&&u.__source?u.__source.index:_;return l?(p+1)%255:[(p+1)%255,Math.floor(p/255)%255]},shaderAttributes:{filterPrevIndices:{vertexOffset:0},filterIndices:{vertexOffset:1}}}});let f=qe(a,l),c=We(a,t.getShaders.call(this,t),l);this.setState({filterFBO:f,filterModel:c})}}updateState({props:e,oldProps:t,changeFlags:i},s){let o=this.getAttributeManager(),{categorySize:n}=s.opts;if(this.state.filterModel){let a=o.attributes.filterValues.needsUpdate()||o.attributes.filterCategoryValues?.needsUpdate()||e.filterEnabled!==t.filterEnabled||e.filterRange!==t.filterRange||e.filterSoftRange!==t.filterSoftRange||e.filterCategories!==t.filterCategories;a&&this.setState({filterNeedsUpdate:a})}if(o?.attributes.filterCategoryValues){let a=o.attributes.filterCategoryValues.needsUpdate()||!(0,T._deepEqual)(e.filterCategories,t.filterCategories,2);a&&this.setState({categoryBitMaskNeedsUpdate:a}),i.dataChanged&&(this.setState({categoryMap:Array(n).fill(0).map(()=>({}))}),o.attributes.filterCategoryValues.setNeedsUpdate("categoryMap"))}}draw(e,t){let i=this.state.filterFBO,s=this.state.filterModel,o=this.state.filterNeedsUpdate,n=this.state.categoryBitMaskNeedsUpdate,{onFilteredItemsChange:a}=this.props;if(n&&t._updateCategoryBitMask.call(this,e,t),o&&a&&s){let{attributes:{filterValues:l,filterCategoryValues:f,filterIndices:c}}=this.getAttributeManager();s.setVertexCount(this.getNumInstances()),this.context.device.clearWebGL({framebuffer:i,color:[0,0,0,0]}),s.updateModuleSettings(e.moduleParameters),s.setAttributes({...l.getValue(),...f?.getValue(),...c?.getValue()}),s.setUniforms(e.uniforms),s.device.withParametersWebGL({framebuffer:i,...He,viewport:[0,0,i.width,i.height]},()=>{s.draw(this.context.renderPass)});let u=s.device.readPixelsToArrayWebGL(i),_=0;for(let p=0;p<u.length;p++)_+=u[p];a({id:this.id,count:_}),this.state.filterNeedsUpdate=!1}}finalizeState(){let e=this.state.filterFBO,t=this.state.filterModel;e?.destroy(),t?.destroy()}_updateCategoryBitMask(e,t){let{categorySize:i}=t.opts,{filterCategories:s}=this.props,o=new Uint32Array([0,0,0,0]),n=i===1?[s]:s,a=i===1?128:i===2?64:32;for(let l=0;l<n.length;l++){let f=n[l];for(let c of f){let u=t._getCategoryKey.call(this,c,l);if(u<a){let _=l*(a/32)+Math.floor(u/32);o[_]+=Math.pow(2,u%32)}else T.log.warn(`Exceeded maximum number of categories (${a})`)()}}e.uniforms.filter_categoryBitMask=o,this.state.categoryBitMaskNeedsUpdate=!1}_getCategoryKey(e,t){let i=this.state.categoryMap[t];return e in i||(i[e]=Object.keys(i).length),i[e]}},L=ee;(()=>{ee.defaultProps=Yt})(),(()=>{ee.extensionName="DataFilterExtension"})();var C=d(m(),1);function te(r,e=[],t=0){let i=Math.fround(r),s=r-i;return e[t]=i,e[t+1]=s,e}function ge(r){return r-Math.fround(r)}function xe(r){let e=new Float32Array(32);for(let t=0;t<4;++t)for(let i=0;i<4;++i){let s=t*4+i;te(r[i*4+t],e,s*2)}return e}var Ke=`uniform float ONE;
|
|
209
209
|
vec2 split(float a) {
|
|
210
210
|
const float SPLIT = 4097.0;
|
|
211
211
|
float t = a * SPLIT;
|
|
@@ -850,7 +850,7 @@ tmp[j] = b[j + i * 4];
|
|
|
850
850
|
vec4_dot_fp64(a, tmp, out_val[i]);
|
|
851
851
|
}
|
|
852
852
|
}
|
|
853
|
-
`;var Zt={ONE:1};function $t(){return Zt}var $e={name:"fp64-arithmetic",vs:Ke,getUniforms:$t,fp64ify:te,fp64LowPart:ge,fp64ifyMatrix4:xe},re={name:"fp64",vs:Ze,dependencies:[$e],fp64ify:te,fp64LowPart:ge,fp64ifyMatrix4:xe};var Ni=1/Math.PI*180,Bi=1/180*Math.PI,Xt={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Xt}};var O=globalThis.mathgl.config;function Pe(r){return Array.isArray(r)||ArrayBuffer.isView(r)&&!(r instanceof DataView)}function b(r,e,t){let i=O.EPSILON;t&&(O.EPSILON=t);try{if(r===e)return!0;if(Pe(r)&&Pe(e)){if(r.length!==e.length)return!1;for(let
|
|
853
|
+
`;var Zt={ONE:1};function $t(){return Zt}var $e={name:"fp64-arithmetic",vs:Ke,getUniforms:$t,fp64ify:te,fp64LowPart:ge,fp64ifyMatrix4:xe},re={name:"fp64",vs:Ze,dependencies:[$e],fp64ify:te,fp64LowPart:ge,fp64ifyMatrix4:xe};var Ni=1/Math.PI*180,Bi=1/180*Math.PI,Xt={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Xt}};var O=globalThis.mathgl.config;function Pe(r){return Array.isArray(r)||ArrayBuffer.isView(r)&&!(r instanceof DataView)}function b(r,e,t){let i=O.EPSILON;t&&(O.EPSILON=t);try{if(r===e)return!0;if(Pe(r)&&Pe(e)){if(r.length!==e.length)return!1;for(let s=0;s<r.length;++s)if(!b(r[s],e[s]))return!1;return!0}return r&&r.equals?r.equals(e):e&&e.equals?e.equals(r):typeof r=="number"&&typeof e=="number"?Math.abs(r-e)<=O.EPSILON*Math.max(1,Math.abs(r),Math.abs(e)):!1}finally{O.EPSILON=i}}var I=typeof Float32Array<"u"?Float32Array:Array,ye=Math.random;function ie(r){return r>=0?Math.round(r):r%.5===0?Math.floor(r):Math.round(r)}var Di=Math.PI/180;var R={};Le(R,{add:()=>ir,angle:()=>Mr,bezier:()=>gr,ceil:()=>sr,clone:()=>Jt,copy:()=>tr,create:()=>Xe,cross:()=>dr,dist:()=>kr,distance:()=>rt,div:()=>Sr,divide:()=>tt,dot:()=>be,equals:()=>Ir,exactEquals:()=>Or,floor:()=>or,forEach:()=>Dr,fromValues:()=>er,hermite:()=>vr,inverse:()=>_r,len:()=>Br,length:()=>Qe,lerp:()=>mr,max:()=>ar,min:()=>nr,mul:()=>Cr,multiply:()=>et,negate:()=>ur,normalize:()=>pr,random:()=>xr,rotateX:()=>br,rotateY:()=>Ar,rotateZ:()=>Er,round:()=>lr,scale:()=>fr,scaleAndAdd:()=>cr,set:()=>rr,slerp:()=>hr,sqrDist:()=>Nr,sqrLen:()=>wr,squaredDistance:()=>it,squaredLength:()=>st,str:()=>Lr,sub:()=>Rr,subtract:()=>Je,transformMat3:()=>yr,transformMat4:()=>Pr,transformQuat:()=>Tr,zero:()=>Fr});function Xe(){let r=new I(3);return I!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Jt(r){let e=new I(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function Qe(r){let e=r[0],t=r[1],i=r[2];return Math.sqrt(e*e+t*t+i*i)}function er(r,e,t){let i=new I(3);return i[0]=r,i[1]=e,i[2]=t,i}function tr(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function rr(r,e,t,i){return r[0]=e,r[1]=t,r[2]=i,r}function ir(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function Je(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function et(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}function tt(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r}function sr(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r}function or(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r}function nr(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r}function ar(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r}function lr(r,e){return r[0]=ie(e[0]),r[1]=ie(e[1]),r[2]=ie(e[2]),r}function fr(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r}function cr(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r}function rt(r,e){let t=e[0]-r[0],i=e[1]-r[1],s=e[2]-r[2];return Math.sqrt(t*t+i*i+s*s)}function it(r,e){let t=e[0]-r[0],i=e[1]-r[1],s=e[2]-r[2];return t*t+i*i+s*s}function st(r){let e=r[0],t=r[1],i=r[2];return e*e+t*t+i*i}function ur(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function _r(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r}function pr(r,e){let t=e[0],i=e[1],s=e[2],o=t*t+i*i+s*s;return o>0&&(o=1/Math.sqrt(o)),r[0]=e[0]*o,r[1]=e[1]*o,r[2]=e[2]*o,r}function be(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function dr(r,e,t){let i=e[0],s=e[1],o=e[2],n=t[0],a=t[1],l=t[2];return r[0]=s*l-o*a,r[1]=o*n-i*l,r[2]=i*a-s*n,r}function mr(r,e,t,i){let s=e[0],o=e[1],n=e[2];return r[0]=s+i*(t[0]-s),r[1]=o+i*(t[1]-o),r[2]=n+i*(t[2]-n),r}function hr(r,e,t,i){let s=Math.acos(Math.min(Math.max(be(e,t),-1),1)),o=Math.sin(s),n=Math.sin((1-i)*s)/o,a=Math.sin(i*s)/o;return r[0]=n*e[0]+a*t[0],r[1]=n*e[1]+a*t[1],r[2]=n*e[2]+a*t[2],r}function vr(r,e,t,i,s,o){let n=o*o,a=n*(2*o-3)+1,l=n*(o-2)+o,f=n*(o-1),c=n*(3-2*o);return r[0]=e[0]*a+t[0]*l+i[0]*f+s[0]*c,r[1]=e[1]*a+t[1]*l+i[1]*f+s[1]*c,r[2]=e[2]*a+t[2]*l+i[2]*f+s[2]*c,r}function gr(r,e,t,i,s,o){let n=1-o,a=n*n,l=o*o,f=a*n,c=3*o*a,u=3*l*n,_=l*o;return r[0]=e[0]*f+t[0]*c+i[0]*u+s[0]*_,r[1]=e[1]*f+t[1]*c+i[1]*u+s[1]*_,r[2]=e[2]*f+t[2]*c+i[2]*u+s[2]*_,r}function xr(r,e){e=e===void 0?1:e;let t=ye()*2*Math.PI,i=ye()*2-1,s=Math.sqrt(1-i*i)*e;return r[0]=Math.cos(t)*s,r[1]=Math.sin(t)*s,r[2]=i*e,r}function Pr(r,e,t){let i=e[0],s=e[1],o=e[2],n=t[3]*i+t[7]*s+t[11]*o+t[15];return n=n||1,r[0]=(t[0]*i+t[4]*s+t[8]*o+t[12])/n,r[1]=(t[1]*i+t[5]*s+t[9]*o+t[13])/n,r[2]=(t[2]*i+t[6]*s+t[10]*o+t[14])/n,r}function yr(r,e,t){let i=e[0],s=e[1],o=e[2];return r[0]=i*t[0]+s*t[3]+o*t[6],r[1]=i*t[1]+s*t[4]+o*t[7],r[2]=i*t[2]+s*t[5]+o*t[8],r}function Tr(r,e,t){let i=t[0],s=t[1],o=t[2],n=t[3],a=e[0],l=e[1],f=e[2],c=s*f-o*l,u=o*a-i*f,_=i*l-s*a,p=s*_-o*u,x=o*c-i*_,$=i*u-s*c,h=n*2;return c*=h,u*=h,_*=h,p*=2,x*=2,$*=2,r[0]=a+c+p,r[1]=l+u+x,r[2]=f+_+$,r}function br(r,e,t,i){let s=[],o=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],o[0]=s[0],o[1]=s[1]*Math.cos(i)-s[2]*Math.sin(i),o[2]=s[1]*Math.sin(i)+s[2]*Math.cos(i),r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}function Ar(r,e,t,i){let s=[],o=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],o[0]=s[2]*Math.sin(i)+s[0]*Math.cos(i),o[1]=s[1],o[2]=s[2]*Math.cos(i)-s[0]*Math.sin(i),r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}function Er(r,e,t,i){let s=[],o=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],o[0]=s[0]*Math.cos(i)-s[1]*Math.sin(i),o[1]=s[0]*Math.sin(i)+s[1]*Math.cos(i),o[2]=s[2],r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}function Mr(r,e){let t=r[0],i=r[1],s=r[2],o=e[0],n=e[1],a=e[2],l=Math.sqrt((t*t+i*i+s*s)*(o*o+n*n+a*a)),f=l&&be(r,e)/l;return Math.acos(Math.min(Math.max(f,-1),1))}function Fr(r){return r[0]=0,r[1]=0,r[2]=0,r}function Lr(r){return`vec3(${r[0]}, ${r[1]}, ${r[2]})`}function Or(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}function Ir(r,e){let t=r[0],i=r[1],s=r[2],o=e[0],n=e[1],a=e[2];return Math.abs(t-o)<=1e-6*Math.max(1,Math.abs(t),Math.abs(o))&&Math.abs(i-n)<=1e-6*Math.max(1,Math.abs(i),Math.abs(n))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}var Rr=Je,Cr=et,Sr=tt,kr=rt,Nr=it,Br=Qe,wr=st,Dr=function(){let r=Xe();return function(e,t,i,s,o,n){let a,l;for(t||(t=3),i||(i=0),s?l=Math.min(s*t+i,e.length):l=e.length,a=i;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],r[2]=e[a+2],o(r,r,n),e[a]=r[0],e[a+1]=r[1],e[a+2]=r[2];return e}}();var se=d(m(),1);var ot=`const vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097);
|
|
854
854
|
uniform vec2 project_uViewProjectionMatrixFP64[16];
|
|
855
855
|
void mercatorProject_fp64(vec4 lnglat_fp64, out vec2 out_val[2]) {
|
|
856
856
|
#if defined(NVIDIA_FP64_WORKAROUND)
|
|
@@ -910,7 +910,7 @@ return project_position_to_clipspace(
|
|
|
910
910
|
position, position64xyLow, offset, commonPosition
|
|
911
911
|
);
|
|
912
912
|
}
|
|
913
|
-
`;var{fp64ify:Vr,fp64ifyMatrix4:jr}=re,
|
|
913
|
+
`;var{fp64ify:Vr,fp64ifyMatrix4:jr}=re,oe={name:"project64",dependencies:[se.project,re],vs:ot,getUniforms:Gr},zr=(0,se._memoize)(Ur);function Gr(r){if(r&&"viewport"in r){let{viewProjectionMatrix:e,scale:t}=r.viewport;return zr({viewProjectionMatrix:e,scale:t})}return{}}function Ur({viewProjectionMatrix:r,scale:e}){let t=jr(r),i=Vr(e);return{project_uViewProjectionMatrixFP64:t,project64_uViewProjectionMatrix:t,project64_uScale:i}}var Ae=class extends C.LayerExtension{getShaders(){let{coordinateSystem:e}=this.props;if(e!==C.COORDINATE_SYSTEM.LNGLAT&&e!==C.COORDINATE_SYSTEM.DEFAULT)throw new Error("fp64: coordinateSystem must be LNGLAT");return{modules:[oe]}}},S=Ae;(()=>{Ae.extensionName="Fp64Extension"})();var k=d(m(),1);var nt={inject:{"vs:#decl":`
|
|
914
914
|
in vec2 instanceDashArrays;
|
|
915
915
|
in float instanceDashOffsets;
|
|
916
916
|
out vec2 vDashArray;
|
|
@@ -972,7 +972,7 @@ isInside = step(-1.0, vPathPosition.x) * step(vPathPosition.x, 1.0);
|
|
|
972
972
|
if (isInside == 0.0) {
|
|
973
973
|
discard;
|
|
974
974
|
}
|
|
975
|
-
`}};var qr={getDashArray:{type:"accessor",value:[0,0]},getOffset:{type:"accessor",value:0},dashJustified:!1,dashGapPickable:!1},ne=class extends k.LayerExtension{constructor({dash:e=!1,offset:t=!1,highPrecisionDash:i=!1}={}){super({dash:e||i,offset:t,highPrecisionDash:i})}isEnabled(e){return"pathTesselator"in e.state}getShaders(e){if(!e.isEnabled(this))return null;let t={};return e.opts.dash&&(t=(0,k._mergeShaders)(t,nt)),e.opts.offset&&(t=(0,k._mergeShaders)(t,at)),t}initializeState(e,t){let i=this.getAttributeManager();!i||!t.isEnabled(this)||(t.opts.dash&&i.addInstanced({instanceDashArrays:{size:2,accessor:"getDashArray"},instanceDashOffsets:t.opts.highPrecisionDash?{size:1,accessor:"getPath",transform:t.getDashOffsets.bind(this)}:{size:1,update:
|
|
975
|
+
`}};var qr={getDashArray:{type:"accessor",value:[0,0]},getOffset:{type:"accessor",value:0},dashJustified:!1,dashGapPickable:!1},ne=class extends k.LayerExtension{constructor({dash:e=!1,offset:t=!1,highPrecisionDash:i=!1}={}){super({dash:e||i,offset:t,highPrecisionDash:i})}isEnabled(e){return"pathTesselator"in e.state}getShaders(e){if(!e.isEnabled(this))return null;let t={};return e.opts.dash&&(t=(0,k._mergeShaders)(t,nt)),e.opts.offset&&(t=(0,k._mergeShaders)(t,at)),t}initializeState(e,t){let i=this.getAttributeManager();!i||!t.isEnabled(this)||(t.opts.dash&&i.addInstanced({instanceDashArrays:{size:2,accessor:"getDashArray"},instanceDashOffsets:t.opts.highPrecisionDash?{size:1,accessor:"getPath",transform:t.getDashOffsets.bind(this)}:{size:1,update:s=>{s.constant=!0,s.value=[0]}}}),t.opts.offset&&i.addInstanced({instanceOffsets:{size:1,accessor:"getOffset"}}))}updateState(e,t){if(!t.isEnabled(this))return;let i={};t.opts.dash&&(i.dashAlignMode=this.props.dashJustified?1:0,i.dashGapPickable=Boolean(this.props.dashGapPickable)),this.state.model?.setUniforms(i)}getDashOffsets(e){let t=[0],i=this.props.positionFormat==="XY"?2:3,s=Array.isArray(e[0]),o=s?e.length:e.length/i,n,a;for(let l=0;l<o-1;l++)n=s?e[l]:e.slice(l*i,l*i+i),n=this.projectPosition(n),l>0&&(t[l]=t[l-1]+R.dist(a,n)),a=n;return t[o-1]=0,t}},N=ne;(()=>{ne.defaultProps=qr})(),(()=>{ne.extensionName="PathStyleExtension"})();var ft=d(m(),1);var B=d(m(),1);var Wr=`
|
|
976
976
|
#ifdef NON_INSTANCED_MODEL
|
|
977
977
|
#define FILL_PATTERN_FRAME_ATTRIB fillPatternFrames
|
|
978
978
|
#define FILL_PATTERN_SCALE_ATTRIB fillPatternScales
|
|
@@ -1020,7 +1020,7 @@ if (!fill_patternMask) {
|
|
|
1020
1020
|
color.rgb = patternColor.rgb;
|
|
1021
1021
|
}
|
|
1022
1022
|
}
|
|
1023
|
-
`};function Kr(r,e){if(!r)return{};if("fillPatternTexture"in r){let{fillPatternTexture:t}=r;return{fill_patternTexture:t,fill_patternTextureSize:[t.width,t.height]}}if("viewport"in r){let{fillPatternMask:t=!0,fillPatternEnabled:i=!0}=r,{project_uCommonOrigin:
|
|
1023
|
+
`};function Kr(r,e){if(!r)return{};if("fillPatternTexture"in r){let{fillPatternTexture:t}=r;return{fill_patternTexture:t,fill_patternTextureSize:[t.width,t.height]}}if("viewport"in r){let{fillPatternMask:t=!0,fillPatternEnabled:i=!0}=r,{project_uCommonOrigin:s}=e,o=[(0,B.fp64LowPart)(s[0]),(0,B.fp64LowPart)(s[1])];return{fill_uvCoordinateOrigin:s.slice(0,2),fill_uvCoordinateOrigin64Low:o,fill_patternMask:t,fill_patternEnabled:i}}return{}}var lt={name:"fill-pattern",vs:Wr,fs:Hr,inject:Yr,dependencies:[B.project],getUniforms:Kr};var Zr={fillPatternEnabled:!0,fillPatternAtlas:{type:"image",value:null,async:!0,parameters:{lodMaxClamp:0}},fillPatternMapping:{type:"object",value:{},async:!0},fillPatternMask:!0,getFillPattern:{type:"accessor",value:r=>r.pattern},getFillPatternScale:{type:"accessor",value:1},getFillPatternOffset:{type:"accessor",value:[0,0]}},ae=class extends ft.LayerExtension{constructor({pattern:e=!1}={}){super({pattern:e})}isEnabled(e){return e.getAttributeManager()!==null&&!("pathTesselator"in e.state)}getShaders(e){return e.isEnabled(this)?{modules:[e.opts.pattern&<].filter(Boolean)}:null}initializeState(e,t){if(!t.isEnabled(this))return;let i=this.getAttributeManager();t.opts.pattern&&i.add({fillPatternFrames:{size:4,accessor:"getFillPattern",transform:t.getPatternFrame.bind(this),shaderAttributes:{fillPatternFrames:{divisor:0},instanceFillPatternFrames:{divisor:1}}},fillPatternScales:{size:1,accessor:"getFillPatternScale",defaultValue:1,shaderAttributes:{fillPatternScales:{divisor:0},instanceFillPatternScales:{divisor:1}}},fillPatternOffsets:{size:2,accessor:"getFillPatternOffset",shaderAttributes:{fillPatternOffsets:{divisor:0},instanceFillPatternOffsets:{divisor:1}}}}),this.setState({emptyTexture:this.context.device.createTexture({data:new Uint8Array(4),width:1,height:1})})}updateState({props:e,oldProps:t},i){i.isEnabled(this)&&e.fillPatternMapping&&e.fillPatternMapping!==t.fillPatternMapping&&this.getAttributeManager().invalidate("getFillPattern")}draw(e,t){if(!t.isEnabled(this))return;let{fillPatternAtlas:i}=this.props;this.setModuleParameters({fillPatternTexture:i||this.state.emptyTexture})}finalizeState(){this.state.emptyTexture?.delete()}getPatternFrame(e){let{fillPatternMapping:t}=this.getCurrentLayer().props,i=t&&t[e];return i?[i.x,i.y,i.width,i.height]:[0,0,0,0]}},w=ae;(()=>{ae.defaultProps=Zr})(),(()=>{ae.extensionName="FillStyleExtension"})();var ct=d(m(),1);var $r={clipBounds:[0,0,1,1],clipByInstance:void 0},ut=`
|
|
1024
1024
|
uniform vec4 clip_bounds;
|
|
1025
1025
|
bool clip_isInBounds(vec2 position) {
|
|
1026
1026
|
return position.x >= clip_bounds[0] && position.y >= clip_bounds[1] && position.x < clip_bounds[2] && position.y < clip_bounds[3];
|
|
@@ -1041,7 +1041,7 @@ clip_commonPosition = geometry.position.xy;
|
|
|
1041
1041
|
in vec2 clip_commonPosition;
|
|
1042
1042
|
`,"fs:DECKGL_FILTER_COLOR":`
|
|
1043
1043
|
if (!clip_isInBounds(clip_commonPosition)) discard;
|
|
1044
|
-
`},le=class extends ct.LayerExtension{getShaders(){let e="instancePositions"in this.getAttributeManager().attributes;return this.props.clipByInstance!==void 0&&(e=Boolean(this.props.clipByInstance)),this.state.clipByInstance=e,e?{modules:[Xr],inject:Qr}:{modules:[Jr],inject:ei}}draw({uniforms:e}){let{clipBounds:t}=this.props;if(this.state.clipByInstance)e.clip_bounds=t;else{let i=this.projectPosition([t[0],t[1],0]),
|
|
1044
|
+
`},le=class extends ct.LayerExtension{getShaders(){let e="instancePositions"in this.getAttributeManager().attributes;return this.props.clipByInstance!==void 0&&(e=Boolean(this.props.clipByInstance)),this.state.clipByInstance=e,e?{modules:[Xr],inject:Qr}:{modules:[Jr],inject:ei}}draw({uniforms:e}){let{clipBounds:t}=this.props;if(this.state.clipByInstance)e.clip_bounds=t;else{let i=this.projectPosition([t[0],t[1],0]),s=this.projectPosition([t[2],t[3],0]);e.clip_bounds=[Math.min(i[0],s[0]),Math.min(i[1],s[1]),Math.max(i[0],s[0]),Math.max(i[1],s[1])]}}},D=le;(()=>{le.defaultProps=$r})(),(()=>{le.extensionName="ClipExtension"})();var ht=d(m(),1);var _t=d(m(),1);var ti=`
|
|
1045
1045
|
#ifdef NON_INSTANCED_MODEL
|
|
1046
1046
|
in float collisionPriorities;
|
|
1047
1047
|
#else
|
|
@@ -1101,7 +1101,7 @@ position = vec4(0.0, 0.0, 2.0, 1.0);
|
|
|
1101
1101
|
}
|
|
1102
1102
|
`,"vs:DECKGL_FILTER_COLOR":`
|
|
1103
1103
|
color.a *= collision_fade;
|
|
1104
|
-
`},ii=(r,e)=>{if(!r||!("dummyCollisionMap"in r))return{};let{collisionFBO:t,drawToCollisionMap:i,dummyCollisionMap:
|
|
1104
|
+
`},ii=(r,e)=>{if(!r||!("dummyCollisionMap"in r))return{};let{collisionFBO:t,drawToCollisionMap:i,dummyCollisionMap:s}=r;return{collision_sort:Boolean(i),collision_texture:!i&&t?t.colorAttachments[0]:s}},pt={name:"collision",dependencies:[_t.project],vs:ti,inject:ri,getUniforms:ii};var mt=d(m(),1);var dt=d(m(),1),V=class extends dt._LayersPass{renderCollisionMap(e,t){let s=[0,0,0,0],o=[1,1,e.width-2*1,e.height-2*1];this.render({...t,clearColor:s,scissorRect:o,target:e,pass:"collision"})}getLayerParameters(e,t,i){return{...e.props.parameters,blend:!1,depthRange:[0,1],depthTest:!0}}getModuleParameters(){return{drawToCollisionMap:!0,picking:{isActive:1,isAttribute:!1},lightSources:{}}}};var Ee=2,j=class{constructor(){this.id="collision-filter-effect",this.props=null,this.useInPicking=!0,this.order=1,this.channels={},this.collisionFBOs={}}setup(e){this.context=e;let{device:t}=e;this.dummyCollisionMap=t.createTexture({width:1,height:1}),this.collisionFilterPass=new V(t,{id:"default-collision-filter"})}preRender({effects:e,layers:t,layerFilter:i,viewports:s,onViewportActive:o,views:n,isPicking:a,preRenderStats:l={}}){let{device:f}=this.context;if(a)return;let c=t.filter(({props:{visible:h,collisionEnabled:ve}})=>h&&ve);if(c.length===0){this.channels={};return}let u=e?.filter(h=>h.useInPicking&&l[h.id]),_=l["mask-effect"]?.didRender,p=this._groupByCollisionGroup(f,c),x=s[0],$=!this.lastViewport||!this.lastViewport.equals(x)||_;for(let h in p){let ve=this.collisionFBOs[h],Lt=p[h],[Ot,It]=f.canvasContext.getPixelSize();ve.resize({width:Ot/Ee,height:It/Ee}),this._render(Lt,{effects:u,layerFilter:i,onViewportActive:o,views:n,viewport:x,viewportChanged:$})}}_render(e,{effects:t,layerFilter:i,onViewportActive:s,views:o,viewport:n,viewportChanged:a}){let{collisionGroup:l}=e,f=this.channels[l];if(!f)return;let c=a||e===f||!(0,mt._deepEqual)(f.layers,e.layers,1)||e.layerBounds.some((u,_)=>!b(u,f.layerBounds[_]))||e.allLayersLoaded!==f.allLayersLoaded||e.layers.some(u=>u.props.transitions);if(this.channels[l]=e,c){this.lastViewport=n;let u=this.collisionFBOs[l];this.collisionFilterPass.renderCollisionMap(u,{pass:"collision-filter",isPicking:!0,layers:e.layers,effects:t,layerFilter:i,viewports:n?[n]:[],onViewportActive:s,views:o,moduleParameters:{dummyCollisionMap:this.dummyCollisionMap,devicePixelRatio:u.device.canvasContext.getDevicePixelRatio()/Ee}})}}_groupByCollisionGroup(e,t){let i={};for(let s of t){let{collisionGroup:o}=s.props,n=i[o];n||(n={collisionGroup:o,layers:[],layerBounds:[],allLayersLoaded:!0},i[o]=n),n.layers.push(s),n.layerBounds.push(s.getBounds()),s.isLoaded||(n.allLayersLoaded=!1)}for(let s of Object.keys(i))this.collisionFBOs[s]||this.createFBO(e,s),this.channels[s]||(this.channels[s]=i[s]);for(let s of Object.keys(this.collisionFBOs))i[s]||this.destroyFBO(s);return i}getModuleParameters(e){let{collisionGroup:t}=e.props,{collisionFBOs:i,dummyCollisionMap:s}=this;return{collisionFBO:i[t],dummyCollisionMap:s}}cleanup(){this.dummyCollisionMap&&(this.dummyCollisionMap.delete(),this.dummyCollisionMap=void 0),this.channels={};for(let e of Object.keys(this.collisionFBOs))this.destroyFBO(e);this.collisionFBOs={},this.lastViewport=void 0}createFBO(e,t){let{width:i,height:s}=e.gl.canvas,o=e.createTexture({format:"rgba8unorm",width:i,height:s,sampler:{minFilter:"nearest",magFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),n=e.createTexture({format:"depth16unorm",width:i,height:s,mipmaps:!1,dataFormat:6402,type:5125});this.collisionFBOs[t]=e.createFramebuffer({id:`collision-${t}`,width:i,height:s,colorAttachments:[o],depthStencilAttachment:n})}destroyFBO(e){let t=this.collisionFBOs[e];t.colorAttachments[0]?.destroy(),t.depthStencilAttachment?.destroy(),t.destroy(),delete this.collisionFBOs[e]}};var si={getCollisionPriority:{type:"accessor",value:0},collisionEnabled:!0,collisionGroup:{type:"string",value:"default"},collisionTestProps:{}},fe=class extends ht.LayerExtension{getShaders(){return{modules:[pt]}}draw({uniforms:e,context:t,moduleParameters:i}){let{collisionEnabled:s}=this.props,{collisionFBO:o,drawToCollisionMap:n}=i,a=s&&Boolean(o);e.collision_enabled=a,n&&(this.props=this.clone(this.props.collisionTestProps).props)}initializeState(e,t){if(this.getAttributeManager()===null)return;this.context.deck?._addDefaultEffect(new j),this.getAttributeManager().add({collisionPriorities:{size:1,accessor:"getCollisionPriority",shaderAttributes:{collisionPriorities:{divisor:0},instanceCollisionPriorities:{divisor:1}}}})}getNeedsPickingBuffer(){return this.props.collisionEnabled}},z=fe;(()=>{fe.defaultProps=si})(),(()=>{fe.extensionName="CollisionFilterExtension"})();var y=d(m(),1);var vt=d(m(),1);var oi=`
|
|
1105
1105
|
uniform vec4 mask_bounds;
|
|
1106
1106
|
uniform bool mask_maskByInstance;
|
|
1107
1107
|
vec2 mask_getCoords(vec4 position) {
|
|
@@ -1151,7 +1151,7 @@ bool mask = mask_isInBounds(mask_texCoords);
|
|
|
1151
1151
|
fragColor = texture(mask_texture, mask_texCoords);
|
|
1152
1152
|
if (!mask) discard;
|
|
1153
1153
|
}
|
|
1154
|
-
`},li=r=>r&&"maskMap"in r?{mask_texture:r.maskMap}:{},gt={name:"mask",dependencies:[vt.project],vs:
|
|
1154
|
+
`},li=r=>r&&"maskMap"in r?{mask_texture:r.maskMap}:{},gt={name:"mask",dependencies:[vt.project],vs:oi,fs:ni,inject:ai,getUniforms:li};var Me=d(m(),1);var xt=d(m(),1),fi={blendColorOperation:"subtract",blendColorSrcFactor:"zero",blendColorDstFactor:"one",blendAlphaOperation:"subtract",blendAlphaSrcFactor:"zero",blendAlphaDstFactor:"one"},G=class extends xt._LayersPass{constructor(e,t){super(e,t);let{mapSize:i=2048}=t;this.maskMap=e.createTexture({format:"rgba8unorm",width:i,height:i,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),this.fbo=e.createFramebuffer({id:"maskmap",width:i,height:i,colorAttachments:[this.maskMap]})}render(e){let t=2**e.channel,i=[255,255,255,255];super.render({...e,clearColor:i,colorMask:t,target:this.fbo,pass:"mask"})}getLayerParameters(e,t,i){return{...e.props.parameters,blend:!0,depthTest:!1,...fi}}shouldDrawLayer(e){return e.props.operation.includes("mask")}delete(){this.fbo.delete(),this.maskMap.delete()}};var ce=d(m(),1);function A(r,e){let t=[1/0,1/0,-1/0,-1/0];for(let i of r){let s=i.getBounds();if(s){let o=i.projectPosition(s[0],{viewport:e,autoOffset:!1}),n=i.projectPosition(s[1],{viewport:e,autoOffset:!1});t[0]=Math.min(t[0],o[0]),t[1]=Math.min(t[1],o[1]),t[2]=Math.max(t[2],n[0]),t[3]=Math.max(t[3],n[1])}}return Number.isFinite(t[0])?t:null}var ci=2048;function E(r){let{bounds:e,viewport:t,border:i=0}=r,{isGeospatial:s}=t;if(e[2]<=e[0]||e[3]<=e[1])return null;let o=t.unprojectPosition([(e[0]+e[2])/2,(e[1]+e[3])/2,0]),{width:n,height:a,zoom:l}=r;if(l===void 0){n=n-i*2,a=a-i*2;let f=Math.min(n/(e[2]-e[0]),a/(e[3]-e[1]));l=Math.min(Math.log2(f),20)}else if(!n||!a){let f=2**l;n=Math.round(Math.abs(e[2]-e[0])*f),a=Math.round(Math.abs(e[3]-e[1])*f);let c=ci-i*2;if(n>c||a>c){let u=c/Math.max(n,a);n=Math.round(n*u),a=Math.round(a*u),l+=Math.log2(u)}}return s?new ce.WebMercatorViewport({id:t.id,x:i,y:i,width:n,height:a,longitude:o[0],latitude:o[1],zoom:l,orthographic:!0}):new ce.OrthographicViewport({id:t.id,x:i,y:i,width:n,height:a,target:o,zoom:l,flipY:!1})}function ui(r,e){let t;if(e&&e.length===2){let[o,n]=e,a=r.getBounds({z:o}),l=r.getBounds({z:n});t=[Math.min(a[0],l[0]),Math.min(a[1],l[1]),Math.max(a[2],l[2]),Math.max(a[3],l[3])]}else t=r.getBounds();let i=r.projectPosition(t.slice(0,2)),s=r.projectPosition(t.slice(2,4));return[i[0],i[1],s[0],s[1]]}function M(r,e,t){if(!r)return[0,0,1,1];let i=ui(e,t),s=_i(i);return r[2]-r[0]<=s[2]-s[0]&&r[3]-r[1]<=s[3]-s[1]?r:[Math.max(r[0],s[0]),Math.max(r[1],s[1]),Math.min(r[2],s[2]),Math.min(r[3],s[3])]}function _i(r){let e=r[2]-r[0],t=r[3]-r[1],i=(r[0]+r[2])/2,s=(r[1]+r[3])/2;return[i-e,s-t,i+e,s+t]}var U=class{constructor(){this.id="mask-effect",this.props=null,this.useInPicking=!0,this.order=0,this.channels=[],this.masks=null}setup({device:e}){this.dummyMaskMap=e.createTexture({width:1,height:1}),this.maskPass=new G(e,{id:"default-mask"}),this.maskMap=this.maskPass.maskMap}preRender({layers:e,layerFilter:t,viewports:i,onViewportActive:s,views:o,isPicking:n}){let a=!1;if(n)return{didRender:a};let l=e.filter(_=>_.props.visible&&_.props.operation.includes("mask"));if(l.length===0)return this.masks=null,this.channels.length=0,{didRender:a};this.masks={};let f=this._sortMaskChannels(l),c=i[0],u=!this.lastViewport||!this.lastViewport.equals(c);if(c.resolution!==void 0)return Me.log.warn("MaskExtension is not supported in GlobeView")(),{didRender:a};for(let _ in f){let p=this._renderChannel(f[_],{layerFilter:t,onViewportActive:s,views:o,viewport:c,viewportChanged:u});a||=p}return{didRender:a}}_renderChannel(e,{layerFilter:t,onViewportActive:i,views:s,viewport:o,viewportChanged:n}){let a=!1,l=this.channels[e.index];if(!l)return a;let f=e===l||e.layers.length!==l.layers.length||e.layers.some((c,u)=>c!==l.layers[u]||c.props.transitions)||e.layerBounds.some((c,u)=>c!==l.layerBounds[u]);if(e.bounds=l.bounds,e.maskBounds=l.maskBounds,this.channels[e.index]=e,f||n){this.lastViewport=o;let c=A(e.layers,o);if(e.bounds=c&&M(c,o),f||!b(e.bounds,l.bounds)){let{maskPass:u,maskMap:_}=this,p=c&&E({bounds:e.bounds,viewport:o,width:_.width,height:_.height,border:1});e.maskBounds=p?p.getBounds():[0,0,1,1],u.render({pass:"mask",channel:e.index,layers:e.layers,layerFilter:t,viewports:p?[p]:[],onViewportActive:i,views:s,moduleParameters:{devicePixelRatio:1}}),a=!0}}return this.masks[e.id]={index:e.index,bounds:e.maskBounds,coordinateOrigin:e.coordinateOrigin,coordinateSystem:e.coordinateSystem},a}_sortMaskChannels(e){let t={},i=0;for(let s of e){let{id:o}=s.root,n=t[o];if(!n){if(++i>4){Me.log.warn("Too many mask layers. The max supported is 4")();continue}n={id:o,index:this.channels.findIndex(a=>a?.id===o),layers:[],layerBounds:[],coordinateOrigin:s.root.props.coordinateOrigin,coordinateSystem:s.root.props.coordinateSystem},t[o]=n}n.layers.push(s),n.layerBounds.push(s.getBounds())}for(let s=0;s<4;s++){let o=this.channels[s];(!o||!(o.id in t))&&(this.channels[s]=null)}for(let s in t){let o=t[s];o.index<0&&(o.index=this.channels.findIndex(n=>!n),this.channels[o.index]=o)}return t}getModuleParameters(){return{maskMap:this.masks?this.maskMap:this.dummyMaskMap,maskChannels:this.masks}}cleanup(){this.dummyMaskMap&&(this.dummyMaskMap.delete(),this.dummyMaskMap=void 0),this.maskPass&&(this.maskPass.delete(),this.maskPass=void 0,this.maskMap=void 0),this.lastViewport=void 0,this.masks=null,this.channels.length=0}};var pi={maskId:"",maskByInstance:void 0,maskInverted:!1},ue=class extends y.LayerExtension{initializeState(){this.context.deck?._addDefaultEffect(new U)}getShaders(){let e="instancePositions"in this.getAttributeManager().attributes;return this.props.maskByInstance!==void 0&&(e=Boolean(this.props.maskByInstance)),this.state.maskByInstance=e,{modules:[gt]}}draw({uniforms:e,context:t,moduleParameters:i}){e.mask_maskByInstance=this.state.maskByInstance;let{maskId:s,maskInverted:o}=this.props,{maskChannels:n}=i,{viewport:a}=t;if(n&&n[s]){let{index:l,bounds:f,coordinateOrigin:c}=n[s],{coordinateSystem:u}=n[s];e.mask_enabled=!0,e.mask_channel=l,e.mask_inverted=o,u===y.COORDINATE_SYSTEM.DEFAULT&&(u=a.isGeospatial?y.COORDINATE_SYSTEM.LNGLAT:y.COORDINATE_SYSTEM.CARTESIAN);let _={modelMatrix:null,fromCoordinateOrigin:c,fromCoordinateSystem:u},p=this.projectPosition([f[0],f[1],0],_),x=this.projectPosition([f[2],f[3],0],_);e.mask_bounds=[p[0],p[1],x[0],x[1]]}else s&&y.log.warn(`Could not find a mask layer with id: ${s}`)(),e.mask_enabled=!1}},q=ue;(()=>{ue.defaultProps=pi})(),(()=>{ue.extensionName="MaskExtension"})();var Ft=d(m(),1);var Mt=d(m(),1);var yt=d(m(),1);var g={NONE:0,WRITE_HEIGHT_MAP:1,USE_HEIGHT_MAP:2,USE_COVER:3,USE_COVER_ONLY:4,SKIP:5},Pt=Object.keys(g).map(r=>`const float TERRAIN_MODE_${r} = ${g[r]}.0;`).join(`
|
|
1155
1155
|
`),W={name:"terrain",dependencies:[yt.project],inject:{"vs:#decl":`
|
|
1156
1156
|
uniform float terrain_mode;
|
|
1157
1157
|
uniform sampler2D terrain_map;
|
|
@@ -1201,6 +1201,6 @@ color = pixel + color * (1.0 - pixel.a);
|
|
|
1201
1201
|
}
|
|
1202
1202
|
return;
|
|
1203
1203
|
}
|
|
1204
|
-
`},getUniforms:(r={},e)=>{if("dummyHeightMap"in r){let{drawToTerrainHeightMap:t,heightMap:i,heightMapBounds:
|
|
1204
|
+
`},getUniforms:(r={},e)=>{if("dummyHeightMap"in r){let{drawToTerrainHeightMap:t,heightMap:i,heightMapBounds:s,dummyHeightMap:o,terrainCover:n,useTerrainHeightMap:a,terrainSkipRender:l}=r,{project_uCommonOrigin:f}=e,c=l?g.SKIP:g.NONE,u=o,_=null;if(t)c=g.WRITE_HEIGHT_MAP,_=s;else if(a&&i)c=g.USE_HEIGHT_MAP,u=i,_=s;else if(n){let p=r.picking?.isActive;u=(p?n.getPickingFramebuffer():n.getRenderFramebuffer())?.colorAttachments[0].texture,p&&(c=g.SKIP),u?(c=c===g.SKIP?g.USE_COVER_ONLY:g.USE_COVER,_=n.bounds):u=o}return{terrain_mode:c,terrain_map:u,terrain_bounds:_?[_[0]-f[0],_[1]-f[1],_[2]-_[0],_[3]-_[1]]:[0,0,0,0]}}return null}};function H(r,e){return r.createFramebuffer({id:e.id,colorAttachments:[r.createTexture({id:e.id,...e.float&&{format:"rgba32float",type:5126},mipmaps:!1,sampler:e.interpolate===!1?{minFilter:"nearest",magFilter:"nearest"}:{minFilter:"linear",magFilter:"linear"}})]})}var _e=class{constructor(e){this.isDirty=!0,this.renderViewport=null,this.bounds=null,this.layers=[],this.targetBounds=null,this.targetBoundsCommon=null,this.targetLayer=e,this.tile=Tt(e)}get id(){return this.targetLayer.id}get isActive(){return Boolean(this.targetLayer.getCurrentLayer())}shouldUpdate({targetLayer:e,viewport:t,layers:i,layerNeedsRedraw:s}){e&&(this.targetLayer=e);let o=t?this._updateViewport(t):!1,n=i?this._updateLayers(i):!1;if(s){for(let a of this.layers)if(s[a]){n=!0;break}}return n||o}_updateLayers(e){let t=!1;if(e=this.tile?di(this.tile,e):e,e.length!==this.layers.length)t=!0;else for(let i=0;i<e.length;i++)if(e[i].id!==this.layers[i]){t=!0;break}return t&&(this.layers=e.map(i=>i.id)),t}_updateViewport(e){let t=this.targetLayer,i=!1;if(this.tile&&"boundingBox"in this.tile){if(!this.targetBounds){i=!0,this.targetBounds=this.tile.boundingBox;let o=e.projectPosition(this.targetBounds[0]),n=e.projectPosition(this.targetBounds[1]);this.targetBoundsCommon=[o[0],o[1],n[0],n[1]]}}else this.targetBounds!==t.getBounds()&&(i=!0,this.targetBounds=t.getBounds(),this.targetBoundsCommon=A([t],e));if(!this.targetBoundsCommon)return!1;let s=Math.ceil(e.zoom+.5);if(this.tile)this.bounds=this.targetBoundsCommon;else{let o=this.renderViewport?.zoom;i=i||s!==o;let n=M(this.targetBoundsCommon,e),a=this.bounds;i=i||!a||n.some((l,f)=>l!==a[f]),this.bounds=n}return i&&(this.renderViewport=E({bounds:this.bounds,zoom:s,viewport:e})),i}getRenderFramebuffer(){return!this.renderViewport||this.layers.length===0?null:(this.fbo||(this.fbo=H(this.targetLayer.context.device,{id:this.id})),this.fbo)}getPickingFramebuffer(){return!this.renderViewport||this.layers.length===0&&!this.targetLayer.props.pickable?null:(this.pickingFbo||(this.pickingFbo=H(this.targetLayer.context.device,{id:`${this.id}-picking`,interpolate:!1})),this.pickingFbo)}filterLayers(e){return e.filter(({id:t})=>this.layers.includes(t))}delete(){let{fbo:e,pickingFbo:t}=this;e&&(e.colorAttachments[0].destroy(),e.destroy()),t&&(t.colorAttachments[0].destroy(),t.destroy())}};function di(r,e){return e.filter(t=>{let i=Tt(t);return i?mi(r.boundingBox,i.boundingBox):!0})}function Tt(r){for(;r;){let{tile:e}=r.props;if(e)return e;r=r.parent}return null}function mi(r,e){return r&&e?r[0][0]<e[1][0]&&e[0][0]<r[1][0]&&r[0][1]<e[1][1]&&e[0][1]<r[1][1]:!1}var bt=d(m(),1),hi={blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},pe=class extends bt._LayersPass{getRenderableLayers(e,t){let{layers:i}=t,s=[],o=this._getDrawLayerParams(e,t,!0);for(let n=0;n<i.length;n++){let a=i[n];!a.isComposite&&o[n].shouldDrawLayer&&s.push(a)}return s}renderHeightMap(e,t){let i=e.getRenderFramebuffer(),s=e.renderViewport;!i||!s||(i.resize(s),this.render({...t,target:i,pass:"terrain-height-map",layers:t.layers,viewports:[s],effects:[],clearColor:[0,0,0,0]}))}renderTerrainCover(e,t){let i=e.getRenderFramebuffer(),s=e.renderViewport;if(!i||!s)return;let o=e.filterLayers(t.layers);i.resize(s),this.render({...t,target:i,pass:`terrain-cover-${e.id}`,layers:o,effects:[],viewports:[s],clearColor:[0,0,0,0]})}getLayerParameters(e,t,i){return{...e.props.parameters,blend:!0,depthTest:!1,...e.props.operation.includes("terrain")&&hi}}};var At=d(m(),1),de=class extends At._PickLayersPass{constructor(){super(...arguments),this.drawParameters={}}getRenderableLayers(e,t){let{layers:i}=t,s=[];this.drawParameters={},this._resetColorEncoder(t.pickZ);let o=this._getDrawLayerParams(e,t);for(let n=0;n<i.length;n++){let a=i[n];!a.isComposite&&o[n].shouldDrawLayer&&(s.push(a),this.drawParameters[a.id]=o[n].layerParameters)}return s}renderTerrainCover(e,t){let i=e.getPickingFramebuffer(),s=e.renderViewport;if(!i||!s)return;let o=e.filterLayers(t.layers),n=e.targetLayer;n.props.pickable&&o.unshift(n),i.resize(s),this.render({...t,pickingFBO:i,pass:`terrain-cover-picking-${e.id}`,layers:o,effects:[],viewports:[s],cullRect:void 0,deviceRect:s,pickZ:!1})}getLayerParameters(e,t,i){let s;return this.drawParameters[e.id]?s=this.drawParameters[e.id]:(s=super.getLayerParameters(e,t,i),s.blend=!0),{...s,depthTest:!1}}};var Et=2048,Y=class{static isSupported(e){return e.isTextureFormatRenderable("rgba32float")}constructor(e){this.renderViewport=null,this.bounds=null,this.layers=[],this.layersBounds=[],this.layersBoundsCommon=null,this.lastViewport=null,this.device=e}getRenderFramebuffer(){return this.renderViewport?(this.fbo||(this.fbo=H(this.device,{id:"height-map",float:!0})),this.fbo):null}shouldUpdate({layers:e,viewport:t}){let i=e.length!==this.layers.length||e.some((o,n)=>o!==this.layers[n]||o.props.transitions||o.getBounds()!==this.layersBounds[n]);i&&(this.layers=e,this.layersBounds=e.map(o=>o.getBounds()),this.layersBoundsCommon=A(e,t));let s=!this.lastViewport||!t.equals(this.lastViewport);if(!this.layersBoundsCommon)this.renderViewport=null;else if(i||s){let o=M(this.layersBoundsCommon,t);if(o[2]<=o[0]||o[3]<=o[1])return this.renderViewport=null,!1;this.bounds=o,this.lastViewport=t;let n=t.scale,a=(o[2]-o[0])*n,l=(o[3]-o[1])*n;return this.renderViewport=a>0||l>0?E({bounds:[t.center[0]-1,t.center[1]-1,t.center[0]+1,t.center[1]+1],zoom:t.zoom,width:Math.min(a,Et),height:Math.min(l,Et),viewport:t}):null,!0}return!1}delete(){this.fbo&&(this.fbo.colorAttachments[0].delete(),this.fbo.delete())}};var me=class{constructor(){this.id="terrain-effect",this.props=null,this.useInPicking=!0,this.isPicking=!1,this.isDrapingEnabled=!1,this.terrainCovers=new Map}setup({device:e,deck:t}){this.dummyHeightMap=e.createTexture({width:1,height:1,data:new Uint8Array([0,0,0,0])}),this.terrainPass=new pe(e,{id:"terrain"}),this.terrainPickingPass=new de(e,{id:"terrain-picking"}),Y.isSupported(e)?this.heightMap=new Y(e):Mt.log.warn("Terrain offset mode is not supported by this browser")(),t._addDefaultShaderModule(W)}preRender(e){if(e.pickZ){this.isDrapingEnabled=!1;return}let{viewports:t}=e,i=e.pass.startsWith("picking");this.isPicking=i,this.isDrapingEnabled=!0;let s=t[0],o=(i?this.terrainPickingPass:this.terrainPass).getRenderableLayers(s,e),n=o.filter(l=>l.props.operation.includes("terrain"));if(n.length===0)return;i||o.filter(f=>f.state.terrainDrawMode==="offset").length>0&&this._updateHeightMap(n,s,e);let a=o.filter(l=>l.state.terrainDrawMode==="drape");this._updateTerrainCovers(n,a,s,e)}getModuleParameters(e){let{terrainDrawMode:t}=e.state;return{heightMap:this.heightMap?.getRenderFramebuffer()?.colorAttachments[0].texture||null,heightMapBounds:this.heightMap?.bounds,dummyHeightMap:this.dummyHeightMap,terrainCover:this.isDrapingEnabled?this.terrainCovers.get(e.id):null,useTerrainHeightMap:t==="offset",terrainSkipRender:t==="drape"||!e.props.operation.includes("draw")}}cleanup({deck:e}){this.dummyHeightMap&&(this.dummyHeightMap.delete(),this.dummyHeightMap=void 0),this.heightMap&&(this.heightMap.delete(),this.heightMap=void 0);for(let t of this.terrainCovers.values())t.delete();this.terrainCovers.clear(),e._removeDefaultShaderModule(W)}_updateHeightMap(e,t,i){!this.heightMap||!this.heightMap.shouldUpdate({layers:e,viewport:t})||this.terrainPass.renderHeightMap(this.heightMap,{...i,layers:e,moduleParameters:{heightMapBounds:this.heightMap.bounds,dummyHeightMap:this.dummyHeightMap,devicePixelRatio:1,drawToTerrainHeightMap:!0}})}_updateTerrainCovers(e,t,i,s){let o={};for(let n of t)n.state.terrainCoverNeedsRedraw&&(o[n.id]=!0,n.state.terrainCoverNeedsRedraw=!1);for(let n of this.terrainCovers.values())n.isDirty=n.isDirty||n.shouldUpdate({layerNeedsRedraw:o});for(let n of e)this._updateTerrainCover(n,t,i,s);this.isPicking||this._pruneTerrainCovers()}_updateTerrainCover(e,t,i,s){let o=this.isPicking?this.terrainPickingPass:this.terrainPass,n=this.terrainCovers.get(e.id);n||(n=new _e(e),this.terrainCovers.set(e.id,n));try{let a=n.shouldUpdate({targetLayer:e,viewport:i,layers:t});(this.isPicking||n.isDirty||a)&&(o.renderTerrainCover(n,{...s,layers:t,moduleParameters:{dummyHeightMap:this.dummyHeightMap,terrainSkipRender:!1,devicePixelRatio:1}}),this.isPicking||(n.isDirty=!1))}catch(a){e.raiseError(a,`Error rendering terrain cover ${n.id}`)}}_pruneTerrainCovers(){let e=[];for(let[t,i]of this.terrainCovers)i.isActive||e.push(t);for(let t of e)this.terrainCovers.delete(t)}};var vi={terrainDrawMode:void 0},he=class extends Ft.LayerExtension{getShaders(){return{modules:[W]}}initializeState(){this.context.deck?._addDefaultEffect(new me)}updateState(e){let{props:t,oldProps:i}=e;if(this.state.terrainDrawMode&&t.terrainDrawMode===i.terrainDrawMode&&t.extruded===i.extruded)return;let{terrainDrawMode:s}=t;if(!s){let o=this.props.extruded,n=this.getAttributeManager()?.attributes,a=n&&"instancePositions"in n;s=o||a?"offset":"drape"}this.setState({terrainDrawMode:s})}onNeedsRedraw(){let e=this.state;e.terrainDrawMode==="drape"&&(e.terrainCoverNeedsRedraw=!0)}},K=he;(()=>{he.defaultProps=vi})(),(()=>{he.extensionName="TerrainExtension"})();return Bt(Z);})();
|
|
1205
1205
|
return __exports__;
|
|
1206
1206
|
});
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Plug-and-play functionalities for deck.gl layers",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "9.0.
|
|
6
|
+
"version": "9.0.6",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"@luma.gl/core": "^9.0.0",
|
|
48
48
|
"@luma.gl/engine": "^9.0.0"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "fdbf68be3761c1a7e4bf5d2c6b20792fd8796937"
|
|
51
51
|
}
|
|
@@ -3,7 +3,7 @@ import {equals} from '@math.gl/core';
|
|
|
3
3
|
import {_deepEqual as deepEqual} from '@deck.gl/core';
|
|
4
4
|
import type {Effect, EffectContext, Layer, PreRenderOptions, Viewport} from '@deck.gl/core';
|
|
5
5
|
import CollisionFilterPass from './collision-filter-pass';
|
|
6
|
-
import
|
|
6
|
+
import {MaskPreRenderStats} from '../mask/mask-effect';
|
|
7
7
|
// import {debugFBO} from '../utils/debug';
|
|
8
8
|
|
|
9
9
|
type CollisionFilterExtensionProps = {
|
|
@@ -174,7 +174,8 @@ export class TerrainCover {
|
|
|
174
174
|
}
|
|
175
175
|
if (!this.pickingFbo) {
|
|
176
176
|
this.pickingFbo = createRenderTarget(this.targetLayer.context.device, {
|
|
177
|
-
id: `${this.id}-picking
|
|
177
|
+
id: `${this.id}-picking`,
|
|
178
|
+
interpolate: false
|
|
178
179
|
});
|
|
179
180
|
}
|
|
180
181
|
return this.pickingFbo;
|
package/src/terrain/utils.ts
CHANGED
|
@@ -6,6 +6,7 @@ export function createRenderTarget(
|
|
|
6
6
|
opts: {
|
|
7
7
|
id: string;
|
|
8
8
|
float?: boolean;
|
|
9
|
+
interpolate?: boolean;
|
|
9
10
|
}
|
|
10
11
|
) {
|
|
11
12
|
return device.createFramebuffer({
|
|
@@ -18,12 +19,16 @@ export function createRenderTarget(
|
|
|
18
19
|
type: GL.FLOAT
|
|
19
20
|
}),
|
|
20
21
|
mipmaps: false,
|
|
21
|
-
sampler:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
sampler:
|
|
23
|
+
opts.interpolate === false
|
|
24
|
+
? {
|
|
25
|
+
minFilter: 'nearest',
|
|
26
|
+
magFilter: 'nearest'
|
|
27
|
+
}
|
|
28
|
+
: {
|
|
29
|
+
minFilter: 'linear',
|
|
30
|
+
magFilter: 'linear'
|
|
31
|
+
}
|
|
27
32
|
})
|
|
28
33
|
]
|
|
29
34
|
});
|