@deck.gl/extensions 9.0.11 → 9.0.13
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/brushing/brushing-extension.d.ts.map +1 -1
- package/dist/brushing/brushing-extension.js +2 -9
- package/dist/brushing/shader-module.d.ts.map +1 -1
- package/dist/brushing/shader-module.js +0 -8
- package/dist/collision-filter/collision-filter-extension.d.ts.map +1 -1
- package/dist/collision-filter/collision-filter-extension.js +2 -5
- package/dist/collision-filter/shader-module.d.ts.map +1 -1
- package/dist/collision-filter/shader-module.js +0 -8
- package/dist/data-filter/data-filter-extension.d.ts.map +1 -1
- package/dist/data-filter/data-filter-extension.js +4 -18
- package/dist/data-filter/shader-module.d.ts +0 -12
- package/dist/data-filter/shader-module.d.ts.map +1 -1
- package/dist/data-filter/shader-module.js +10 -22
- package/dist/dist.dev.js +30 -114
- package/dist/fill-style/fill-style-extension.d.ts.map +1 -1
- package/dist/fill-style/fill-style-extension.js +6 -27
- package/dist/fill-style/shader-module.d.ts.map +1 -1
- package/dist/fill-style/shader-module.js +6 -15
- package/dist/index.cjs +30 -112
- package/dist/index.cjs.map +2 -2
- package/dist.min.js +36 -73
- package/package.json +2 -2
- package/src/brushing/brushing-extension.ts +2 -9
- package/src/brushing/shader-module.ts +0 -8
- package/src/collision-filter/collision-filter-extension.ts +2 -5
- package/src/collision-filter/shader-module.ts +0 -8
- package/src/data-filter/data-filter-extension.ts +4 -18
- package/src/data-filter/shader-module.ts +10 -37
- package/src/fill-style/fill-style-extension.ts +6 -27
- package/src/fill-style/shader-module.ts +6 -16
package/dist.min.js
CHANGED
|
@@ -4,16 +4,12 @@
|
|
|
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
|
|
7
|
+
"use strict";var __exports__=(()=>{var It=Object.create;var Q=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var Rt=Object.getPrototypeOf,Nt=Object.prototype.hasOwnProperty;var Fe=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Oe=(r,e)=>{for(var t in e)Q(r,t,{get:e[t],enumerable:!0})},X=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of kt(e))!Nt.call(r,s)&&s!==t&&Q(r,s,{get:()=>e[s],enumerable:!(o=St(e,s))||o.enumerable});return r},P=(r,e,t)=>(X(r,e,"default"),t&&X(t,e,"default")),d=(r,e,t)=>(t=r!=null?It(Rt(r)):{},X(e||!r||!r.__esModule?Q(t,"default",{value:r,enumerable:!0}):t,r)),wt=r=>X(Q({},"__esModule",{value:!0}),r);var m=Fe((Po,Le)=>{Le.exports=globalThis.deck});var ze=Fe((Ao,je)=>{je.exports=globalThis.luma});var Z={};Oe(Z,{BrushingExtension:()=>F,ClipExtension:()=>D,CollisionFilterExtension:()=>z,DataFilterExtension:()=>O,FillStyleExtension:()=>B,Fp64Extension:()=>k,MaskExtension:()=>q,PathStyleExtension:()=>N,_TerrainExtension:()=>K,project64:()=>ie});var v={},Ce=d(m(),1);P(v,d(m(),1));if(!Ce.Layer)throw new Error("@deck.gl/core is not found");P(Z,v);var ke=d(m(),1);var Ie=d(m(),1);var Bt=`
|
|
8
8
|
uniform bool brushing_enabled;
|
|
9
9
|
uniform int brushing_target;
|
|
10
10
|
uniform vec2 brushing_mousePos;
|
|
11
11
|
uniform float brushing_radius;
|
|
12
|
-
#ifdef NON_INSTANCED_MODEL
|
|
13
12
|
in vec2 brushingTargets;
|
|
14
|
-
#else
|
|
15
|
-
in vec2 instanceBrushingTargets;
|
|
16
|
-
#endif
|
|
17
13
|
out float brushing_isVisible;
|
|
18
14
|
bool brushing_isPointInRange(vec2 position) {
|
|
19
15
|
if (!brushing_enabled) {
|
|
@@ -44,11 +40,7 @@ brushingTarget = geometry.worldPosition.xy;
|
|
|
44
40
|
} else if (brushing_target == 1) {
|
|
45
41
|
brushingTarget = geometry.worldPositionAlt.xy;
|
|
46
42
|
} else {
|
|
47
|
-
#ifdef NON_INSTANCED_MODEL
|
|
48
43
|
brushingTarget = brushingTargets;
|
|
49
|
-
#else
|
|
50
|
-
brushingTarget = instanceBrushingTargets;
|
|
51
|
-
#endif
|
|
52
44
|
}
|
|
53
45
|
bool visible;
|
|
54
46
|
if (brushing_target == 3) {
|
|
@@ -61,7 +53,7 @@ brushing_setVisible(visible);
|
|
|
61
53
|
if (brushing_enabled && brushing_isVisible < 0.5) {
|
|
62
54
|
discard;
|
|
63
55
|
}
|
|
64
|
-
`},
|
|
56
|
+
`},Se={name:"brushing",dependencies:[Ie.project],vs:Bt,fs:Dt,inject:jt,getUniforms:r=>{if(!r||!("viewport"in r))return{};let{brushingEnabled:e=!0,brushingRadius:t=1e4,brushingTarget:o="source",mousePosition:s,viewport:i}=r;return{brushing_enabled:Boolean(e&&s&&i.containsPixel(s)),brushing_radius:t,brushing_target:Vt[o]||0,brushing_mousePos:s?i.unproject([s.x-i.x,s.y-i.y]):[0,0]}}};var zt={getBrushingTarget:{type:"accessor",value:[0,0]},brushingTarget:"source",brushingEnabled:!0,brushingRadius:1e4},J=class extends ke.LayerExtension{getShaders(){return{modules:[Se]}}initializeState(e,t){let o=this.getAttributeManager();o&&o.add({brushingTargets:{size:2,stepMode:"dynamic",accessor:"getBrushingTarget"}});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 o=this.state.onMouseMove;e.deck.eventManager.off({pointermove:o,pointerleave:o})}}},F=J;(()=>{J.defaultProps=zt})(),(()=>{J.extensionName="BrushingExtension"})();var b=d(m(),1);var Re=`
|
|
65
57
|
uniform bool filter_useSoftMargin;
|
|
66
58
|
uniform bool filter_enabled;
|
|
67
59
|
uniform bool filter_transformSize;
|
|
@@ -71,27 +63,15 @@ uniform DATAFILTER_TYPE filter_min;
|
|
|
71
63
|
uniform DATAFILTER_TYPE filter_softMin;
|
|
72
64
|
uniform DATAFILTER_TYPE filter_softMax;
|
|
73
65
|
uniform DATAFILTER_TYPE filter_max;
|
|
74
|
-
|
|
75
|
-
#define DATAFILTER_ATTRIB filterValues
|
|
76
|
-
#define DATAFILTER_ATTRIB_64LOW filterValues64Low
|
|
77
|
-
#else
|
|
78
|
-
#define DATAFILTER_ATTRIB instanceFilterValues
|
|
79
|
-
#define DATAFILTER_ATTRIB_64LOW instanceFilterValues64Low
|
|
80
|
-
#endif
|
|
81
|
-
in DATAFILTER_TYPE DATAFILTER_ATTRIB;
|
|
66
|
+
in DATAFILTER_TYPE filterValues;
|
|
82
67
|
#ifdef DATAFILTER_DOUBLE
|
|
83
|
-
in DATAFILTER_TYPE
|
|
68
|
+
in DATAFILTER_TYPE filterValues64Low;
|
|
84
69
|
uniform DATAFILTER_TYPE filter_min64High;
|
|
85
70
|
uniform DATAFILTER_TYPE filter_max64High;
|
|
86
71
|
#endif
|
|
87
72
|
#endif
|
|
88
73
|
#ifdef DATACATEGORY_TYPE
|
|
89
|
-
|
|
90
|
-
#define DATACATEGORY_ATTRIB filterCategoryValues
|
|
91
|
-
#else
|
|
92
|
-
#define DATACATEGORY_ATTRIB instanceFilterCategoryValues
|
|
93
|
-
#endif
|
|
94
|
-
in DATACATEGORY_TYPE DATACATEGORY_ATTRIB;
|
|
74
|
+
in DATACATEGORY_TYPE filterCategoryValues;
|
|
95
75
|
#endif
|
|
96
76
|
out float dataFilter_value;
|
|
97
77
|
float dataFilter_reduceValue(float value) {
|
|
@@ -127,7 +107,7 @@ step(filter_min, valueFromMin) * step(valueFromMax, filter_max)
|
|
|
127
107
|
}
|
|
128
108
|
}
|
|
129
109
|
#endif
|
|
130
|
-
#ifdef
|
|
110
|
+
#ifdef DATACATEGORY_TYPE
|
|
131
111
|
void dataFilter_setCategoryValue(DATACATEGORY_TYPE category) {
|
|
132
112
|
#if DATACATEGORY_CHANNELS == 1
|
|
133
113
|
int dataFilter_masks = filter_categoryBitMask[int(category / 32.0)];
|
|
@@ -153,21 +133,21 @@ if(any(equal(dataFilter_bits, DATACATEGORY_TYPE(0.0)))) dataFilter_value = 0.0;
|
|
|
153
133
|
`,Ne=`
|
|
154
134
|
uniform bool filter_transformColor;
|
|
155
135
|
in float dataFilter_value;
|
|
156
|
-
`;function
|
|
136
|
+
`;function we(r){if(!r||!("extensions"in r))return{};let{filterRange:e=[-1,1],filterEnabled:t=!0,filterTransformSize:o=!0,filterTransformColor:s=!0}=r,i=r.filterSoftRange||e;return{...Number.isFinite(e[0])?{filter_min:e[0],filter_softMin:i[0],filter_softMax:i[1],filter_max:e[1]}:{filter_min:e.map(n=>n[0]),filter_softMin:i.map(n=>n[0]),filter_softMax:i.map(n=>n[1]),filter_max:e.map(n=>n[1])},filter_enabled:t,filter_useSoftMargin:Boolean(r.filterSoftRange),filter_transformSize:t&&o,filter_transformColor:t&&s}}function Ut(r){if(!r||!("extensions"in r))return{};let e=we(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 o=Math.fround(e.filter_max);e.filter_max-=o,e.filter_softMax-=o,e.filter_max64High=o}else{let t=e.filter_min.map(Math.fround);e.filter_min=e.filter_min.map((s,i)=>s-t[i]),e.filter_softMin=e.filter_softMin.map((s,i)=>s-t[i]),e.filter_min64High=t;let o=e.filter_max.map(Math.fround);e.filter_max=e.filter_max.map((s,i)=>s-o[i]),e.filter_softMax=e.filter_softMax.map((s,i)=>s-o[i]),e.filter_max64High=o}return e}var Be={"vs:#main-start":`
|
|
157
137
|
dataFilter_value = 1.0;
|
|
158
138
|
if (filter_enabled) {
|
|
159
|
-
#ifdef
|
|
139
|
+
#ifdef DATAFILTER_TYPE
|
|
160
140
|
#ifdef DATAFILTER_DOUBLE
|
|
161
141
|
dataFilter_setValue(
|
|
162
|
-
|
|
163
|
-
|
|
142
|
+
filterValues - filter_min64High + filterValues64Low,
|
|
143
|
+
filterValues - filter_max64High + filterValues64Low
|
|
164
144
|
);
|
|
165
145
|
#else
|
|
166
|
-
dataFilter_setValue(
|
|
146
|
+
dataFilter_setValue(filterValues, filterValues);
|
|
167
147
|
#endif
|
|
168
148
|
#endif
|
|
169
|
-
#ifdef
|
|
170
|
-
dataFilter_setCategoryValue(
|
|
149
|
+
#ifdef DATACATEGORY_TYPE
|
|
150
|
+
dataFilter_setCategoryValue(filterCategoryValues);
|
|
171
151
|
#endif
|
|
172
152
|
}
|
|
173
153
|
`,"vs:#main-end":`
|
|
@@ -183,7 +163,7 @@ if (dataFilter_value == 0.0) discard;
|
|
|
183
163
|
if (filter_transformColor) {
|
|
184
164
|
color.a *= dataFilter_value;
|
|
185
165
|
}
|
|
186
|
-
`},De={name:"data-filter",vs:
|
|
166
|
+
`},De={name:"data-filter",vs:Re,fs:Ne,inject:Be,getUniforms:we},Ve={name:"data-filter-fp64",vs:Re,fs:Ne,inject:Be,getUniforms:Ut};var Ue=d(ze(),1);var Gt=`#version 300 es
|
|
187
167
|
#define SHADER_NAME data-filter-vertex-shader
|
|
188
168
|
|
|
189
169
|
#ifdef FLOAT_TARGET
|
|
@@ -228,7 +208,7 @@ void main() {
|
|
|
228
208
|
}
|
|
229
209
|
fragColor = vColor;
|
|
230
210
|
}
|
|
231
|
-
`,
|
|
211
|
+
`,Ht=["float32-renderable-webgl","texture-blend-float-webgl"];function Ge(r){return Ht.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 He(r,e,t){return e.defines.NON_INSTANCED_MODEL=1,t&&(e.defines.FLOAT_TARGET=1),new Ue.Model(r,{id:"data-filter-aggregation-model",vertexCount:1,isInstanced:!1,drawMode:0,vs:Gt,fs:qt,...e})}var Ye={blend:!0,blendFunc:[1,1,1,1],blendEquation:[32774,32774],depthTest:!1};var Wt={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:0,filterSize:1,fp64:!1,countItems:!1},We={1:"float",2:"vec2",3:"vec3",4:"vec4"},ee=class extends b.LayerExtension{constructor(e={}){super({...Kt,...e})}getShaders(e){let{categorySize:t,filterSize:o,fp64:s}=e.opts,i={};return t&&(i.DATACATEGORY_TYPE=We[t],i.DATACATEGORY_CHANNELS=t),o&&(i.DATAFILTER_TYPE=We[o],i.DATAFILTER_DOUBLE=Boolean(s)),{modules:[s?Ve:De],defines:i}}initializeState(e,t){let o=this.getAttributeManager(),{categorySize:s,filterSize:i,fp64:n}=t.opts;o&&(i&&o.add({filterValues:{size:i,type:n?"float64":"float32",stepMode:"dynamic",accessor:"getFilterValue"}}),s&&o.add({filterCategoryValues:{size:s,stepMode:"dynamic",accessor:"getFilterCategory",transform:s===1?l=>t._getCategoryKey.call(this,l,0):l=>l.map((f,c)=>t._getCategoryKey.call(this,f,c))}}));let{device:a}=this.context;if(o&&t.opts.countItems){let l=Ge(a);o.add({filterIndices:{size:l?1:2,vertexOffset:1,type:"unorm8",accessor:(u,{index:p})=>{let _=u&&u.__source?u.__source.index:p;return l?(_+1)%255:[(_+1)%255,Math.floor(_/255)%255]},shaderAttributes:{filterPrevIndices:{vertexOffset:0},filterIndices:{vertexOffset:1}}}});let f=qe(a,l),c=He(a,t.getShaders.call(this,t),l);this.setState({filterFBO:f,filterModel:c})}}updateState({props:e,oldProps:t,changeFlags:o},s){let i=this.getAttributeManager(),{categorySize:n}=s.opts;if(this.state.filterModel){let a=i.attributes.filterValues?.needsUpdate()||i.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(i?.attributes.filterCategoryValues){let a=i.attributes.filterCategoryValues.needsUpdate()||!(0,b._deepEqual)(e.filterCategories,t.filterCategories,2);a&&this.setState({categoryBitMaskNeedsUpdate:a}),o.dataChanged&&(this.setState({categoryMap:Array(n).fill(0).map(()=>({}))}),i.attributes.filterCategoryValues.setNeedsUpdate("categoryMap"))}}draw(e,t){let o=this.state.filterFBO,s=this.state.filterModel,i=this.state.filterNeedsUpdate,n=this.state.categoryBitMaskNeedsUpdate,{onFilteredItemsChange:a}=this.props;if(n&&t._updateCategoryBitMask.call(this,e,t),i&&a&&s){let{attributes:{filterValues:l,filterCategoryValues:f,filterIndices:c}}=this.getAttributeManager();s.setVertexCount(this.getNumInstances()),this.context.device.clearWebGL({framebuffer:o,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:o,...Ye,viewport:[0,0,o.width,o.height]},()=>{s.draw(this.context.renderPass)});let u=s.device.readPixelsToArrayWebGL(o),p=0;for(let _=0;_<u.length;_++)p+=u[_];a({id:this.id,count:p}),this.state.filterNeedsUpdate=!1}}finalizeState(){let e=this.state.filterFBO,t=this.state.filterModel;e?.destroy(),t?.destroy()}_updateCategoryBitMask(e,t){let{categorySize:o}=t.opts,{filterCategories:s}=this.props,i=new Uint32Array([0,0,0,0]),n=o===1?[s]:s,a=o===1?128:o===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 p=l*(a/32)+Math.floor(u/32);i[p]+=Math.pow(2,u%32)}else b.log.warn(`Exceeded maximum number of categories (${a})`)()}}e.uniforms.filter_categoryBitMask=i,this.state.categoryBitMaskNeedsUpdate=!1}_getCategoryKey(e,t){let o=this.state.categoryMap[t];return e in o||(o[e]=Object.keys(o).length),o[e]}},O=ee;(()=>{ee.defaultProps=Wt})(),(()=>{ee.extensionName="DataFilterExtension"})();var S=d(m(),1);function te(r,e=[],t=0){let o=Math.fround(r),s=r-o;return e[t]=o,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 o=0;o<4;++o){let s=t*4+o;te(r[o*4+t],e,s*2)}return e}var Ke=`uniform float ONE;
|
|
232
212
|
vec2 split(float a) {
|
|
233
213
|
const float SPLIT = 4097.0;
|
|
234
214
|
float t = a * SPLIT;
|
|
@@ -873,7 +853,7 @@ tmp[j] = b[j + i * 4];
|
|
|
873
853
|
vec4_dot_fp64(a, tmp, out_val[i]);
|
|
874
854
|
}
|
|
875
855
|
}
|
|
876
|
-
`;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
|
|
856
|
+
`;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 wo=1/Math.PI*180,Bo=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 L=globalThis.mathgl.config;function Pe(r){return Array.isArray(r)||ArrayBuffer.isView(r)&&!(r instanceof DataView)}function M(r,e,t){let o=L.EPSILON;t&&(L.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(!M(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)<=L.EPSILON*Math.max(1,Math.abs(r),Math.abs(e)):!1}finally{L.EPSILON=o}}var C=typeof Float32Array<"u"?Float32Array:Array,ye=Math.random;function oe(r){return r>=0?Math.round(r):r%.5===0?Math.floor(r):Math.round(r)}var Vo=Math.PI/180;var I={};Oe(I,{add:()=>or,angle:()=>Ar,bezier:()=>gr,ceil:()=>sr,clone:()=>Jt,copy:()=>tr,create:()=>Xe,cross:()=>dr,dist:()=>Rr,distance:()=>rt,div:()=>kr,divide:()=>tt,dot:()=>Me,equals:()=>Cr,exactEquals:()=>Lr,floor:()=>ir,forEach:()=>Dr,fromValues:()=>er,hermite:()=>vr,inverse:()=>pr,len:()=>wr,length:()=>Qe,lerp:()=>mr,max:()=>ar,min:()=>nr,mul:()=>Sr,multiply:()=>et,negate:()=>ur,normalize:()=>_r,random:()=>xr,rotateX:()=>Mr,rotateY:()=>Er,rotateZ:()=>Tr,round:()=>lr,scale:()=>fr,scaleAndAdd:()=>cr,set:()=>rr,slerp:()=>hr,sqrDist:()=>Nr,sqrLen:()=>Br,squaredDistance:()=>ot,squaredLength:()=>st,str:()=>Or,sub:()=>Ir,subtract:()=>Je,transformMat3:()=>yr,transformMat4:()=>Pr,transformQuat:()=>br,zero:()=>Fr});function Xe(){let r=new C(3);return C!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Jt(r){let e=new C(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],o=r[2];return Math.sqrt(e*e+t*t+o*o)}function er(r,e,t){let o=new C(3);return o[0]=r,o[1]=e,o[2]=t,o}function tr(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function rr(r,e,t,o){return r[0]=e,r[1]=t,r[2]=o,r}function or(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 ir(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]=oe(e[0]),r[1]=oe(e[1]),r[2]=oe(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,o){return r[0]=e[0]+t[0]*o,r[1]=e[1]+t[1]*o,r[2]=e[2]+t[2]*o,r}function rt(r,e){let t=e[0]-r[0],o=e[1]-r[1],s=e[2]-r[2];return Math.sqrt(t*t+o*o+s*s)}function ot(r,e){let t=e[0]-r[0],o=e[1]-r[1],s=e[2]-r[2];return t*t+o*o+s*s}function st(r){let e=r[0],t=r[1],o=r[2];return e*e+t*t+o*o}function ur(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function pr(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r}function _r(r,e){let t=e[0],o=e[1],s=e[2],i=t*t+o*o+s*s;return i>0&&(i=1/Math.sqrt(i)),r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function Me(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function dr(r,e,t){let o=e[0],s=e[1],i=e[2],n=t[0],a=t[1],l=t[2];return r[0]=s*l-i*a,r[1]=i*n-o*l,r[2]=o*a-s*n,r}function mr(r,e,t,o){let s=e[0],i=e[1],n=e[2];return r[0]=s+o*(t[0]-s),r[1]=i+o*(t[1]-i),r[2]=n+o*(t[2]-n),r}function hr(r,e,t,o){let s=Math.acos(Math.min(Math.max(Me(e,t),-1),1)),i=Math.sin(s),n=Math.sin((1-o)*s)/i,a=Math.sin(o*s)/i;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,o,s,i){let n=i*i,a=n*(2*i-3)+1,l=n*(i-2)+i,f=n*(i-1),c=n*(3-2*i);return r[0]=e[0]*a+t[0]*l+o[0]*f+s[0]*c,r[1]=e[1]*a+t[1]*l+o[1]*f+s[1]*c,r[2]=e[2]*a+t[2]*l+o[2]*f+s[2]*c,r}function gr(r,e,t,o,s,i){let n=1-i,a=n*n,l=i*i,f=a*n,c=3*i*a,u=3*l*n,p=l*i;return r[0]=e[0]*f+t[0]*c+o[0]*u+s[0]*p,r[1]=e[1]*f+t[1]*c+o[1]*u+s[1]*p,r[2]=e[2]*f+t[2]*c+o[2]*u+s[2]*p,r}function xr(r,e){e=e===void 0?1:e;let t=ye()*2*Math.PI,o=ye()*2-1,s=Math.sqrt(1-o*o)*e;return r[0]=Math.cos(t)*s,r[1]=Math.sin(t)*s,r[2]=o*e,r}function Pr(r,e,t){let o=e[0],s=e[1],i=e[2],n=t[3]*o+t[7]*s+t[11]*i+t[15];return n=n||1,r[0]=(t[0]*o+t[4]*s+t[8]*i+t[12])/n,r[1]=(t[1]*o+t[5]*s+t[9]*i+t[13])/n,r[2]=(t[2]*o+t[6]*s+t[10]*i+t[14])/n,r}function yr(r,e,t){let o=e[0],s=e[1],i=e[2];return r[0]=o*t[0]+s*t[3]+i*t[6],r[1]=o*t[1]+s*t[4]+i*t[7],r[2]=o*t[2]+s*t[5]+i*t[8],r}function br(r,e,t){let o=t[0],s=t[1],i=t[2],n=t[3],a=e[0],l=e[1],f=e[2],c=s*f-i*l,u=i*a-o*f,p=o*l-s*a,_=s*p-i*u,x=i*c-o*p,$=o*u-s*c,h=n*2;return c*=h,u*=h,p*=h,_*=2,x*=2,$*=2,r[0]=a+c+_,r[1]=l+u+x,r[2]=f+p+$,r}function Mr(r,e,t,o){let s=[],i=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],i[0]=s[0],i[1]=s[1]*Math.cos(o)-s[2]*Math.sin(o),i[2]=s[1]*Math.sin(o)+s[2]*Math.cos(o),r[0]=i[0]+t[0],r[1]=i[1]+t[1],r[2]=i[2]+t[2],r}function Er(r,e,t,o){let s=[],i=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],i[0]=s[2]*Math.sin(o)+s[0]*Math.cos(o),i[1]=s[1],i[2]=s[2]*Math.cos(o)-s[0]*Math.sin(o),r[0]=i[0]+t[0],r[1]=i[1]+t[1],r[2]=i[2]+t[2],r}function Tr(r,e,t,o){let s=[],i=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],i[0]=s[0]*Math.cos(o)-s[1]*Math.sin(o),i[1]=s[0]*Math.sin(o)+s[1]*Math.cos(o),i[2]=s[2],r[0]=i[0]+t[0],r[1]=i[1]+t[1],r[2]=i[2]+t[2],r}function Ar(r,e){let t=r[0],o=r[1],s=r[2],i=e[0],n=e[1],a=e[2],l=Math.sqrt((t*t+o*o+s*s)*(i*i+n*n+a*a)),f=l&&Me(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 Or(r){return`vec3(${r[0]}, ${r[1]}, ${r[2]})`}function Lr(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}function Cr(r,e){let t=r[0],o=r[1],s=r[2],i=e[0],n=e[1],a=e[2];return Math.abs(t-i)<=1e-6*Math.max(1,Math.abs(t),Math.abs(i))&&Math.abs(o-n)<=1e-6*Math.max(1,Math.abs(o),Math.abs(n))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}var Ir=Je,Sr=et,kr=tt,Rr=rt,Nr=ot,wr=Qe,Br=st,Dr=function(){let r=Xe();return function(e,t,o,s,i,n){let a,l;for(t||(t=3),o||(o=0),s?l=Math.min(s*t+o,e.length):l=e.length,a=o;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],r[2]=e[a+2],i(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 it=`const vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097);
|
|
877
857
|
uniform vec2 project_uViewProjectionMatrixFP64[16];
|
|
878
858
|
void mercatorProject_fp64(vec4 lnglat_fp64, out vec2 out_val[2]) {
|
|
879
859
|
#if defined(NVIDIA_FP64_WORKAROUND)
|
|
@@ -933,7 +913,7 @@ return project_position_to_clipspace(
|
|
|
933
913
|
position, position64xyLow, offset, commonPosition
|
|
934
914
|
);
|
|
935
915
|
}
|
|
936
|
-
`;var{fp64ify:Vr,fp64ifyMatrix4:jr}=re,
|
|
916
|
+
`;var{fp64ify:Vr,fp64ifyMatrix4:jr}=re,ie={name:"project64",dependencies:[se.project,re],vs:it,getUniforms:Ur},zr=(0,se._memoize)(Gr);function Ur(r){if(r&&"viewport"in r){let{viewProjectionMatrix:e,scale:t}=r.viewport;return zr({viewProjectionMatrix:e,scale:t})}return{}}function Gr({viewProjectionMatrix:r,scale:e}){let t=jr(r),o=Vr(e);return{project_uViewProjectionMatrixFP64:t,project64_uViewProjectionMatrix:t,project64_uScale:o}}var Ee=class extends S.LayerExtension{getShaders(){let{coordinateSystem:e}=this.props;if(e!==S.COORDINATE_SYSTEM.LNGLAT&&e!==S.COORDINATE_SYSTEM.DEFAULT)throw new Error("fp64: coordinateSystem must be LNGLAT");return{modules:[ie]}}},k=Ee;(()=>{Ee.extensionName="Fp64Extension"})();var R=d(m(),1);var nt={inject:{"vs:#decl":`
|
|
937
917
|
in vec2 instanceDashArrays;
|
|
938
918
|
in float instanceDashOffsets;
|
|
939
919
|
out vec2 vDashArray;
|
|
@@ -995,25 +975,16 @@ isInside = step(-1.0, vPathPosition.x) * step(vPathPosition.x, 1.0);
|
|
|
995
975
|
if (isInside == 0.0) {
|
|
996
976
|
discard;
|
|
997
977
|
}
|
|
998
|
-
`}};var qr={getDashArray:{type:"accessor",value:[0,0]},getOffset:{type:"accessor",value:0},dashJustified:!1,dashGapPickable:!1},ne=class extends
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
#define FILL_PATTERN_OFFSET_ATTRIB fillPatternOffsets
|
|
1003
|
-
#else
|
|
1004
|
-
#define FILL_PATTERN_FRAME_ATTRIB instanceFillPatternFrames
|
|
1005
|
-
#define FILL_PATTERN_SCALE_ATTRIB instanceFillPatternScales
|
|
1006
|
-
#define FILL_PATTERN_OFFSET_ATTRIB instanceFillPatternOffsets
|
|
1007
|
-
#endif
|
|
1008
|
-
in vec4 FILL_PATTERN_FRAME_ATTRIB;
|
|
1009
|
-
in float FILL_PATTERN_SCALE_ATTRIB;
|
|
1010
|
-
in vec2 FILL_PATTERN_OFFSET_ATTRIB;
|
|
978
|
+
`}};var qr={getDashArray:{type:"accessor",value:[0,0]},getOffset:{type:"accessor",value:0},dashJustified:!1,dashGapPickable:!1},ne=class extends R.LayerExtension{constructor({dash:e=!1,offset:t=!1,highPrecisionDash:o=!1}={}){super({dash:e||o,offset:t,highPrecisionDash:o})}isEnabled(e){return"pathTesselator"in e.state}getShaders(e){if(!e.isEnabled(this))return null;let t={};return e.opts.dash&&(t=(0,R._mergeShaders)(t,nt)),e.opts.offset&&(t=(0,R._mergeShaders)(t,at)),t}initializeState(e,t){let o=this.getAttributeManager();!o||!t.isEnabled(this)||(t.opts.dash&&o.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&&o.addInstanced({instanceOffsets:{size:1,accessor:"getOffset"}}))}updateState(e,t){if(!t.isEnabled(this))return;let o={};t.opts.dash&&(o.dashAlignMode=this.props.dashJustified?1:0,o.dashGapPickable=Boolean(this.props.dashGapPickable)),this.state.model?.setUniforms(o)}getDashOffsets(e){let t=[0],o=this.props.positionFormat==="XY"?2:3,s=Array.isArray(e[0]),i=s?e.length:e.length/o,n,a;for(let l=0;l<i-1;l++)n=s?e[l]:e.slice(l*o,l*o+o),n=this.projectPosition(n),l>0&&(t[l]=t[l-1]+I.dist(a,n)),a=n;return t[i-1]=0,t}},N=ne;(()=>{ne.defaultProps=qr})(),(()=>{ne.extensionName="PathStyleExtension"})();var ft=d(m(),1);var w=d(m(),1);var Hr=`
|
|
979
|
+
in vec4 fillPatternFrames;
|
|
980
|
+
in float fillPatternScales;
|
|
981
|
+
in vec2 fillPatternOffsets;
|
|
1011
982
|
uniform bool fill_patternEnabled;
|
|
1012
983
|
uniform vec2 fill_patternTextureSize;
|
|
1013
984
|
out vec2 fill_uv;
|
|
1014
985
|
out vec4 fill_patternBounds;
|
|
1015
986
|
out vec4 fill_patternPlacement;
|
|
1016
|
-
`,
|
|
987
|
+
`,Yr=`
|
|
1017
988
|
uniform bool fill_patternEnabled;
|
|
1018
989
|
uniform bool fill_patternMask;
|
|
1019
990
|
uniform sampler2D fill_patternTexture;
|
|
@@ -1023,13 +994,13 @@ in vec4 fill_patternBounds;
|
|
|
1023
994
|
in vec4 fill_patternPlacement;
|
|
1024
995
|
in vec2 fill_uv;
|
|
1025
996
|
const float FILL_UV_SCALE = 512.0 / 40000000.0;
|
|
1026
|
-
`,
|
|
997
|
+
`,Wr={"vs:DECKGL_FILTER_GL_POSITION":`
|
|
1027
998
|
fill_uv = geometry.position.xy;
|
|
1028
999
|
`,"vs:DECKGL_FILTER_COLOR":`
|
|
1029
1000
|
if (fill_patternEnabled) {
|
|
1030
|
-
fill_patternBounds =
|
|
1031
|
-
fill_patternPlacement.xy =
|
|
1032
|
-
fill_patternPlacement.zw =
|
|
1001
|
+
fill_patternBounds = fillPatternFrames / vec4(fill_patternTextureSize, fill_patternTextureSize);
|
|
1002
|
+
fill_patternPlacement.xy = fillPatternOffsets;
|
|
1003
|
+
fill_patternPlacement.zw = fillPatternScales * fillPatternFrames.zw;
|
|
1033
1004
|
}
|
|
1034
1005
|
`,"fs:DECKGL_FILTER_COLOR":`
|
|
1035
1006
|
if (fill_patternEnabled) {
|
|
@@ -1043,7 +1014,7 @@ if (!fill_patternMask) {
|
|
|
1043
1014
|
color.rgb = patternColor.rgb;
|
|
1044
1015
|
}
|
|
1045
1016
|
}
|
|
1046
|
-
`};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:
|
|
1017
|
+
`};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:o=!0}=r,{project_uCommonOrigin:s}=e,i=[(0,w.fp64LowPart)(s[0]),(0,w.fp64LowPart)(s[1])];return{fill_uvCoordinateOrigin:s.slice(0,2),fill_uvCoordinateOrigin64Low:i,fill_patternMask:t,fill_patternEnabled:o}}return{}}var lt={name:"fill-pattern",vs:Hr,fs:Yr,inject:Wr,dependencies:[w.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 o=this.getAttributeManager();t.opts.pattern&&o.add({fillPatternFrames:{size:4,stepMode:"dynamic",accessor:"getFillPattern",transform:t.getPatternFrame.bind(this)},fillPatternScales:{size:1,stepMode:"dynamic",accessor:"getFillPatternScale",defaultValue:1},fillPatternOffsets:{size:2,stepMode:"dynamic",accessor:"getFillPatternOffset"}}),this.setState({emptyTexture:this.context.device.createTexture({data:new Uint8Array(4),width:1,height:1})})}updateState({props:e,oldProps:t},o){o.isEnabled(this)&&e.fillPatternMapping&&e.fillPatternMapping!==t.fillPatternMapping&&this.getAttributeManager().invalidate("getFillPattern")}draw(e,t){if(!t.isEnabled(this))return;let{fillPatternAtlas:o}=this.props;this.setModuleParameters({fillPatternTexture:o||this.state.emptyTexture})}finalizeState(){this.state.emptyTexture?.delete()}getPatternFrame(e){let{fillPatternMapping:t}=this.getCurrentLayer().props,o=t&&t[e];return o?[o.x,o.y,o.width,o.height]:[0,0,0,0]}},B=ae;(()=>{ae.defaultProps=Zr})(),(()=>{ae.extensionName="FillStyleExtension"})();var ct=d(m(),1);var $r={clipBounds:[0,0,1,1],clipByInstance:void 0},ut=`
|
|
1047
1018
|
uniform vec4 clip_bounds;
|
|
1048
1019
|
bool clip_isInBounds(vec2 position) {
|
|
1049
1020
|
return position.x >= clip_bounds[0] && position.y >= clip_bounds[1] && position.x < clip_bounds[2] && position.y < clip_bounds[3];
|
|
@@ -1056,7 +1027,7 @@ clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));
|
|
|
1056
1027
|
in float clip_isVisible;
|
|
1057
1028
|
`,"fs:DECKGL_FILTER_COLOR":`
|
|
1058
1029
|
if (clip_isVisible < 0.5) discard;
|
|
1059
|
-
`},Jr={name:"clip-fs",fs:ut},
|
|
1030
|
+
`},Jr={name:"clip-fs",fs:ut},eo={"vs:#decl":`
|
|
1060
1031
|
out vec2 clip_commonPosition;
|
|
1061
1032
|
`,"vs:DECKGL_FILTER_GL_POSITION":`
|
|
1062
1033
|
clip_commonPosition = geometry.position.xy;
|
|
@@ -1064,12 +1035,8 @@ clip_commonPosition = geometry.position.xy;
|
|
|
1064
1035
|
in vec2 clip_commonPosition;
|
|
1065
1036
|
`,"fs:DECKGL_FILTER_COLOR":`
|
|
1066
1037
|
if (!clip_isInBounds(clip_commonPosition)) discard;
|
|
1067
|
-
`},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:
|
|
1068
|
-
#ifdef NON_INSTANCED_MODEL
|
|
1038
|
+
`},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:eo}}draw({uniforms:e}){let{clipBounds:t}=this.props;if(this.state.clipByInstance)e.clip_bounds=t;else{let o=this.projectPosition([t[0],t[1],0]),s=this.projectPosition([t[2],t[3],0]);e.clip_bounds=[Math.min(o[0],s[0]),Math.min(o[1],s[1]),Math.max(o[0],s[0]),Math.max(o[1],s[1])]}}},D=le;(()=>{le.defaultProps=$r})(),(()=>{le.extensionName="ClipExtension"})();var ht=d(m(),1);var pt=d(m(),1);var to=`
|
|
1069
1039
|
in float collisionPriorities;
|
|
1070
|
-
#else
|
|
1071
|
-
in float instanceCollisionPriorities;
|
|
1072
|
-
#endif
|
|
1073
1040
|
uniform sampler2D collision_texture;
|
|
1074
1041
|
uniform bool collision_sort;
|
|
1075
1042
|
uniform bool collision_enabled;
|
|
@@ -1103,15 +1070,11 @@ delta.y += step.y;
|
|
|
1103
1070
|
float W = 2.0 * floatN + 1.0;
|
|
1104
1071
|
return pow(accumulator / (W * W), 2.2);
|
|
1105
1072
|
}
|
|
1106
|
-
`,
|
|
1073
|
+
`,ro={"vs:#decl":`
|
|
1107
1074
|
float collision_fade = 1.0;
|
|
1108
1075
|
`,"vs:DECKGL_FILTER_GL_POSITION":`
|
|
1109
1076
|
if (collision_sort) {
|
|
1110
|
-
#ifdef NON_INSTANCED_MODEL
|
|
1111
1077
|
float collisionPriority = collisionPriorities;
|
|
1112
|
-
#else
|
|
1113
|
-
float collisionPriority = instanceCollisionPriorities;
|
|
1114
|
-
#endif
|
|
1115
1078
|
position.z = -0.001 * collisionPriority * position.w;
|
|
1116
1079
|
}
|
|
1117
1080
|
if (collision_enabled) {
|
|
@@ -1124,13 +1087,13 @@ position = vec4(0.0, 0.0, 2.0, 1.0);
|
|
|
1124
1087
|
}
|
|
1125
1088
|
`,"vs:DECKGL_FILTER_COLOR":`
|
|
1126
1089
|
color.a *= collision_fade;
|
|
1127
|
-
`},
|
|
1090
|
+
`},oo=(r,e)=>{if(!r||!("dummyCollisionMap"in r))return{};let{collisionFBO:t,drawToCollisionMap:o,dummyCollisionMap:s}=r;return{collision_sort:Boolean(o),collision_texture:!o&&t?t.colorAttachments[0]:s}},_t={name:"collision",dependencies:[pt.project],vs:to,inject:ro,getUniforms:oo};var mt=d(m(),1);var dt=d(m(),1),V=class extends dt._LayersPass{renderCollisionMap(e,t){let s=[0,0,0,0],i=[1,1,e.width-2*1,e.height-2*1];this.render({...t,clearColor:s,scissorRect:i,target:e,pass:"collision"})}getLayerParameters(e,t,o){return{...e.props.parameters,blend:!1,depthRange:[0,1],depthTest:!0}}getModuleParameters(){return{drawToCollisionMap:!0,picking:{isActive:1,isAttribute:!1},lightSources:{}}}};var Te=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:o,viewports:s,onViewportActive:i,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]),p=l["mask-effect"]?.didRender,_=this._groupByCollisionGroup(f,c),x=s[0],$=!this.lastViewport||!this.lastViewport.equals(x)||p;for(let h in _){let ve=this.collisionFBOs[h],Ot=_[h],[Lt,Ct]=f.canvasContext.getPixelSize();ve.resize({width:Lt/Te,height:Ct/Te}),this._render(Ot,{effects:u,layerFilter:o,onViewportActive:i,views:n,viewport:x,viewportChanged:$})}}_render(e,{effects:t,layerFilter:o,onViewportActive:s,views:i,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,p)=>!M(u,f.layerBounds[p]))||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:o,viewports:n?[n]:[],onViewportActive:s,views:i,moduleParameters:{dummyCollisionMap:this.dummyCollisionMap,devicePixelRatio:u.device.canvasContext.getDevicePixelRatio()/Te}})}}_groupByCollisionGroup(e,t){let o={};for(let s of t){let{collisionGroup:i}=s.props,n=o[i];n||(n={collisionGroup:i,layers:[],layerBounds:[],allLayersLoaded:!0},o[i]=n),n.layers.push(s),n.layerBounds.push(s.getBounds()),s.isLoaded||(n.allLayersLoaded=!1)}for(let s of Object.keys(o))this.collisionFBOs[s]||this.createFBO(e,s),this.channels[s]||(this.channels[s]=o[s]);for(let s of Object.keys(this.collisionFBOs))o[s]||this.destroyFBO(s);return o}getModuleParameters(e){let{collisionGroup:t}=e.props,{collisionFBOs:o,dummyCollisionMap:s}=this;return{collisionFBO:o[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:o,height:s}=e.gl.canvas,i=e.createTexture({format:"rgba8unorm",width:o,height:s,sampler:{minFilter:"nearest",magFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),n=e.createTexture({format:"depth16unorm",width:o,height:s,mipmaps:!1,dataFormat:6402,type:5125});this.collisionFBOs[t]=e.createFramebuffer({id:`collision-${t}`,width:o,height:s,colorAttachments:[i],depthStencilAttachment:n})}destroyFBO(e){let t=this.collisionFBOs[e];t.colorAttachments[0]?.destroy(),t.depthStencilAttachment?.destroy(),t.destroy(),delete this.collisionFBOs[e]}};var so={getCollisionPriority:{type:"accessor",value:0},collisionEnabled:!0,collisionGroup:{type:"string",value:"default"},collisionTestProps:{}},fe=class extends ht.LayerExtension{getShaders(){return{modules:[_t]}}draw({uniforms:e,context:t,moduleParameters:o}){let{collisionEnabled:s}=this.props,{collisionFBO:i,drawToCollisionMap:n}=o,a=s&&Boolean(i);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,stepMode:"dynamic",accessor:"getCollisionPriority"}})}getNeedsPickingBuffer(){return this.props.collisionEnabled}},z=fe;(()=>{fe.defaultProps=so})(),(()=>{fe.extensionName="CollisionFilterExtension"})();var y=d(m(),1);var vt=d(m(),1);var io=`
|
|
1128
1091
|
uniform vec4 mask_bounds;
|
|
1129
1092
|
uniform bool mask_maskByInstance;
|
|
1130
1093
|
vec2 mask_getCoords(vec4 position) {
|
|
1131
1094
|
return (position.xy - mask_bounds.xy) / (mask_bounds.zw - mask_bounds.xy);
|
|
1132
1095
|
}
|
|
1133
|
-
`,
|
|
1096
|
+
`,no=`
|
|
1134
1097
|
uniform sampler2D mask_texture;
|
|
1135
1098
|
uniform int mask_channel;
|
|
1136
1099
|
uniform bool mask_enabled;
|
|
@@ -1156,7 +1119,7 @@ return maskValue >= 0.5;
|
|
|
1156
1119
|
return maskValue < 0.5;
|
|
1157
1120
|
}
|
|
1158
1121
|
}
|
|
1159
|
-
`,
|
|
1122
|
+
`,ao={"vs:#decl":`
|
|
1160
1123
|
out vec2 mask_texCoords;
|
|
1161
1124
|
`,"vs:#main-end":`
|
|
1162
1125
|
vec4 mask_common_position;
|
|
@@ -1174,8 +1137,8 @@ bool mask = mask_isInBounds(mask_texCoords);
|
|
|
1174
1137
|
fragColor = texture(mask_texture, mask_texCoords);
|
|
1175
1138
|
if (!mask) discard;
|
|
1176
1139
|
}
|
|
1177
|
-
`},
|
|
1178
|
-
`),
|
|
1140
|
+
`},lo=r=>r&&"maskMap"in r?{mask_texture:r.maskMap}:{},gt={name:"mask",dependencies:[vt.project],vs:io,fs:no,inject:ao,getUniforms:lo};var Ae=d(m(),1);var xt=d(m(),1),fo={blendColorOperation:"subtract",blendColorSrcFactor:"zero",blendColorDstFactor:"one",blendAlphaOperation:"subtract",blendAlphaSrcFactor:"zero",blendAlphaDstFactor:"one"},U=class extends xt._LayersPass{constructor(e,t){super(e,t);let{mapSize:o=2048}=t;this.maskMap=e.createTexture({format:"rgba8unorm",width:o,height:o,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),this.fbo=e.createFramebuffer({id:"maskmap",width:o,height:o,colorAttachments:[this.maskMap]})}render(e){let t=2**e.channel,o=[255,255,255,255];super.render({...e,clearColor:o,colorMask:t,target:this.fbo,pass:"mask"})}getLayerParameters(e,t,o){return{...e.props.parameters,blend:!0,depthTest:!1,...fo}}shouldDrawLayer(e){return e.props.operation.includes("mask")}delete(){this.fbo.delete(),this.maskMap.delete()}};var ce=d(m(),1);function E(r,e){let t=[1/0,1/0,-1/0,-1/0];for(let o of r){let s=o.getBounds();if(s){let i=o.projectPosition(s[0],{viewport:e,autoOffset:!1}),n=o.projectPosition(s[1],{viewport:e,autoOffset:!1});t[0]=Math.min(t[0],i[0]),t[1]=Math.min(t[1],i[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 co=2048;function T(r){let{bounds:e,viewport:t,border:o=0}=r,{isGeospatial:s}=t;if(e[2]<=e[0]||e[3]<=e[1])return null;let i=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-o*2,a=a-o*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=co-o*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:o,y:o,width:n,height:a,longitude:i[0],latitude:i[1],zoom:l,orthographic:!0}):new ce.OrthographicViewport({id:t.id,x:o,y:o,width:n,height:a,target:i,zoom:l,flipY:!1})}function uo(r,e){let t;if(e&&e.length===2){let[i,n]=e,a=r.getBounds({z:i}),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 o=r.projectPosition(t.slice(0,2)),s=r.projectPosition(t.slice(2,4));return[o[0],o[1],s[0],s[1]]}function A(r,e,t){if(!r)return[0,0,1,1];let o=uo(e,t),s=po(o);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 po(r){let e=r[2]-r[0],t=r[3]-r[1],o=(r[0]+r[2])/2,s=(r[1]+r[3])/2;return[o-e,s-t,o+e,s+t]}var G=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 U(e,{id:"default-mask"}),this.maskMap=this.maskPass.maskMap}preRender({layers:e,layerFilter:t,viewports:o,onViewportActive:s,views:i,isPicking:n}){let a=!1;if(n)return{didRender:a};let l=e.filter(p=>p.props.visible&&p.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=o[0],u=!this.lastViewport||!this.lastViewport.equals(c);if(c.resolution!==void 0)return Ae.log.warn("MaskExtension is not supported in GlobeView")(),{didRender:a};for(let p in f){let _=this._renderChannel(f[p],{layerFilter:t,onViewportActive:s,views:i,viewport:c,viewportChanged:u});a||=_}return{didRender:a}}_renderChannel(e,{layerFilter:t,onViewportActive:o,views:s,viewport:i,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=i;let c=E(e.layers,i);if(e.bounds=c&&A(c,i),f||!M(e.bounds,l.bounds)){let{maskPass:u,maskMap:p}=this,_=c&&T({bounds:e.bounds,viewport:i,width:p.width,height:p.height,border:1});e.maskBounds=_?_.getBounds():[0,0,1,1],u.render({pass:"mask",channel:e.index,layers:e.layers,layerFilter:t,viewports:_?[_]:[],onViewportActive:o,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={},o=0;for(let s of e){let{id:i}=s.root,n=t[i];if(!n){if(++o>4){Ae.log.warn("Too many mask layers. The max supported is 4")();continue}n={id:i,index:this.channels.findIndex(a=>a?.id===i),layers:[],layerBounds:[],coordinateOrigin:s.root.props.coordinateOrigin,coordinateSystem:s.root.props.coordinateSystem},t[i]=n}n.layers.push(s),n.layerBounds.push(s.getBounds())}for(let s=0;s<4;s++){let i=this.channels[s];(!i||!(i.id in t))&&(this.channels[s]=null)}for(let s in t){let i=t[s];i.index<0&&(i.index=this.channels.findIndex(n=>!n),this.channels[i.index]=i)}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 _o={maskId:"",maskByInstance:void 0,maskInverted:!1},ue=class extends y.LayerExtension{initializeState(){this.context.deck?._addDefaultEffect(new G)}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:o}){e.mask_maskByInstance=this.state.maskByInstance;let{maskId:s,maskInverted:i}=this.props,{maskChannels:n}=o,{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=i,u===y.COORDINATE_SYSTEM.DEFAULT&&(u=a.isGeospatial?y.COORDINATE_SYSTEM.LNGLAT:y.COORDINATE_SYSTEM.CARTESIAN);let p={modelMatrix:null,fromCoordinateOrigin:c,fromCoordinateSystem:u},_=this.projectPosition([f[0],f[1],0],p),x=this.projectPosition([f[2],f[3],0],p);e.mask_bounds=[_[0],_[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=_o})(),(()=>{ue.extensionName="MaskExtension"})();var Ft=d(m(),1);var At=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(`
|
|
1141
|
+
`),H={name:"terrain",dependencies:[yt.project],inject:{"vs:#decl":`
|
|
1179
1142
|
uniform float terrain_mode;
|
|
1180
1143
|
uniform sampler2D terrain_map;
|
|
1181
1144
|
uniform vec4 terrain_bounds;
|
|
@@ -1224,6 +1187,6 @@ color = pixel + color * (1.0 - pixel.a);
|
|
|
1224
1187
|
}
|
|
1225
1188
|
return;
|
|
1226
1189
|
}
|
|
1227
|
-
`},getUniforms:(r={},e)=>{if("dummyHeightMap"in r){let{drawToTerrainHeightMap:t,heightMap:
|
|
1190
|
+
`},getUniforms:(r={},e)=>{if("dummyHeightMap"in r){let{drawToTerrainHeightMap:t,heightMap:o,heightMapBounds:s,dummyHeightMap:i,terrainCover:n,useTerrainHeightMap:a,terrainSkipRender:l}=r,{project_uCommonOrigin:f}=e,c=l?g.SKIP:g.NONE,u=i,p=null;if(t)c=g.WRITE_HEIGHT_MAP,p=s;else if(a&&o)c=g.USE_HEIGHT_MAP,u=o,p=s;else if(n){let _=r.picking?.isActive;u=(_?n.getPickingFramebuffer():n.getRenderFramebuffer())?.colorAttachments[0].texture,_&&(c=g.SKIP),u?(c=c===g.SKIP?g.USE_COVER_ONLY:g.USE_COVER,p=n.bounds):u=i}return{terrain_mode:c,terrain_map:u,terrain_bounds:p?[p[0]-f[0],p[1]-f[1],p[2]-p[0],p[3]-p[1]]:[0,0,0,0]}}return null}};function Y(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 pe=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=bt(e)}get id(){return this.targetLayer.id}get isActive(){return Boolean(this.targetLayer.getCurrentLayer())}shouldUpdate({targetLayer:e,viewport:t,layers:o,layerNeedsRedraw:s}){e&&(this.targetLayer=e);let i=t?this._updateViewport(t):!1,n=o?this._updateLayers(o):!1;if(s){for(let a of this.layers)if(s[a]){n=!0;break}}return n||i}_updateLayers(e){let t=!1;if(e=this.tile?mo(this.tile,e):e,e.length!==this.layers.length)t=!0;else for(let o=0;o<e.length;o++)if(e[o].id!==this.layers[o]){t=!0;break}return t&&(this.layers=e.map(o=>o.id)),t}_updateViewport(e){let t=this.targetLayer,o=!1;if(this.tile&&"boundingBox"in this.tile){if(!this.targetBounds){o=!0,this.targetBounds=this.tile.boundingBox;let i=e.projectPosition(this.targetBounds[0]),n=e.projectPosition(this.targetBounds[1]);this.targetBoundsCommon=[i[0],i[1],n[0],n[1]]}}else this.targetBounds!==t.getBounds()&&(o=!0,this.targetBounds=t.getBounds(),this.targetBoundsCommon=E([t],e));if(!this.targetBoundsCommon)return!1;let s=Math.ceil(e.zoom+.5);if(this.tile)this.bounds=this.targetBoundsCommon;else{let i=this.renderViewport?.zoom;o=o||s!==i;let n=A(this.targetBoundsCommon,e),a=this.bounds;o=o||!a||n.some((l,f)=>l!==a[f]),this.bounds=n}return o&&(this.renderViewport=T({bounds:this.bounds,zoom:s,viewport:e})),o}getRenderFramebuffer(){return!this.renderViewport||this.layers.length===0?null:(this.fbo||(this.fbo=Y(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=Y(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 mo(r,e){return e.filter(t=>{let o=bt(t);return o?ho(r.boundingBox,o.boundingBox):!0})}function bt(r){for(;r;){let{tile:e}=r.props;if(e)return e;r=r.parent}return null}function ho(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 Mt=d(m(),1),vo={blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},_e=class extends Mt._LayersPass{getRenderableLayers(e,t){let{layers:o}=t,s=[],i=this._getDrawLayerParams(e,t,!0);for(let n=0;n<o.length;n++){let a=o[n];!a.isComposite&&i[n].shouldDrawLayer&&s.push(a)}return s}renderHeightMap(e,t){let o=e.getRenderFramebuffer(),s=e.renderViewport;!o||!s||(o.resize(s),this.render({...t,target:o,pass:"terrain-height-map",layers:t.layers,viewports:[s],effects:[],clearColor:[0,0,0,0]}))}renderTerrainCover(e,t){let o=e.getRenderFramebuffer(),s=e.renderViewport;if(!o||!s)return;let i=e.filterLayers(t.layers);o.resize(s),this.render({...t,target:o,pass:`terrain-cover-${e.id}`,layers:i,effects:[],viewports:[s],clearColor:[0,0,0,0]})}getLayerParameters(e,t,o){return{...e.props.parameters,blend:!0,depthTest:!1,...e.props.operation.includes("terrain")&&vo}}};var Et=d(m(),1),de=class extends Et._PickLayersPass{constructor(){super(...arguments),this.drawParameters={}}getRenderableLayers(e,t){let{layers:o}=t,s=[];this.drawParameters={},this._resetColorEncoder(t.pickZ);let i=this._getDrawLayerParams(e,t);for(let n=0;n<o.length;n++){let a=o[n];!a.isComposite&&i[n].shouldDrawLayer&&(s.push(a),this.drawParameters[a.id]=i[n].layerParameters)}return s}renderTerrainCover(e,t){let o=e.getPickingFramebuffer(),s=e.renderViewport;if(!o||!s)return;let i=e.filterLayers(t.layers),n=e.targetLayer;n.props.pickable&&i.unshift(n),o.resize(s),this.render({...t,pickingFBO:o,pass:`terrain-cover-picking-${e.id}`,layers:i,effects:[],viewports:[s],cullRect:void 0,deviceRect:s,pickZ:!1})}getLayerParameters(e,t,o){let s;return this.drawParameters[e.id]?s=this.drawParameters[e.id]:(s=super.getLayerParameters(e,t,o),s.blend=!0),{...s,depthTest:!1}}};var Tt=2048,W=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=Y(this.device,{id:"height-map",float:!0})),this.fbo):null}shouldUpdate({layers:e,viewport:t}){let o=e.length!==this.layers.length||e.some((i,n)=>i!==this.layers[n]||i.props.transitions||i.getBounds()!==this.layersBounds[n]);o&&(this.layers=e,this.layersBounds=e.map(i=>i.getBounds()),this.layersBoundsCommon=E(e,t));let s=!this.lastViewport||!t.equals(this.lastViewport);if(!this.layersBoundsCommon)this.renderViewport=null;else if(o||s){let i=A(this.layersBoundsCommon,t);if(i[2]<=i[0]||i[3]<=i[1])return this.renderViewport=null,!1;this.bounds=i,this.lastViewport=t;let n=t.scale,a=(i[2]-i[0])*n,l=(i[3]-i[1])*n;return this.renderViewport=a>0||l>0?T({bounds:[t.center[0]-1,t.center[1]-1,t.center[0]+1,t.center[1]+1],zoom:t.zoom,width:Math.min(a,Tt),height:Math.min(l,Tt),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 _e(e,{id:"terrain"}),this.terrainPickingPass=new de(e,{id:"terrain-picking"}),W.isSupported(e)?this.heightMap=new W(e):At.log.warn("Terrain offset mode is not supported by this browser")(),t._addDefaultShaderModule(H)}preRender(e){if(e.pickZ){this.isDrapingEnabled=!1;return}let{viewports:t}=e,o=e.pass.startsWith("picking");this.isPicking=o,this.isDrapingEnabled=!0;let s=t[0],i=(o?this.terrainPickingPass:this.terrainPass).getRenderableLayers(s,e),n=i.filter(l=>l.props.operation.includes("terrain"));if(n.length===0)return;o||i.filter(f=>f.state.terrainDrawMode==="offset").length>0&&this._updateHeightMap(n,s,e);let a=i.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(H)}_updateHeightMap(e,t,o){!this.heightMap||!this.heightMap.shouldUpdate({layers:e,viewport:t})||this.terrainPass.renderHeightMap(this.heightMap,{...o,layers:e,moduleParameters:{heightMapBounds:this.heightMap.bounds,dummyHeightMap:this.dummyHeightMap,devicePixelRatio:1,drawToTerrainHeightMap:!0}})}_updateTerrainCovers(e,t,o,s){let i={};for(let n of t)n.state.terrainCoverNeedsRedraw&&(i[n.id]=!0,n.state.terrainCoverNeedsRedraw=!1);for(let n of this.terrainCovers.values())n.isDirty=n.isDirty||n.shouldUpdate({layerNeedsRedraw:i});for(let n of e)this._updateTerrainCover(n,t,o,s);this.isPicking||this._pruneTerrainCovers()}_updateTerrainCover(e,t,o,s){let i=this.isPicking?this.terrainPickingPass:this.terrainPass,n=this.terrainCovers.get(e.id);n||(n=new pe(e),this.terrainCovers.set(e.id,n));try{let a=n.shouldUpdate({targetLayer:e,viewport:o,layers:t});(this.isPicking||n.isDirty||a)&&(i.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,o]of this.terrainCovers)o.isActive||e.push(t);for(let t of e)this.terrainCovers.delete(t)}};var go={terrainDrawMode:void 0},he=class extends Ft.LayerExtension{getShaders(){return{modules:[H]}}initializeState(){this.context.deck?._addDefaultEffect(new me)}updateState(e){let{props:t,oldProps:o}=e;if(this.state.terrainDrawMode&&t.terrainDrawMode===o.terrainDrawMode&&t.extruded===o.extruded)return;let{terrainDrawMode:s}=t;if(!s){let i=this.props.extruded,n=this.getAttributeManager()?.attributes,a=n&&"instancePositions"in n;s=i||a?"offset":"drape"}this.setState({terrainDrawMode:s})}onNeedsRedraw(){let e=this.state;e.terrainDrawMode==="drape"&&(e.terrainCoverNeedsRedraw=!0)}},K=he;(()=>{he.defaultProps=go})(),(()=>{he.extensionName="TerrainExtension"})();return wt(Z);})();
|
|
1228
1191
|
return __exports__;
|
|
1229
1192
|
});
|
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.13",
|
|
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": "39b76f3cd7d6041dd36b93dc3e91b740ed2c57f9"
|
|
51
51
|
}
|
|
@@ -69,15 +69,8 @@ export default class BrushingExtension extends LayerExtension {
|
|
|
69
69
|
attributeManager.add({
|
|
70
70
|
brushingTargets: {
|
|
71
71
|
size: 2,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
brushingTargets: {
|
|
75
|
-
divisor: 0
|
|
76
|
-
},
|
|
77
|
-
instanceBrushingTargets: {
|
|
78
|
-
divisor: 1
|
|
79
|
-
}
|
|
80
|
-
}
|
|
72
|
+
stepMode: 'dynamic',
|
|
73
|
+
accessor: 'getBrushingTarget'
|
|
81
74
|
}
|
|
82
75
|
});
|
|
83
76
|
}
|
|
@@ -37,11 +37,7 @@ const vs = glsl`
|
|
|
37
37
|
uniform vec2 brushing_mousePos;
|
|
38
38
|
uniform float brushing_radius;
|
|
39
39
|
|
|
40
|
-
#ifdef NON_INSTANCED_MODEL
|
|
41
40
|
in vec2 brushingTargets;
|
|
42
|
-
#else
|
|
43
|
-
in vec2 instanceBrushingTargets;
|
|
44
|
-
#endif
|
|
45
41
|
|
|
46
42
|
out float brushing_isVisible;
|
|
47
43
|
|
|
@@ -89,11 +85,7 @@ const inject = {
|
|
|
89
85
|
} else if (brushing_target == 1) {
|
|
90
86
|
brushingTarget = geometry.worldPositionAlt.xy;
|
|
91
87
|
} else {
|
|
92
|
-
#ifdef NON_INSTANCED_MODEL
|
|
93
88
|
brushingTarget = brushingTargets;
|
|
94
|
-
#else
|
|
95
|
-
brushingTarget = instanceBrushingTargets;
|
|
96
|
-
#endif
|
|
97
89
|
}
|
|
98
90
|
bool visible;
|
|
99
91
|
if (brushing_target == 3) {
|
|
@@ -68,11 +68,8 @@ export default class CollisionFilterExtension extends LayerExtension {
|
|
|
68
68
|
attributeManager!.add({
|
|
69
69
|
collisionPriorities: {
|
|
70
70
|
size: 1,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
collisionPriorities: {divisor: 0},
|
|
74
|
-
instanceCollisionPriorities: {divisor: 1}
|
|
75
|
-
}
|
|
71
|
+
stepMode: 'dynamic',
|
|
72
|
+
accessor: 'getCollisionPriority'
|
|
76
73
|
}
|
|
77
74
|
});
|
|
78
75
|
}
|
|
@@ -4,11 +4,7 @@ import {project} from '@deck.gl/core';
|
|
|
4
4
|
import {glsl} from '../utils/syntax-tags';
|
|
5
5
|
|
|
6
6
|
const vs = glsl`
|
|
7
|
-
#ifdef NON_INSTANCED_MODEL
|
|
8
7
|
in float collisionPriorities;
|
|
9
|
-
#else
|
|
10
|
-
in float instanceCollisionPriorities;
|
|
11
|
-
#endif
|
|
12
8
|
|
|
13
9
|
uniform sampler2D collision_texture;
|
|
14
10
|
uniform bool collision_sort;
|
|
@@ -60,11 +56,7 @@ const inject = {
|
|
|
60
56
|
`,
|
|
61
57
|
'vs:DECKGL_FILTER_GL_POSITION': glsl`
|
|
62
58
|
if (collision_sort) {
|
|
63
|
-
#ifdef NON_INSTANCED_MODEL
|
|
64
59
|
float collisionPriority = collisionPriorities;
|
|
65
|
-
#else
|
|
66
|
-
float collisionPriority = instanceCollisionPriorities;
|
|
67
|
-
#endif
|
|
68
60
|
position.z = -0.001 * collisionPriority * position.w; // Support range -1000 -> 1000
|
|
69
61
|
}
|
|
70
62
|
|