@deck.gl/extensions 9.0.0-beta.9 → 9.0.1
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/collision-filter/collision-filter-effect.d.ts +4 -2
- package/dist/collision-filter/collision-filter-effect.d.ts.map +1 -1
- package/dist/collision-filter/collision-filter-effect.js +10 -9
- package/dist/collision-filter/collision-filter-pass.d.ts +3 -2
- package/dist/collision-filter/collision-filter-pass.d.ts.map +1 -1
- package/dist/collision-filter/collision-filter-pass.js +5 -7
- package/dist/data-filter/data-filter-extension.d.ts +1 -1
- package/dist/data-filter/data-filter-extension.d.ts.map +1 -1
- package/dist/data-filter/data-filter-extension.js +1 -1
- package/dist/dist.dev.js +475 -479
- package/dist/fill-style/fill-style-extension.d.ts +2 -30
- package/dist/fill-style/fill-style-extension.d.ts.map +1 -1
- package/dist/fill-style/fill-style-extension.js +1 -3
- package/dist/index.cjs +427 -421
- package/dist/index.cjs.map +4 -4
- package/dist/mask/mask-effect.d.ts +5 -4
- package/dist/mask/mask-effect.d.ts.map +1 -1
- package/dist/mask/mask-effect.js +9 -11
- package/dist/mask/mask-pass.d.ts +4 -3
- package/dist/mask/mask-pass.d.ts.map +1 -1
- package/dist/mask/mask-pass.js +17 -9
- package/dist/path-style/path-style-extension.d.ts.map +1 -1
- package/dist/path-style/path-style-extension.js +1 -0
- package/dist/terrain/terrain-effect.d.ts +4 -5
- package/dist/terrain/terrain-effect.d.ts.map +1 -1
- package/dist/terrain/terrain-effect.js +6 -15
- package/dist/terrain/terrain-pass.d.ts +1 -0
- package/dist/terrain/terrain-pass.d.ts.map +1 -1
- package/dist/terrain/terrain-pass.js +24 -16
- package/dist/terrain/terrain-picking-pass.d.ts.map +1 -1
- package/dist/terrain/terrain-picking-pass.js +9 -8
- package/dist/terrain/utils.d.ts.map +1 -1
- package/dist/terrain/utils.js +1 -0
- package/dist.min.js +23 -23
- package/package.json +5 -5
- package/src/collision-filter/collision-filter-effect.ts +22 -22
- package/src/collision-filter/collision-filter-pass.ts +7 -11
- package/src/data-filter/data-filter-extension.ts +1 -1
- package/src/fill-style/fill-style-extension.ts +3 -4
- package/src/mask/mask-effect.ts +30 -19
- package/src/mask/mask-pass.ts +22 -16
- package/src/path-style/path-style-extension.ts +1 -0
- package/src/terrain/terrain-effect.ts +9 -18
- package/src/terrain/terrain-pass.ts +37 -34
- package/src/terrain/terrain-picking-pass.ts +19 -23
- package/src/terrain/utils.ts +1 -0
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
|
|
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 o of St(e))!Nt.call(r,o)&&o!==t&&Q(r,o,{get:()=>e[o],enumerable:!(i=Ct(e,o))||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:()=>se});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
|
-
`},
|
|
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:o,viewport:s}=r;return{brushing_enabled:Boolean(e&&o&&s.containsPixel(o)),brushing_radius:t,brushing_target:Vt[i]||0,brushing_mousePos:o?s.unproject([o.x-s.x,o.y-s.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 o=()=>{this.getCurrentLayer()?.setNeedsRedraw()};this.state.onMouseMove=o,e.deck&&e.deck.eventManager.on({pointermove:o,pointerleave:o})}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;
|
|
@@ -134,10 +134,10 @@ if(any(equal(dataFilter_bits, DATACATEGORY_TYPE(0.0)))) dataFilter_value = 0.0;
|
|
|
134
134
|
dataFilter_value = 1.0;
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
`,
|
|
137
|
+
`,Ne=`
|
|
138
138
|
uniform bool filter_transformColor;
|
|
139
139
|
in float dataFilter_value;
|
|
140
|
-
`;function
|
|
140
|
+
`;function Be(r){if(!r||!("extensions"in r))return{};let{filterRange:e=[-1,1],filterEnabled:t=!0,filterTransformSize:i=!0,filterTransformColor:o=!0}=r,s=r.filterSoftRange||e;return{...Number.isFinite(e[0])?{filter_min:e[0],filter_softMin:s[0],filter_softMax:s[1],filter_max:e[1]}:{filter_min:e.map(n=>n[0]),filter_softMin:s.map(n=>n[0]),filter_softMax:s.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&&o}}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((o,s)=>o-t[s]),e.filter_softMin=e.filter_softMin.map((o,s)=>o-t[s]),e.filter_min64High=t;let i=e.filter_max.map(Math.fround);e.filter_max=e.filter_max.map((o,s)=>o-i[s]),e.filter_softMax=e.filter_softMax.map((o,s)=>o-i[s]),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,
|
|
@@ -160,7 +160,7 @@ if (dataFilter_value == 0.0) discard;
|
|
|
160
160
|
if (filter_transformColor) {
|
|
161
161
|
color.a *= dataFilter_value;
|
|
162
162
|
}
|
|
163
|
-
`},
|
|
163
|
+
`},De={name:"data-filter",vs:ke,fs:Ne,inject:we,getUniforms:Be},Ve={name:"data-filter-fp64",vs:ke,fs:Ne,inject:we,getUniforms:Gt};var Ge=d(ze(),1);var Ut=`#version 300 es
|
|
164
164
|
#define SHADER_NAME data-filter-vertex-shader
|
|
165
165
|
|
|
166
166
|
#ifdef FLOAT_TARGET
|
|
@@ -205,7 +205,7 @@ void main() {
|
|
|
205
205
|
}
|
|
206
206
|
fragColor = vColor;
|
|
207
207
|
}
|
|
208
|
-
`,Wt=["float32-renderable-webgl","texture-blend-float-webgl"];function
|
|
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:o}=e.opts;return{modules:[o?Ve:De],defines:{DATACATEGORY_TYPE:Ye[t],DATACATEGORY_CHANNELS:t,DATAFILTER_TYPE:Ye[i],DATAFILTER_DOUBLE:Boolean(o)}}}initializeState(e,t){let i=this.getAttributeManager(),{categorySize:o,filterSize:s,fp64:n}=t.opts;i&&i.add({filterValues:{size:s,type:n?"float64":"float32",accessor:"getFilterValue",shaderAttributes:{filterValues:{divisor:0},instanceFilterValues:{divisor:1}}},filterCategoryValues:{size:o,accessor:"getFilterCategory",transform:o===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},o){let s=this.getAttributeManager(),{categorySize:n}=o.opts;if(this.state.filterModel){let a=s.attributes.filterValues.needsUpdate()||s.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(s?.attributes.filterCategoryValues){let a=s.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(()=>({}))}),s.attributes.filterCategoryValues.setNeedsUpdate("categoryMap"))}}draw(e,t){let i=this.state.filterFBO,o=this.state.filterModel,s=this.state.filterNeedsUpdate,n=this.state.categoryBitMaskNeedsUpdate,{onFilteredItemsChange:a}=this.props;if(n&&t._updateCategoryBitMask.call(this,e,t),s&&a&&o){let{attributes:{filterValues:l,filterCategoryValues:f,filterIndices:c}}=this.getAttributeManager();o.setVertexCount(this.getNumInstances()),this.context.device.clearWebGL({framebuffer:i,color:[0,0,0,0]}),o.updateModuleSettings(e.moduleParameters),o.setAttributes({...l.getValue(),...f?.getValue(),...c?.getValue()}),o.setUniforms(e.uniforms),o.device.withParametersWebGL({framebuffer:i,...He,viewport:[0,0,i.width,i.height]},()=>{o.draw(this.context.renderPass)});let u=o.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:o}=this.props,s=new Uint32Array([0,0,0,0]),n=i===1?[o]:o,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);s[_]+=Math.pow(2,u%32)}else T.log.warn(`Exceeded maximum number of categories (${a})`)()}}e.uniforms.filter_categoryBitMask=s,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),o=r-i;return e[t]=i,e[t+1]=o,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 o=t*4+i;te(r[i*4+t],e,o*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;
|
|
@@ -337,7 +337,7 @@ return sum_fp64(split(yn), prod);
|
|
|
337
337
|
return sum_fp64(vec2(yn, 0.0), prod);
|
|
338
338
|
#endif
|
|
339
339
|
}
|
|
340
|
-
`;var
|
|
340
|
+
`;var Ze=`const vec2 E_FP64 = vec2(2.7182817459106445e+00, 8.254840366817007e-08);
|
|
341
341
|
const vec2 LOG2_FP64 = vec2(0.6931471824645996e+00, -1.9046542121259336e-09);
|
|
342
342
|
const vec2 PI_FP64 = vec2(3.1415927410125732, -8.742278012618954e-8);
|
|
343
343
|
const vec2 TWO_PI_FP64 = vec2(6.2831854820251465, -1.7484556025237907e-7);
|
|
@@ -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
|
|
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 o=0;o<r.length;++o)if(!b(r[o],e[o]))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:()=>or,clone:()=>Jt,copy:()=>tr,create:()=>Xe,cross:()=>dr,dist:()=>kr,distance:()=>rt,div:()=>Sr,divide:()=>tt,dot:()=>be,equals:()=>Ir,exactEquals:()=>Or,floor:()=>sr,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:()=>ot,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 or(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r}function sr(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],o=e[2]-r[2];return Math.sqrt(t*t+i*i+o*o)}function it(r,e){let t=e[0]-r[0],i=e[1]-r[1],o=e[2]-r[2];return t*t+i*i+o*o}function ot(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],o=e[2],s=t*t+i*i+o*o;return s>0&&(s=1/Math.sqrt(s)),r[0]=e[0]*s,r[1]=e[1]*s,r[2]=e[2]*s,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],o=e[1],s=e[2],n=t[0],a=t[1],l=t[2];return r[0]=o*l-s*a,r[1]=s*n-i*l,r[2]=i*a-o*n,r}function mr(r,e,t,i){let o=e[0],s=e[1],n=e[2];return r[0]=o+i*(t[0]-o),r[1]=s+i*(t[1]-s),r[2]=n+i*(t[2]-n),r}function hr(r,e,t,i){let o=Math.acos(Math.min(Math.max(be(e,t),-1),1)),s=Math.sin(o),n=Math.sin((1-i)*o)/s,a=Math.sin(i*o)/s;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,o,s){let n=s*s,a=n*(2*s-3)+1,l=n*(s-2)+s,f=n*(s-1),c=n*(3-2*s);return r[0]=e[0]*a+t[0]*l+i[0]*f+o[0]*c,r[1]=e[1]*a+t[1]*l+i[1]*f+o[1]*c,r[2]=e[2]*a+t[2]*l+i[2]*f+o[2]*c,r}function gr(r,e,t,i,o,s){let n=1-s,a=n*n,l=s*s,f=a*n,c=3*s*a,u=3*l*n,_=l*s;return r[0]=e[0]*f+t[0]*c+i[0]*u+o[0]*_,r[1]=e[1]*f+t[1]*c+i[1]*u+o[1]*_,r[2]=e[2]*f+t[2]*c+i[2]*u+o[2]*_,r}function xr(r,e){e=e===void 0?1:e;let t=ye()*2*Math.PI,i=ye()*2-1,o=Math.sqrt(1-i*i)*e;return r[0]=Math.cos(t)*o,r[1]=Math.sin(t)*o,r[2]=i*e,r}function Pr(r,e,t){let i=e[0],o=e[1],s=e[2],n=t[3]*i+t[7]*o+t[11]*s+t[15];return n=n||1,r[0]=(t[0]*i+t[4]*o+t[8]*s+t[12])/n,r[1]=(t[1]*i+t[5]*o+t[9]*s+t[13])/n,r[2]=(t[2]*i+t[6]*o+t[10]*s+t[14])/n,r}function yr(r,e,t){let i=e[0],o=e[1],s=e[2];return r[0]=i*t[0]+o*t[3]+s*t[6],r[1]=i*t[1]+o*t[4]+s*t[7],r[2]=i*t[2]+o*t[5]+s*t[8],r}function Tr(r,e,t){let i=t[0],o=t[1],s=t[2],n=t[3],a=e[0],l=e[1],f=e[2],c=o*f-s*l,u=s*a-i*f,_=i*l-o*a,p=o*_-s*u,x=s*c-i*_,$=i*u-o*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 o=[],s=[];return o[0]=e[0]-t[0],o[1]=e[1]-t[1],o[2]=e[2]-t[2],s[0]=o[0],s[1]=o[1]*Math.cos(i)-o[2]*Math.sin(i),s[2]=o[1]*Math.sin(i)+o[2]*Math.cos(i),r[0]=s[0]+t[0],r[1]=s[1]+t[1],r[2]=s[2]+t[2],r}function Ar(r,e,t,i){let o=[],s=[];return o[0]=e[0]-t[0],o[1]=e[1]-t[1],o[2]=e[2]-t[2],s[0]=o[2]*Math.sin(i)+o[0]*Math.cos(i),s[1]=o[1],s[2]=o[2]*Math.cos(i)-o[0]*Math.sin(i),r[0]=s[0]+t[0],r[1]=s[1]+t[1],r[2]=s[2]+t[2],r}function Er(r,e,t,i){let o=[],s=[];return o[0]=e[0]-t[0],o[1]=e[1]-t[1],o[2]=e[2]-t[2],s[0]=o[0]*Math.cos(i)-o[1]*Math.sin(i),s[1]=o[0]*Math.sin(i)+o[1]*Math.cos(i),s[2]=o[2],r[0]=s[0]+t[0],r[1]=s[1]+t[1],r[2]=s[2]+t[2],r}function Mr(r,e){let t=r[0],i=r[1],o=r[2],s=e[0],n=e[1],a=e[2],l=Math.sqrt((t*t+i*i+o*o)*(s*s+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],o=r[2],s=e[0],n=e[1],a=e[2];return Math.abs(t-s)<=1e-6*Math.max(1,Math.abs(t),Math.abs(s))&&Math.abs(i-n)<=1e-6*Math.max(1,Math.abs(i),Math.abs(n))&&Math.abs(o-a)<=1e-6*Math.max(1,Math.abs(o),Math.abs(a))}var Rr=Je,Cr=et,Sr=tt,kr=rt,Nr=it,Br=Qe,wr=ot,Dr=function(){let r=Xe();return function(e,t,i,o,s,n){let a,l;for(t||(t=3),i||(i=0),o?l=Math.min(o*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],s(r,r,n),e[a]=r[0],e[a+1]=r[1],e[a+2]=r[2];return e}}();var oe=d(m(),1);var st=`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}=
|
|
913
|
+
`;var{fp64ify:Vr,fp64ifyMatrix4:jr}=re,se={name:"project64",dependencies:[oe.project,re],vs:st,getUniforms:Gr},zr=(0,oe._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:[se]}}},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;
|
|
@@ -955,7 +955,7 @@ discard;
|
|
|
955
955
|
}
|
|
956
956
|
}
|
|
957
957
|
}
|
|
958
|
-
`}},
|
|
958
|
+
`}},at={inject:{"vs:#decl":`
|
|
959
959
|
in float instanceOffsets;
|
|
960
960
|
`,"vs:DECKGL_FILTER_SIZE":`
|
|
961
961
|
float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
|
|
@@ -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},
|
|
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:o=>{o.constant=!0,o.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,o=Array.isArray(e[0]),s=o?e.length:e.length/i,n,a;for(let l=0;l<s-1;l++)n=o?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[s-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,12 +1020,12 @@ 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:o}=e,s=[(0,B.fp64LowPart)(o[0]),(0,B.fp64LowPart)(o[1])];return{fill_uvCoordinateOrigin:o.slice(0,2),fill_uvCoordinateOrigin64Low:s,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];
|
|
1027
1027
|
}
|
|
1028
|
-
`,Xr={name:"clip-vs",vs:
|
|
1028
|
+
`,Xr={name:"clip-vs",vs:ut},Qr={"vs:#decl":`
|
|
1029
1029
|
out float clip_isVisible;
|
|
1030
1030
|
`,"vs:DECKGL_FILTER_GL_POSITION":`
|
|
1031
1031
|
clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));
|
|
@@ -1033,7 +1033,7 @@ clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));
|
|
|
1033
1033
|
in float clip_isVisible;
|
|
1034
1034
|
`,"fs:DECKGL_FILTER_COLOR":`
|
|
1035
1035
|
if (clip_isVisible < 0.5) discard;
|
|
1036
|
-
`},Jr={name:"clip-fs",fs:
|
|
1036
|
+
`},Jr={name:"clip-fs",fs:ut},ei={"vs:#decl":`
|
|
1037
1037
|
out vec2 clip_commonPosition;
|
|
1038
1038
|
`,"vs:DECKGL_FILTER_GL_POSITION":`
|
|
1039
1039
|
clip_commonPosition = geometry.position.xy;
|
|
@@ -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
|
-
`},
|
|
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]),o=this.projectPosition([t[2],t[3],0]);e.clip_bounds=[Math.min(i[0],o[0]),Math.min(i[1],o[1]),Math.max(i[0],o[0]),Math.max(i[1],o[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,13 +1101,13 @@ 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:o}=r;return{collision_sort:Boolean(i),collision_texture:!i&&t?t.colorAttachments[0]:o}},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 o=[0,0,0,0],s=[1,1,e.width-2*1,e.height-2*1];this.render({...t,clearColor:o,scissorRect:s,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:o,onViewportActive:s,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=o[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:s,views:n,viewport:x,viewportChanged:$})}}_render(e,{effects:t,layerFilter:i,onViewportActive:o,views:s,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:o,views:s,moduleParameters:{dummyCollisionMap:this.dummyCollisionMap,devicePixelRatio:u.device.canvasContext.getDevicePixelRatio()/Ee}})}}_groupByCollisionGroup(e,t){let i={};for(let o of t){let{collisionGroup:s}=o.props,n=i[s];n||(n={collisionGroup:s,layers:[],layerBounds:[],allLayersLoaded:!0},i[s]=n),n.layers.push(o),n.layerBounds.push(o.getBounds()),o.isLoaded||(n.allLayersLoaded=!1)}for(let o of Object.keys(i))this.collisionFBOs[o]||this.createFBO(e,o),this.channels[o]||(this.channels[o]=i[o]);for(let o of Object.keys(this.collisionFBOs))i[o]||this.destroyFBO(o);return i}getModuleParameters(e){let{collisionGroup:t}=e.props,{collisionFBOs:i,dummyCollisionMap:o}=this;return{collisionFBO:i[t],dummyCollisionMap:o}}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:o}=e.gl.canvas,s=e.createTexture({format:"rgba8unorm",width:i,height:o,sampler:{minFilter:"nearest",magFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),n=e.createTexture({format:"depth16unorm",width:i,height:o,mipmaps:!1,dataFormat:6402,type:5125});this.collisionFBOs[t]=e.createFramebuffer({id:`collision-${t}`,width:i,height:o,colorAttachments:[s],depthStencilAttachment:n})}destroyFBO(e){let t=this.collisionFBOs[e];t.colorAttachments[0]?.destroy(),t.depthStencilAttachment?.destroy(),t.destroy(),delete this.collisionFBOs[e]}};var oi={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:o}=this.props,{collisionFBO:s,drawToCollisionMap:n}=i,a=o&&Boolean(s);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=oi})(),(()=>{fe.extensionName="CollisionFilterExtension"})();var y=d(m(),1);var vt=d(m(),1);var si=`
|
|
1105
1105
|
uniform vec4 mask_bounds;
|
|
1106
1106
|
uniform bool mask_maskByInstance;
|
|
1107
1107
|
vec2 mask_getCoords(vec4 position) {
|
|
1108
1108
|
return (position.xy - mask_bounds.xy) / (mask_bounds.zw - mask_bounds.xy);
|
|
1109
1109
|
}
|
|
1110
|
-
`,
|
|
1110
|
+
`,ni=`
|
|
1111
1111
|
uniform sampler2D mask_texture;
|
|
1112
1112
|
uniform int mask_channel;
|
|
1113
1113
|
uniform bool mask_enabled;
|
|
@@ -1133,7 +1133,7 @@ return maskValue >= 0.5;
|
|
|
1133
1133
|
return maskValue < 0.5;
|
|
1134
1134
|
}
|
|
1135
1135
|
}
|
|
1136
|
-
`,
|
|
1136
|
+
`,ai={"vs:#decl":`
|
|
1137
1137
|
out vec2 mask_texCoords;
|
|
1138
1138
|
`,"vs:#main-end":`
|
|
1139
1139
|
vec4 mask_common_position;
|
|
@@ -1151,13 +1151,13 @@ bool mask = mask_isInBounds(mask_texCoords);
|
|
|
1151
1151
|
fragColor = texture(mask_texture, mask_texCoords);
|
|
1152
1152
|
if (!mask) discard;
|
|
1153
1153
|
}
|
|
1154
|
-
`},
|
|
1155
|
-
`),
|
|
1154
|
+
`},li=r=>r&&"maskMap"in r?{mask_texture:r.maskMap}:{},gt={name:"mask",dependencies:[vt.project],vs:si,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 o=i.getBounds();if(o){let s=i.projectPosition(o[0],{viewport:e,autoOffset:!1}),n=i.projectPosition(o[1],{viewport:e,autoOffset:!1});t[0]=Math.min(t[0],s[0]),t[1]=Math.min(t[1],s[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:o}=t;if(e[2]<=e[0]||e[3]<=e[1])return null;let s=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 o?new ce.WebMercatorViewport({id:t.id,x:i,y:i,width:n,height:a,longitude:s[0],latitude:s[1],zoom:l,orthographic:!0}):new ce.OrthographicViewport({id:t.id,x:i,y:i,width:n,height:a,target:s,zoom:l,flipY:!1})}function ui(r,e){let t;if(e&&e.length===2){let[s,n]=e,a=r.getBounds({z:s}),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)),o=r.projectPosition(t.slice(2,4));return[i[0],i[1],o[0],o[1]]}function M(r,e,t){if(!r)return[0,0,1,1];let i=ui(e,t),o=_i(i);return r[2]-r[0]<=o[2]-o[0]&&r[3]-r[1]<=o[3]-o[1]?r:[Math.max(r[0],o[0]),Math.max(r[1],o[1]),Math.min(r[2],o[2]),Math.min(r[3],o[3])]}function _i(r){let e=r[2]-r[0],t=r[3]-r[1],i=(r[0]+r[2])/2,o=(r[1]+r[3])/2;return[i-e,o-t,i+e,o+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:o,views:s,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:o,views:s,viewport:c,viewportChanged:u});a||=p}return{didRender:a}}_renderChannel(e,{layerFilter:t,onViewportActive:i,views:o,viewport:s,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=s;let c=A(e.layers,s);if(e.bounds=c&&M(c,s),f||!b(e.bounds,l.bounds)){let{maskPass:u,maskMap:_}=this,p=c&&E({bounds:e.bounds,viewport:s,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:o,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 o of e){let{id:s}=o.root,n=t[s];if(!n){if(++i>4){Me.log.warn("Too many mask layers. The max supported is 4")();continue}n={id:s,index:this.channels.findIndex(a=>a?.id===s),layers:[],layerBounds:[],coordinateOrigin:o.root.props.coordinateOrigin,coordinateSystem:o.root.props.coordinateSystem},t[s]=n}n.layers.push(o),n.layerBounds.push(o.getBounds())}for(let o=0;o<4;o++){let s=this.channels[o];(!s||!(s.id in t))&&(this.channels[o]=null)}for(let o in t){let s=t[o];s.index<0&&(s.index=this.channels.findIndex(n=>!n),this.channels[s.index]=s)}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:o,maskInverted:s}=this.props,{maskChannels:n}=i,{viewport:a}=t;if(n&&n[o]){let{index:l,bounds:f,coordinateOrigin:c}=n[o],{coordinateSystem:u}=n[o];e.mask_enabled=!0,e.mask_channel=l,e.mask_inverted=s,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 o&&y.log.warn(`Could not find a mask layer with id: ${o}`)(),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
|
+
`),W={name:"terrain",dependencies:[yt.project],inject:{"vs:#decl":`
|
|
1156
1156
|
uniform float terrain_mode;
|
|
1157
1157
|
uniform sampler2D terrain_map;
|
|
1158
1158
|
uniform vec4 terrain_bounds;
|
|
1159
1159
|
out vec3 commonPos;
|
|
1160
|
-
`+
|
|
1160
|
+
`+Pt,"vs:#main-start":`
|
|
1161
1161
|
if (terrain_mode == TERRAIN_MODE_SKIP) {
|
|
1162
1162
|
gl_Position = vec4(0.0);
|
|
1163
1163
|
return;
|
|
@@ -1185,7 +1185,7 @@ uniform float terrain_mode;
|
|
|
1185
1185
|
uniform sampler2D terrain_map;
|
|
1186
1186
|
uniform vec4 terrain_bounds;
|
|
1187
1187
|
in vec3 commonPos;
|
|
1188
|
-
`+
|
|
1188
|
+
`+Pt,"fs:#main-start":`
|
|
1189
1189
|
if (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {
|
|
1190
1190
|
fragColor = vec4(commonPos.z, 0.0, 0.0, 1.0);
|
|
1191
1191
|
return;
|
|
@@ -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:o,dummyHeightMap:s,terrainCover:n,useTerrainHeightMap:a,terrainSkipRender:l}=r,{project_uCommonOrigin:f}=e,c=l?g.SKIP:g.NONE,u=s,_=null;if(t)c=g.WRITE_HEIGHT_MAP,_=o;else if(a&&i)c=g.USE_HEIGHT_MAP,u=i,_=o;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=s}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:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}})]})}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:o}){e&&(this.targetLayer=e);let s=t?this._updateViewport(t):!1,n=i?this._updateLayers(i):!1;if(o){for(let a of this.layers)if(o[a]){n=!0;break}}return n||s}_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 s=e.projectPosition(this.targetBounds[0]),n=e.projectPosition(this.targetBounds[1]);this.targetBoundsCommon=[s[0],s[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 o=Math.ceil(e.zoom+.5);if(this.tile)this.bounds=this.targetBoundsCommon;else{let s=this.renderViewport?.zoom;i=i||o!==s;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:o,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`})),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,o=[],s=this._getDrawLayerParams(e,t,!0);for(let n=0;n<i.length;n++){let a=i[n];!a.isComposite&&s[n].shouldDrawLayer&&o.push(a)}return o}renderHeightMap(e,t){let i=e.getRenderFramebuffer(),o=e.renderViewport;!i||!o||(i.resize(o),this.render({...t,target:i,pass:"terrain-height-map",layers:t.layers,viewports:[o],effects:[],clearColor:[0,0,0,0]}))}renderTerrainCover(e,t){let i=e.getRenderFramebuffer(),o=e.renderViewport;if(!i||!o)return;let s=e.filterLayers(t.layers);i.resize(o),this.render({...t,target:i,pass:`terrain-cover-${e.id}`,layers:s,effects:[],viewports:[o],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,o=[];this.drawParameters={},this._resetColorEncoder(t.pickZ);let s=this._getDrawLayerParams(e,t);for(let n=0;n<i.length;n++){let a=i[n];!a.isComposite&&s[n].shouldDrawLayer&&(o.push(a),this.drawParameters[a.id]=s[n].layerParameters)}return o}renderTerrainCover(e,t){let i=e.getPickingFramebuffer(),o=e.renderViewport;if(!i||!o)return;let s=e.filterLayers(t.layers),n=e.targetLayer;n.props.pickable&&s.unshift(n),i.resize(o),this.render({...t,pickingFBO:i,pass:`terrain-cover-picking-${e.id}`,layers:s,effects:[],viewports:[o],cullRect:void 0,deviceRect:o,pickZ:!1})}getLayerParameters(e,t,i){let o;return this.drawParameters[e.id]?o=this.drawParameters[e.id]:(o=super.getLayerParameters(e,t,i),o.blend=!0),{...o,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((s,n)=>s!==this.layers[n]||s.props.transitions||s.getBounds()!==this.layersBounds[n]);i&&(this.layers=e,this.layersBounds=e.map(s=>s.getBounds()),this.layersBoundsCommon=A(e,t));let o=!this.lastViewport||!t.equals(this.lastViewport);if(!this.layersBoundsCommon)this.renderViewport=null;else if(i||o){let s=M(this.layersBoundsCommon,t);if(s[2]<=s[0]||s[3]<=s[1])return this.renderViewport=null,!1;this.bounds=s,this.lastViewport=t;let n=t.scale,a=(s[2]-s[0])*n,l=(s[3]-s[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 o=t[0],s=(i?this.terrainPickingPass:this.terrainPass).getRenderableLayers(o,e),n=s.filter(l=>l.props.operation.includes("terrain"));if(n.length===0)return;i||s.filter(f=>f.state.terrainDrawMode==="offset").length>0&&this._updateHeightMap(n,o,e);let a=s.filter(l=>l.state.terrainDrawMode==="drape");this._updateTerrainCovers(n,a,o,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,o){let s={};for(let n of t)n.state.terrainCoverNeedsRedraw&&(s[n.id]=!0,n.state.terrainCoverNeedsRedraw=!1);for(let n of this.terrainCovers.values())n.isDirty=n.isDirty||n.shouldUpdate({layerNeedsRedraw:s});for(let n of e)this._updateTerrainCover(n,t,i,o);this.isPicking||this._pruneTerrainCovers()}_updateTerrainCover(e,t,i,o){let s=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)&&(s.renderTerrainCover(n,{...o,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:o}=t;if(!o){let s=this.props.extruded,n=this.getAttributeManager()?.attributes,a=n&&"instancePositions"in n;o=s||a?"offset":"drape"}this.setState({terrainDrawMode:o})}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.1",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"prepublishOnly": "npm run build-bundle && npm run build-bundle -- --env=dev"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@luma.gl/constants": "^9.0.
|
|
42
|
-
"@luma.gl/shadertools": "^9.0.
|
|
41
|
+
"@luma.gl/constants": "^9.0.6",
|
|
42
|
+
"@luma.gl/shadertools": "^9.0.6",
|
|
43
43
|
"@math.gl/core": "^4.0.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@deck.gl/core": "^9.0.0
|
|
46
|
+
"@deck.gl/core": "^9.0.0",
|
|
47
47
|
"@luma.gl/core": "^9.0.0",
|
|
48
48
|
"@luma.gl/engine": "^9.0.0"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "e1ef9a3550b120766edbceee28b888c6246caf21"
|
|
51
51
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Device, Framebuffer, Texture} from '@luma.gl/core';
|
|
2
2
|
import {equals} from '@math.gl/core';
|
|
3
3
|
import {_deepEqual as deepEqual} from '@deck.gl/core';
|
|
4
|
-
import type {Effect, Layer, PreRenderOptions, Viewport} from '@deck.gl/core';
|
|
4
|
+
import type {Effect, EffectContext, Layer, PreRenderOptions, Viewport} from '@deck.gl/core';
|
|
5
5
|
import CollisionFilterPass from './collision-filter-pass';
|
|
6
6
|
import MaskEffect, {MaskPreRenderStats} from '../mask/mask-effect';
|
|
7
7
|
// import {debugFBO} from '../utils/debug';
|
|
@@ -27,28 +27,32 @@ export default class CollisionFilterEffect implements Effect {
|
|
|
27
27
|
useInPicking = true;
|
|
28
28
|
order = 1;
|
|
29
29
|
|
|
30
|
+
private context?: EffectContext;
|
|
30
31
|
private channels: Record<string, RenderInfo> = {};
|
|
31
32
|
private collisionFilterPass?: CollisionFilterPass;
|
|
32
33
|
private collisionFBOs: Record<string, Framebuffer> = {};
|
|
33
34
|
private dummyCollisionMap?: Texture;
|
|
34
35
|
private lastViewport?: Viewport;
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
37
|
+
setup(context: EffectContext) {
|
|
38
|
+
this.context = context;
|
|
39
|
+
const {device} = context;
|
|
40
|
+
this.dummyCollisionMap = device.createTexture({width: 1, height: 1});
|
|
41
|
+
this.collisionFilterPass = new CollisionFilterPass(device, {id: 'default-collision-filter'});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
preRender({
|
|
45
|
+
effects: allEffects,
|
|
46
|
+
layers,
|
|
47
|
+
layerFilter,
|
|
48
|
+
viewports,
|
|
49
|
+
onViewportActive,
|
|
50
|
+
views,
|
|
51
|
+
isPicking,
|
|
52
|
+
preRenderStats = {}
|
|
53
|
+
}: PreRenderOptions): void {
|
|
54
|
+
// This can only be called in preRender() after setup() where context is populated
|
|
55
|
+
const {device} = this.context!;
|
|
52
56
|
|
|
53
57
|
if (isPicking) {
|
|
54
58
|
// Do not update on picking pass
|
|
@@ -64,12 +68,8 @@ export default class CollisionFilterEffect implements Effect {
|
|
|
64
68
|
return;
|
|
65
69
|
}
|
|
66
70
|
|
|
67
|
-
if (!this.collisionFilterPass) {
|
|
68
|
-
this.collisionFilterPass = new CollisionFilterPass(device, {id: 'default-collision-filter'});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
71
|
// Detect if mask has rendered. TODO: better dependency system for Effects
|
|
72
|
-
const effects = allEffects?.filter(e => e.
|
|
72
|
+
const effects = allEffects?.filter(e => e.useInPicking && preRenderStats[e.id]);
|
|
73
73
|
const maskEffectRendered = (preRenderStats['mask-effect'] as MaskPreRenderStats)?.didRender;
|
|
74
74
|
|
|
75
75
|
// Collect layers to render
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Framebuffer} from '@luma.gl/core';
|
|
2
|
-
import {_LayersPass as LayersPass, LayersPassRenderOptions} from '@deck.gl/core';
|
|
2
|
+
import {Layer, _LayersPass as LayersPass, LayersPassRenderOptions, Viewport} from '@deck.gl/core';
|
|
3
3
|
|
|
4
4
|
type CollisionFilterPassRenderOptions = LayersPassRenderOptions & {};
|
|
5
5
|
|
|
@@ -7,17 +7,13 @@ export default class CollisionFilterPass extends LayersPass {
|
|
|
7
7
|
renderCollisionMap(target: Framebuffer, options: CollisionFilterPassRenderOptions) {
|
|
8
8
|
const padding = 1;
|
|
9
9
|
const clearColor = [0, 0, 0, 0];
|
|
10
|
+
const scissorRect = [padding, padding, target.width - 2 * padding, target.height - 2 * padding];
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
depthTest: true,
|
|
17
|
-
depthRange: [0, 1]
|
|
18
|
-
},
|
|
19
|
-
() => this.render({...options, clearColor, target, pass: 'collision'})
|
|
20
|
-
);
|
|
12
|
+
this.render({...options, clearColor, scissorRect, target, pass: 'collision'});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
protected getLayerParameters(layer: Layer, layerIndex: number, viewport: Viewport): any {
|
|
16
|
+
return {...layer.props.parameters, blend: false, depthRange: [0, 1], depthTest: true};
|
|
21
17
|
}
|
|
22
18
|
|
|
23
19
|
getModuleParameters() {
|
|
@@ -138,7 +138,7 @@ export default class DataFilterExtension extends LayerExtension<
|
|
|
138
138
|
static defaultProps = defaultProps;
|
|
139
139
|
static extensionName = 'DataFilterExtension';
|
|
140
140
|
|
|
141
|
-
constructor(opts: DataFilterExtensionOptions) {
|
|
141
|
+
constructor(opts: DataFilterExtensionOptions = {}) {
|
|
142
142
|
super({...defaultOptions, ...opts});
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -5,6 +5,7 @@ import {patternShaders} from './shader-module';
|
|
|
5
5
|
import type {
|
|
6
6
|
Layer,
|
|
7
7
|
LayerContext,
|
|
8
|
+
DefaultProps,
|
|
8
9
|
Accessor,
|
|
9
10
|
AccessorFunction,
|
|
10
11
|
TextureSource,
|
|
@@ -12,15 +13,13 @@ import type {
|
|
|
12
13
|
} from '@deck.gl/core';
|
|
13
14
|
import type {Texture} from '@luma.gl/core';
|
|
14
15
|
|
|
15
|
-
const defaultProps = {
|
|
16
|
+
const defaultProps: DefaultProps<FillStyleExtensionProps> = {
|
|
16
17
|
fillPatternEnabled: true,
|
|
17
18
|
fillPatternAtlas: {
|
|
18
19
|
type: 'image',
|
|
19
20
|
value: null,
|
|
20
21
|
async: true,
|
|
21
|
-
parameters: {
|
|
22
|
-
minFilter: 'linear'
|
|
23
|
-
}
|
|
22
|
+
parameters: {lodMaxClamp: 0}
|
|
24
23
|
},
|
|
25
24
|
fillPatternMapping: {type: 'object', value: {}, async: true},
|
|
26
25
|
fillPatternMask: true,
|