@deck.gl/extensions 9.0.30 → 9.0.32
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.js +4 -3
- package/dist/clip/clip-extension.js +4 -3
- package/dist/collision-filter/collision-filter-extension.js +4 -3
- 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 +4 -3
- package/dist/fill-style/fill-style-extension.d.ts +1 -2
- package/dist/fill-style/fill-style-extension.d.ts.map +1 -1
- package/dist/fill-style/fill-style-extension.js +4 -3
- package/dist/fp64/fp64-extension.js +3 -2
- package/dist/index.cjs +45 -79
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/mask/mask-effect.js +1 -1
- package/dist/mask/mask-extension.js +4 -3
- package/dist/path-style/path-style-extension.d.ts +1 -2
- package/dist/path-style/path-style-extension.d.ts.map +1 -1
- package/dist/path-style/path-style-extension.js +4 -3
- package/dist/terrain/terrain-extension.js +4 -3
- package/dist.min.js +21 -21
- package/package.json +2 -2
- package/src/data-filter/data-filter-extension.ts +1 -1
- package/src/fill-style/fill-style-extension.ts +1 -1
- package/src/index.ts +12 -3
- package/src/path-style/path-style-extension.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -9,9 +9,9 @@ export { default as MaskExtension } from "./mask/mask-extension.js";
|
|
|
9
9
|
export { default as _TerrainExtension } from "./terrain/terrain-extension.js";
|
|
10
10
|
export { default as project64 } from "./fp64/project64.js";
|
|
11
11
|
export type { BrushingExtensionProps } from "./brushing/brushing-extension.js";
|
|
12
|
-
export type { DataFilterExtensionProps } from "./data-filter/data-filter-extension.js";
|
|
13
|
-
export type { PathStyleExtensionProps } from "./path-style/path-style-extension.js";
|
|
14
|
-
export type { FillStyleExtensionProps } from "./fill-style/fill-style-extension.js";
|
|
12
|
+
export type { DataFilterExtensionProps, DataFilterExtensionOptions } from "./data-filter/data-filter-extension.js";
|
|
13
|
+
export type { PathStyleExtensionProps, PathStyleExtensionOptions } from "./path-style/path-style-extension.js";
|
|
14
|
+
export type { FillStyleExtensionProps, FillStyleExtensionOptions } from "./fill-style/fill-style-extension.js";
|
|
15
15
|
export type { ClipExtensionProps } from "./clip/clip-extension.js";
|
|
16
16
|
export type { CollisionFilterExtensionProps } from "./collision-filter/collision-filter-extension.js";
|
|
17
17
|
export type { MaskExtensionProps } from "./mask/mask-extension.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,yCAAsC;AAC3E,OAAO,EAAC,OAAO,IAAI,mBAAmB,EAAC,+CAA4C;AACnF,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,iCAA8B;AAC/D,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,6CAA0C;AAChF,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,6CAA0C;AAChF,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,iCAA8B;AAC/D,OAAO,EAAC,OAAO,IAAI,wBAAwB,EAAC,yDAAsD;AAClG,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,iCAA8B;AAC/D,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,uCAAoC;AAGzE,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,4BAAyB;AAGtD,YAAY,EAAC,sBAAsB,EAAC,yCAAsC;AAC1E,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,yCAAsC;AAC3E,OAAO,EAAC,OAAO,IAAI,mBAAmB,EAAC,+CAA4C;AACnF,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,iCAA8B;AAC/D,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,6CAA0C;AAChF,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,6CAA0C;AAChF,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,iCAA8B;AAC/D,OAAO,EAAC,OAAO,IAAI,wBAAwB,EAAC,yDAAsD;AAClG,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,iCAA8B;AAC/D,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,uCAAoC;AAGzE,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,4BAAyB;AAGtD,YAAY,EAAC,sBAAsB,EAAC,yCAAsC;AAC1E,YAAY,EACV,wBAAwB,EACxB,0BAA0B,EAC3B,+CAA4C;AAC7C,YAAY,EACV,uBAAuB,EACvB,yBAAyB,EAC1B,6CAA0C;AAC3C,YAAY,EACV,uBAAuB,EACvB,yBAAyB,EAC1B,6CAA0C;AAC3C,YAAY,EAAC,kBAAkB,EAAC,iCAA8B;AAC9D,YAAY,EAAC,6BAA6B,EAAC,yDAAsD;AACjG,YAAY,EAAC,kBAAkB,EAAC,iCAA8B;AAC9D,YAAY,EAAC,qBAAqB,EAAC,uCAAoC"}
|
package/dist/mask/mask-effect.js
CHANGED
|
@@ -7,9 +7,7 @@ const defaultProps = {
|
|
|
7
7
|
maskInverted: false
|
|
8
8
|
};
|
|
9
9
|
/** Allows layers to show/hide objects by a geofence. */
|
|
10
|
-
|
|
11
|
-
static { this.defaultProps = defaultProps; }
|
|
12
|
-
static { this.extensionName = 'MaskExtension'; }
|
|
10
|
+
class MaskExtension extends LayerExtension {
|
|
13
11
|
initializeState() {
|
|
14
12
|
this.context.deck?._addDefaultEffect(new MaskEffect());
|
|
15
13
|
}
|
|
@@ -55,3 +53,6 @@ export default class MaskExtension extends LayerExtension {
|
|
|
55
53
|
}
|
|
56
54
|
}
|
|
57
55
|
}
|
|
56
|
+
MaskExtension.defaultProps = defaultProps;
|
|
57
|
+
MaskExtension.extensionName = 'MaskExtension';
|
|
58
|
+
export default MaskExtension;
|
|
@@ -23,7 +23,7 @@ export type PathStyleExtensionProps<DataT = any> = {
|
|
|
23
23
|
*/
|
|
24
24
|
dashGapPickable?: boolean;
|
|
25
25
|
};
|
|
26
|
-
type PathStyleExtensionOptions = {
|
|
26
|
+
export type PathStyleExtensionOptions = {
|
|
27
27
|
/**
|
|
28
28
|
* Add capability to render dashed lines.
|
|
29
29
|
* @default false
|
|
@@ -62,5 +62,4 @@ export default class PathStyleExtension extends LayerExtension<PathStyleExtensio
|
|
|
62
62
|
updateState(this: Layer<PathStyleExtensionProps>, params: UpdateParameters<Layer<PathStyleExtensionProps>>, extension: this): void;
|
|
63
63
|
getDashOffsets(this: Layer<PathStyleExtensionProps>, path: number[] | number[][]): number[];
|
|
64
64
|
}
|
|
65
|
-
export {};
|
|
66
65
|
//# sourceMappingURL=path-style-extension.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-style-extension.d.ts","sourceRoot":"","sources":["../../src/path-style/path-style-extension.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,cAAc,EAAgC,MAAM,eAAe,CAAC;AAI5E,OAAO,KAAK,EAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAUnF,MAAM,MAAM,uBAAuB,CAAC,KAAK,GAAG,GAAG,IAAI;IACjD;;;OAGG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACjD;;;;OAIG;IACH,SAAS,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACpC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"path-style-extension.d.ts","sourceRoot":"","sources":["../../src/path-style/path-style-extension.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,cAAc,EAAgC,MAAM,eAAe,CAAC;AAI5E,OAAO,KAAK,EAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAUnF,MAAM,MAAM,uBAAuB,CAAC,KAAK,GAAG,GAAG,IAAI;IACjD;;;OAGG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACjD;;;;OAIG;IACH,SAAS,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACpC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC;;;OAGG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;;OAGG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,kGAAkG;AAClG,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,cAAc,CAAC,yBAAyB,CAAC;IACvF,MAAM,CAAC,YAAY;;;;;;;;;;;MAAgB;IACnC,MAAM,CAAC,aAAa,SAAwB;gBAEhC,EACV,IAAY,EACZ,MAAc,EACd,iBAAyB,EAC1B,GAAE,OAAO,CAAC,yBAAyB,CAAM;IAI1C,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC,GAAG,OAAO;IAIzD,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,uBAAuB,CAAC,EAAE,SAAS,EAAE,IAAI,GAAG,GAAG;IAiBtE,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,uBAAuB,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI;IAgC5F,WAAW,CACT,IAAI,EAAE,KAAK,CAAC,uBAAuB,CAAC,EACpC,MAAM,EAAE,gBAAgB,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,EACxD,SAAS,EAAE,IAAI;IAgBjB,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,uBAAuB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE;CAqB5F"}
|
|
@@ -27,9 +27,7 @@ const defaultProps = {
|
|
|
27
27
|
dashGapPickable: false
|
|
28
28
|
};
|
|
29
29
|
/** Adds selected features to the `PathLayer` and composite layers that render the `PathLayer`. */
|
|
30
|
-
|
|
31
|
-
static { this.defaultProps = defaultProps; }
|
|
32
|
-
static { this.extensionName = 'PathStyleExtension'; }
|
|
30
|
+
class PathStyleExtension extends LayerExtension {
|
|
33
31
|
constructor({ dash = false, offset = false, highPrecisionDash = false } = {}) {
|
|
34
32
|
super({ dash: dash || highPrecisionDash, offset, highPrecisionDash });
|
|
35
33
|
}
|
|
@@ -110,3 +108,6 @@ export default class PathStyleExtension extends LayerExtension {
|
|
|
110
108
|
return result;
|
|
111
109
|
}
|
|
112
110
|
}
|
|
111
|
+
PathStyleExtension.defaultProps = defaultProps;
|
|
112
|
+
PathStyleExtension.extensionName = 'PathStyleExtension';
|
|
113
|
+
export default PathStyleExtension;
|
|
@@ -5,9 +5,7 @@ const defaultProps = {
|
|
|
5
5
|
terrainDrawMode: undefined
|
|
6
6
|
};
|
|
7
7
|
/** Allows layers to show/hide objects by a geofence. */
|
|
8
|
-
|
|
9
|
-
static { this.defaultProps = defaultProps; }
|
|
10
|
-
static { this.extensionName = 'TerrainExtension'; }
|
|
8
|
+
class TerrainExtension extends LayerExtension {
|
|
11
9
|
getShaders() {
|
|
12
10
|
return {
|
|
13
11
|
modules: [terrainModule]
|
|
@@ -42,3 +40,6 @@ export default class TerrainExtension extends LayerExtension {
|
|
|
42
40
|
}
|
|
43
41
|
}
|
|
44
42
|
}
|
|
43
|
+
TerrainExtension.defaultProps = defaultProps;
|
|
44
|
+
TerrainExtension.extensionName = 'TerrainExtension';
|
|
45
|
+
export default TerrainExtension;
|
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 It=Object.create;var
|
|
7
|
+
"use strict";var __exports__=(()=>{var It=Object.create;var X=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var Rt=Object.getPrototypeOf,Nt=Object.prototype.hasOwnProperty;var ge=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),xe=(r,e)=>{for(var t in e)X(r,t,{get:e[t],enumerable:!0})},$=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of kt(e))!Nt.call(r,i)&&i!==t&&X(r,i,{get:()=>e[i],enumerable:!(o=St(e,i))||o.enumerable});return r},P=(r,e,t)=>($(r,e,"default"),t&&$(t,e,"default")),_=(r,e,t)=>(t=r!=null?It(Rt(r)):{},$(e||!r||!r.__esModule?X(t,"default",{value:r,enumerable:!0}):t,r)),wt=r=>$(X({},"__esModule",{value:!0}),r);var d=ge((Po,Pe)=>{Pe.exports=globalThis.deck});var ke=ge((Ao,Se)=>{Se.exports=globalThis.luma});var K={};xe(K,{BrushingExtension:()=>Te,ClipExtension:()=>lt,CollisionFilterExtension:()=>dt,DataFilterExtension:()=>je,FillStyleExtension:()=>st,Fp64Extension:()=>Je,MaskExtension:()=>gt,PathStyleExtension:()=>rt,_TerrainExtension:()=>Ft,project64:()=>re});var v={},ye=_(d(),1);P(v,_(d(),1));if(!ye.Layer)throw new Error("@deck.gl/core is not found");P(K,v);var Me=_(d(),1);var be=_(d(),1);var Bt=`
|
|
8
8
|
uniform bool brushing_enabled;
|
|
9
9
|
uniform int brushing_target;
|
|
10
10
|
uniform vec2 brushing_mousePos;
|
|
@@ -53,7 +53,7 @@ brushing_setVisible(visible);
|
|
|
53
53
|
if (brushing_enabled && brushing_isVisible < 0.5) {
|
|
54
54
|
discard;
|
|
55
55
|
}
|
|
56
|
-
`},
|
|
56
|
+
`},Ee={name:"brushing",dependencies:[be.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:i,viewport:s}=r;return{brushing_enabled:Boolean(e&&i&&s.containsPixel(i)),brushing_radius:t,brushing_target:Vt[o]||0,brushing_mousePos:i?s.unproject([i.x-s.x,i.y-s.y]):[0,0]}}};var zt={getBrushingTarget:{type:"accessor",value:[0,0]},brushingTarget:"source",brushingEnabled:!0,brushingRadius:1e4},F=class extends Me.LayerExtension{getShaders(){return{modules:[Ee]}}initializeState(e,t){let o=this.getAttributeManager();o&&o.add({brushingTargets:{size:2,stepMode:"dynamic",accessor:"getBrushingTarget"}});let i=()=>{this.getCurrentLayer()?.setNeedsRedraw()};this.state.onMouseMove=i,e.deck&&e.deck.eventManager.on({pointermove:i,pointerleave:i})}finalizeState(e,t){if(e.deck){let o=this.state.onMouseMove;e.deck.eventManager.off({pointermove:o,pointerleave:o})}}};F.defaultProps=zt;F.extensionName="BrushingExtension";var Te=F;var b=_(d(),1);var Ae=`
|
|
57
57
|
uniform bool filter_useSoftMargin;
|
|
58
58
|
uniform bool filter_enabled;
|
|
59
59
|
uniform bool filter_transformSize;
|
|
@@ -130,10 +130,10 @@ if(any(equal(dataFilter_bits, DATACATEGORY_TYPE(0.0)))) dataFilter_value = 0.0;
|
|
|
130
130
|
#endif
|
|
131
131
|
}
|
|
132
132
|
#endif
|
|
133
|
-
`,
|
|
133
|
+
`,Fe=`
|
|
134
134
|
uniform bool filter_transformColor;
|
|
135
135
|
in float dataFilter_value;
|
|
136
|
-
`;function
|
|
136
|
+
`;function Oe(r){if(!r||!("extensions"in r))return{};let{filterRange:e=[-1,1],filterEnabled:t=!0,filterTransformSize:o=!0,filterTransformColor:i=!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&&o,filter_transformColor:t&&i}}function Gt(r){if(!r||!("extensions"in r))return{};let e=Oe(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((i,s)=>i-t[s]),e.filter_softMin=e.filter_softMin.map((i,s)=>i-t[s]),e.filter_min64High=t;let o=e.filter_max.map(Math.fround);e.filter_max=e.filter_max.map((i,s)=>i-o[s]),e.filter_softMax=e.filter_softMax.map((i,s)=>i-o[s]),e.filter_max64High=o}return e}var Le={"vs:#main-start":`
|
|
137
137
|
dataFilter_value = 1.0;
|
|
138
138
|
if (filter_enabled) {
|
|
139
139
|
#ifdef DATAFILTER_TYPE
|
|
@@ -163,7 +163,7 @@ if (dataFilter_value == 0.0) discard;
|
|
|
163
163
|
if (filter_transformColor) {
|
|
164
164
|
color.a *= dataFilter_value;
|
|
165
165
|
}
|
|
166
|
-
`},
|
|
166
|
+
`},Ce={name:"data-filter",vs:Ae,fs:Fe,inject:Le,getUniforms:Oe},Ie={name:"data-filter-fp64",vs:Ae,fs:Fe,inject:Le,getUniforms:Gt};var Re=_(ke(),1);var Ut=`#version 300 es
|
|
167
167
|
#define SHADER_NAME data-filter-vertex-shader
|
|
168
168
|
|
|
169
169
|
#ifdef FLOAT_TARGET
|
|
@@ -208,7 +208,7 @@ void main() {
|
|
|
208
208
|
}
|
|
209
209
|
fragColor = vColor;
|
|
210
210
|
}
|
|
211
|
-
`,Ht=["float32-renderable-webgl","texture-blend-float-webgl"];function
|
|
211
|
+
`,Ht=["float32-renderable-webgl","texture-blend-float-webgl"];function Ne(r){return Ht.every(e=>r.features.has(e))}function we(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 Be(r,e,t){return e.defines.NON_INSTANCED_MODEL=1,t&&(e.defines.FLOAT_TARGET=1),new Re.Model(r,{id:"data-filter-aggregation-model",vertexCount:1,isInstanced:!1,drawMode:0,vs:Ut,fs:qt,...e})}var De={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},Ve={1:"float",2:"vec2",3:"vec3",4:"vec4"},O=class extends b.LayerExtension{constructor(e={}){super({...Kt,...e})}getShaders(e){let{categorySize:t,filterSize:o,fp64:i}=e.opts,s={};return t&&(s.DATACATEGORY_TYPE=Ve[t],s.DATACATEGORY_CHANNELS=t),o&&(s.DATAFILTER_TYPE=Ve[o],s.DATAFILTER_DOUBLE=Boolean(i)),{modules:[i?Ie:Ce],defines:s}}initializeState(e,t){let o=this.getAttributeManager(),{categorySize:i,filterSize:s,fp64:n}=t.opts;o&&(s&&o.add({filterValues:{size:s,type:n?"float64":"float32",stepMode:"dynamic",accessor:"getFilterValue"}}),i&&o.add({filterCategoryValues:{size:i,stepMode:"dynamic",accessor:"getFilterCategory",transform:i===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=Ne(a);o.add({filterIndices:{size:l?1:2,vertexOffset:1,type:"unorm8",accessor:(u,{index:p})=>{let m=u&&u.__source?u.__source.index:p;return l?(m+1)%255:[(m+1)%255,Math.floor(m/255)%255]},shaderAttributes:{filterPrevIndices:{vertexOffset:0},filterIndices:{vertexOffset:1}}}});let f=we(a,l),c=Be(a,t.getShaders.call(this,t),l);this.setState({filterFBO:f,filterModel:c})}}updateState({props:e,oldProps:t,changeFlags:o},i){let s=this.getAttributeManager(),{categorySize:n}=i.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})}s?.attributes.filterCategoryValues&&((s.attributes.filterCategoryValues.needsUpdate()||!(0,b._deepEqual)(e.filterCategories,t.filterCategories,2))&&this.setState({categoryBitMask:null}),o.dataChanged&&(this.setState({categoryMap:Array(n).fill(0).map(()=>({}))}),s.attributes.filterCategoryValues.setNeedsUpdate("categoryMap")))}draw(e,t){let o=this.state.filterFBO,i=this.state.filterModel,s=this.state.filterNeedsUpdate,{onFilteredItemsChange:n}=this.props;if(this.state.categoryBitMask||t._updateCategoryBitMask.call(this,e,t),e.uniforms.filter_categoryBitMask=this.state.categoryBitMask,s&&n&&i){let{attributes:{filterValues:a,filterCategoryValues:l,filterIndices:f}}=this.getAttributeManager();i.setVertexCount(this.getNumInstances()),this.context.device.clearWebGL({framebuffer:o,color:[0,0,0,0]}),i.updateModuleSettings(e.moduleParameters),i.setAttributes({...a?.getValue(),...l?.getValue(),...f?.getValue()}),i.setUniforms(e.uniforms),i.device.withParametersWebGL({framebuffer:o,...De,viewport:[0,0,o.width,o.height]},()=>{i.draw(this.context.renderPass)});let c=i.device.readPixelsToArrayWebGL(o),u=0;for(let p=0;p<c.length;p++)u+=c[p];n({id:this.id,count:u}),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;if(!o)return;let{filterCategories:i}=this.props,s=new Uint32Array([0,0,0,0]),n=o===1?[i]:i,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);s[p]+=Math.pow(2,u%32)}else b.log.warn(`Exceeded maximum number of categories (${a})`)()}}this.state.categoryBitMask=s}_getCategoryKey(e,t){let o=this.state.categoryMap[t];return e in o||(o[e]=Object.keys(o).length),o[e]}};O.defaultProps=Wt;O.extensionName="DataFilterExtension";var je=O;var S=_(d(),1);function Q(r,e=[],t=0){let o=Math.fround(r),i=r-o;return e[t]=o,e[t+1]=i,e}function ce(r){return r-Math.fround(r)}function ue(r){let e=new Float32Array(32);for(let t=0;t<4;++t)for(let o=0;o<4;++o){let i=t*4+o;Q(r[o*4+t],e,i*2)}return e}var ze=`uniform float ONE;
|
|
212
212
|
vec2 split(float a) {
|
|
213
213
|
const float SPLIT = 4097.0;
|
|
214
214
|
float t = a * SPLIT;
|
|
@@ -340,7 +340,7 @@ return sum_fp64(split(yn), prod);
|
|
|
340
340
|
return sum_fp64(vec2(yn, 0.0), prod);
|
|
341
341
|
#endif
|
|
342
342
|
}
|
|
343
|
-
`;var
|
|
343
|
+
`;var Ge=`const vec2 E_FP64 = vec2(2.7182817459106445e+00, 8.254840366817007e-08);
|
|
344
344
|
const vec2 LOG2_FP64 = vec2(0.6931471824645996e+00, -1.9046542121259336e-09);
|
|
345
345
|
const vec2 PI_FP64 = vec2(3.1415927410125732, -8.742278012618954e-8);
|
|
346
346
|
const vec2 TWO_PI_FP64 = vec2(6.2831854820251465, -1.7484556025237907e-7);
|
|
@@ -853,7 +853,7 @@ tmp[j] = b[j + i * 4];
|
|
|
853
853
|
vec4_dot_fp64(a, tmp, out_val[i]);
|
|
854
854
|
}
|
|
855
855
|
}
|
|
856
|
-
`;var Zt={ONE:1};function $t(){return Zt}var
|
|
856
|
+
`;var Zt={ONE:1};function $t(){return Zt}var Ue={name:"fp64-arithmetic",vs:ze,getUniforms:$t,fp64ify:Q,fp64LowPart:ce,fp64ifyMatrix4:ue},J={name:"fp64",vs:Ge,dependencies:[Ue],fp64ify:Q,fp64LowPart:ce,fp64ifyMatrix4:ue};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 E(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 i=0;i<r.length;++i)if(!E(r[i],e[i]))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,_e=Math.random;function ee(r){return r>=0?Math.round(r):r%.5===0?Math.floor(r):Math.round(r)}var Vo=Math.PI/180;var I={};xe(I,{add:()=>or,angle:()=>Ar,bezier:()=>gr,ceil:()=>ir,clone:()=>Jt,copy:()=>tr,create:()=>qe,cross:()=>dr,dist:()=>Rr,distance:()=>Ze,div:()=>kr,divide:()=>Ke,dot:()=>me,equals:()=>Cr,exactEquals:()=>Lr,floor:()=>sr,forEach:()=>Dr,fromValues:()=>er,hermite:()=>vr,inverse:()=>pr,len:()=>wr,length:()=>He,lerp:()=>mr,max:()=>ar,min:()=>nr,mul:()=>Sr,multiply:()=>We,negate:()=>ur,normalize:()=>_r,random:()=>xr,rotateX:()=>Er,rotateY:()=>Mr,rotateZ:()=>Tr,round:()=>lr,scale:()=>fr,scaleAndAdd:()=>cr,set:()=>rr,slerp:()=>hr,sqrDist:()=>Nr,sqrLen:()=>Br,squaredDistance:()=>$e,squaredLength:()=>Xe,str:()=>Or,sub:()=>Ir,subtract:()=>Ye,transformMat3:()=>yr,transformMat4:()=>Pr,transformQuat:()=>br,zero:()=>Fr});function qe(){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 He(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 Ye(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function We(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}function Ke(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r}function ir(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]=ee(e[0]),r[1]=ee(e[1]),r[2]=ee(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 Ze(r,e){let t=e[0]-r[0],o=e[1]-r[1],i=e[2]-r[2];return Math.sqrt(t*t+o*o+i*i)}function $e(r,e){let t=e[0]-r[0],o=e[1]-r[1],i=e[2]-r[2];return t*t+o*o+i*i}function Xe(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],i=e[2],s=t*t+o*o+i*i;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 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],i=e[1],s=e[2],n=t[0],a=t[1],l=t[2];return r[0]=i*l-s*a,r[1]=s*n-o*l,r[2]=o*a-i*n,r}function mr(r,e,t,o){let i=e[0],s=e[1],n=e[2];return r[0]=i+o*(t[0]-i),r[1]=s+o*(t[1]-s),r[2]=n+o*(t[2]-n),r}function hr(r,e,t,o){let i=Math.acos(Math.min(Math.max(me(e,t),-1),1)),s=Math.sin(i),n=Math.sin((1-o)*i)/s,a=Math.sin(o*i)/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,o,i,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+o[0]*f+i[0]*c,r[1]=e[1]*a+t[1]*l+o[1]*f+i[1]*c,r[2]=e[2]*a+t[2]*l+o[2]*f+i[2]*c,r}function gr(r,e,t,o,i,s){let n=1-s,a=n*n,l=s*s,f=a*n,c=3*s*a,u=3*l*n,p=l*s;return r[0]=e[0]*f+t[0]*c+o[0]*u+i[0]*p,r[1]=e[1]*f+t[1]*c+o[1]*u+i[1]*p,r[2]=e[2]*f+t[2]*c+o[2]*u+i[2]*p,r}function xr(r,e){e=e===void 0?1:e;let t=_e()*2*Math.PI,o=_e()*2-1,i=Math.sqrt(1-o*o)*e;return r[0]=Math.cos(t)*i,r[1]=Math.sin(t)*i,r[2]=o*e,r}function Pr(r,e,t){let o=e[0],i=e[1],s=e[2],n=t[3]*o+t[7]*i+t[11]*s+t[15];return n=n||1,r[0]=(t[0]*o+t[4]*i+t[8]*s+t[12])/n,r[1]=(t[1]*o+t[5]*i+t[9]*s+t[13])/n,r[2]=(t[2]*o+t[6]*i+t[10]*s+t[14])/n,r}function yr(r,e,t){let o=e[0],i=e[1],s=e[2];return r[0]=o*t[0]+i*t[3]+s*t[6],r[1]=o*t[1]+i*t[4]+s*t[7],r[2]=o*t[2]+i*t[5]+s*t[8],r}function br(r,e,t){let o=t[0],i=t[1],s=t[2],n=t[3],a=e[0],l=e[1],f=e[2],c=i*f-s*l,u=s*a-o*f,p=o*l-i*a,m=i*p-s*u,x=s*c-o*p,Z=o*u-i*c,h=n*2;return c*=h,u*=h,p*=h,m*=2,x*=2,Z*=2,r[0]=a+c+m,r[1]=l+u+x,r[2]=f+p+Z,r}function Er(r,e,t,o){let i=[],s=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],s[0]=i[0],s[1]=i[1]*Math.cos(o)-i[2]*Math.sin(o),s[2]=i[1]*Math.sin(o)+i[2]*Math.cos(o),r[0]=s[0]+t[0],r[1]=s[1]+t[1],r[2]=s[2]+t[2],r}function Mr(r,e,t,o){let i=[],s=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],s[0]=i[2]*Math.sin(o)+i[0]*Math.cos(o),s[1]=i[1],s[2]=i[2]*Math.cos(o)-i[0]*Math.sin(o),r[0]=s[0]+t[0],r[1]=s[1]+t[1],r[2]=s[2]+t[2],r}function Tr(r,e,t,o){let i=[],s=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],s[0]=i[0]*Math.cos(o)-i[1]*Math.sin(o),s[1]=i[0]*Math.sin(o)+i[1]*Math.cos(o),s[2]=i[2],r[0]=s[0]+t[0],r[1]=s[1]+t[1],r[2]=s[2]+t[2],r}function Ar(r,e){let t=r[0],o=r[1],i=r[2],s=e[0],n=e[1],a=e[2],l=Math.sqrt((t*t+o*o+i*i)*(s*s+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],i=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(o-n)<=1e-6*Math.max(1,Math.abs(o),Math.abs(n))&&Math.abs(i-a)<=1e-6*Math.max(1,Math.abs(i),Math.abs(a))}var Ir=Ye,Sr=We,kr=Ke,Rr=Ze,Nr=$e,wr=He,Br=Xe,Dr=function(){let r=qe();return function(e,t,o,i,s,n){let a,l;for(t||(t=3),o||(o=0),i?l=Math.min(i*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],s(r,r,n),e[a]=r[0],e[a+1]=r[1],e[a+2]=r[2];return e}}();var te=_(d(),1);var Qe=`const vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097);
|
|
857
857
|
uniform vec2 project_uViewProjectionMatrixFP64[16];
|
|
858
858
|
void mercatorProject_fp64(vec4 lnglat_fp64, out vec2 out_val[2]) {
|
|
859
859
|
#if defined(NVIDIA_FP64_WORKAROUND)
|
|
@@ -913,7 +913,7 @@ return project_position_to_clipspace(
|
|
|
913
913
|
position, position64xyLow, offset, commonPosition
|
|
914
914
|
);
|
|
915
915
|
}
|
|
916
|
-
`;var{fp64ify:Vr,fp64ifyMatrix4:jr}=re
|
|
916
|
+
`;var{fp64ify:Vr,fp64ifyMatrix4:jr}=J,re={name:"project64",dependencies:[te.project,J],vs:Qe,getUniforms:Gr},zr=(0,te._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),o=Vr(e);return{project_uViewProjectionMatrixFP64:t,project64_uViewProjectionMatrix:t,project64_uScale:o}}var oe=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:[re]}}};oe.extensionName="Fp64Extension";var Je=oe;var k=_(d(),1);var et={inject:{"vs:#decl":`
|
|
917
917
|
in vec2 instanceDashArrays;
|
|
918
918
|
in float instanceDashOffsets;
|
|
919
919
|
out vec2 vDashArray;
|
|
@@ -958,7 +958,7 @@ discard;
|
|
|
958
958
|
}
|
|
959
959
|
}
|
|
960
960
|
}
|
|
961
|
-
`}},
|
|
961
|
+
`}},tt={inject:{"vs:#decl":`
|
|
962
962
|
in float instanceOffsets;
|
|
963
963
|
`,"vs:DECKGL_FILTER_SIZE":`
|
|
964
964
|
float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
|
|
@@ -975,7 +975,7 @@ isInside = step(-1.0, vPathPosition.x) * step(vPathPosition.x, 1.0);
|
|
|
975
975
|
if (isInside == 0.0) {
|
|
976
976
|
discard;
|
|
977
977
|
}
|
|
978
|
-
`}};var qr={getDashArray:{type:"accessor",value:[0,0]},getOffset:{type:"accessor",value:0},dashJustified:!1,dashGapPickable:!1},
|
|
978
|
+
`}};var qr={getDashArray:{type:"accessor",value:[0,0]},getOffset:{type:"accessor",value:0},dashJustified:!1,dashGapPickable:!1},R=class extends k.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,k._mergeShaders)(t,et)),e.opts.offset&&(t=(0,k._mergeShaders)(t,tt)),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:i=>{i.constant=!0,i.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,i=Array.isArray(e[0]),s=i?e.length:e.length/o,n,a;for(let l=0;l<s-1;l++)n=i?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[s-1]=0,t}};R.defaultProps=qr;R.extensionName="PathStyleExtension";var rt=R;var it=_(d(),1);var N=_(d(),1);var Hr=`
|
|
979
979
|
in vec4 fillPatternFrames;
|
|
980
980
|
in float fillPatternScales;
|
|
981
981
|
in vec2 fillPatternOffsets;
|
|
@@ -1014,12 +1014,12 @@ if (!fill_patternMask) {
|
|
|
1014
1014
|
color.rgb = patternColor.rgb;
|
|
1015
1015
|
}
|
|
1016
1016
|
}
|
|
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:i}=e,s=[(0,
|
|
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:i}=e,s=[(0,N.fp64LowPart)(i[0]),(0,N.fp64LowPart)(i[1])];return{fill_uvCoordinateOrigin:i.slice(0,2),fill_uvCoordinateOrigin64Low:s,fill_patternMask:t,fill_patternEnabled:o}}return{}}var ot={name:"fill-pattern",vs:Hr,fs:Yr,inject:Wr,dependencies:[N.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]}},w=class extends it.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&&ot].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]}};w.defaultProps=Zr;w.extensionName="FillStyleExtension";var st=w;var nt=_(d(),1);var $r={clipBounds:[0,0,1,1],clipByInstance:void 0},at=`
|
|
1018
1018
|
uniform vec4 clip_bounds;
|
|
1019
1019
|
bool clip_isInBounds(vec2 position) {
|
|
1020
1020
|
return position.x >= clip_bounds[0] && position.y >= clip_bounds[1] && position.x < clip_bounds[2] && position.y < clip_bounds[3];
|
|
1021
1021
|
}
|
|
1022
|
-
`,Xr={name:"clip-vs",vs:
|
|
1022
|
+
`,Xr={name:"clip-vs",vs:at},Qr={"vs:#decl":`
|
|
1023
1023
|
out float clip_isVisible;
|
|
1024
1024
|
`,"vs:DECKGL_FILTER_GL_POSITION":`
|
|
1025
1025
|
clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));
|
|
@@ -1027,7 +1027,7 @@ clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));
|
|
|
1027
1027
|
in float clip_isVisible;
|
|
1028
1028
|
`,"fs:DECKGL_FILTER_COLOR":`
|
|
1029
1029
|
if (clip_isVisible < 0.5) discard;
|
|
1030
|
-
`},Jr={name:"clip-fs",fs:
|
|
1030
|
+
`},Jr={name:"clip-fs",fs:at},eo={"vs:#decl":`
|
|
1031
1031
|
out vec2 clip_commonPosition;
|
|
1032
1032
|
`,"vs:DECKGL_FILTER_GL_POSITION":`
|
|
1033
1033
|
clip_commonPosition = geometry.position.xy;
|
|
@@ -1035,7 +1035,7 @@ clip_commonPosition = geometry.position.xy;
|
|
|
1035
1035
|
in vec2 clip_commonPosition;
|
|
1036
1036
|
`,"fs:DECKGL_FILTER_COLOR":`
|
|
1037
1037
|
if (!clip_isInBounds(clip_commonPosition)) discard;
|
|
1038
|
-
`},
|
|
1038
|
+
`},B=class extends nt.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]),i=this.projectPosition([t[2],t[3],0]);e.clip_bounds=[Math.min(o[0],i[0]),Math.min(o[1],i[1]),Math.max(o[0],i[0]),Math.max(o[1],i[1])]}}};B.defaultProps=$r;B.extensionName="ClipExtension";var lt=B;var _t=_(d(),1);var ft=_(d(),1);var to=`
|
|
1039
1039
|
in float collisionPriorities;
|
|
1040
1040
|
uniform sampler2D collision_texture;
|
|
1041
1041
|
uniform bool collision_sort;
|
|
@@ -1087,7 +1087,7 @@ position = vec4(0.0, 0.0, 2.0, 1.0);
|
|
|
1087
1087
|
}
|
|
1088
1088
|
`,"vs:DECKGL_FILTER_COLOR":`
|
|
1089
1089
|
color.a *= collision_fade;
|
|
1090
|
-
`},oo=(r,e)=>{if(!r||!("dummyCollisionMap"in r))return{};let{collisionFBO:t,drawToCollisionMap:o,dummyCollisionMap:i}=r;return{collision_sort:Boolean(o),collision_texture:!o&&t?t.colorAttachments[0]:i}},
|
|
1090
|
+
`},oo=(r,e)=>{if(!r||!("dummyCollisionMap"in r))return{};let{collisionFBO:t,drawToCollisionMap:o,dummyCollisionMap:i}=r;return{collision_sort:Boolean(o),collision_texture:!o&&t?t.colorAttachments[0]:i}},ct={name:"collision",dependencies:[ft.project],vs:to,inject:ro,getUniforms:oo};var pt=_(d(),1);var ut=_(d(),1),D=class extends ut._LayersPass{renderCollisionMap(e,t){let i=[0,0,0,0],s=[1,1,e.width-2*1,e.height-2*1];this.render({...t,clearColor:i,scissorRect:s,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 he=2,V=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 D(t,{id:"default-collision-filter"})}preRender({effects:e,layers:t,layerFilter:o,viewports:i,onViewportActive:s,views:n,isPicking:a,preRenderStats:l={}}){let{device:f}=this.context;if(a)return;let c=t.filter(({props:{visible:h,collisionEnabled:fe}})=>h&&fe);if(c.length===0){this.channels={};return}let u=e?.filter(h=>h.useInPicking&&l[h.id]),p=l["mask-effect"]?.didRender,m=this._groupByCollisionGroup(f,c),x=i[0],Z=!this.lastViewport||!this.lastViewport.equals(x)||p;for(let h in m){let fe=this.collisionFBOs[h],Ot=m[h],[Lt,Ct]=f.canvasContext.getPixelSize();fe.resize({width:Lt/he,height:Ct/he}),this._render(Ot,{effects:u,layerFilter:o,onViewportActive:s,views:n,viewport:x,viewportChanged:Z})}}_render(e,{effects:t,layerFilter:o,onViewportActive:i,views:s,viewport:n,viewportChanged:a}){let{collisionGroup:l}=e,f=this.channels[l];if(!f)return;let c=a||e===f||!(0,pt._deepEqual)(f.layers,e.layers,1)||e.layerBounds.some((u,p)=>!E(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:i,views:s,moduleParameters:{dummyCollisionMap:this.dummyCollisionMap,devicePixelRatio:u.device.canvasContext.getDevicePixelRatio()/he}})}}_groupByCollisionGroup(e,t){let o={};for(let i of t){let{collisionGroup:s}=i.props,n=o[s];n||(n={collisionGroup:s,layers:[],layerBounds:[],allLayersLoaded:!0},o[s]=n),n.layers.push(i),n.layerBounds.push(i.getBounds()),i.isLoaded||(n.allLayersLoaded=!1)}for(let i of Object.keys(o))this.collisionFBOs[i]||this.createFBO(e,i),this.channels[i]||(this.channels[i]=o[i]);for(let i of Object.keys(this.collisionFBOs))o[i]||this.destroyFBO(i);return o}getModuleParameters(e){let{collisionGroup:t}=e.props,{collisionFBOs:o,dummyCollisionMap:i}=this;return{collisionFBO:o[t],dummyCollisionMap:i}}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:i}=e.gl.canvas,s=e.createTexture({format:"rgba8unorm",width:o,height:i,sampler:{minFilter:"nearest",magFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),n=e.createTexture({format:"depth16unorm",width:o,height:i,mipmaps:!1,dataFormat:6402,type:5125});this.collisionFBOs[t]=e.createFramebuffer({id:`collision-${t}`,width:o,height:i,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 io={getCollisionPriority:{type:"accessor",value:0},collisionEnabled:!0,collisionGroup:{type:"string",value:"default"},collisionTestProps:{}},j=class extends _t.LayerExtension{getShaders(){return{modules:[ct]}}draw({uniforms:e,context:t,moduleParameters:o}){let{collisionEnabled:i}=this.props,{collisionFBO:s,drawToCollisionMap:n}=o,a=i&&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 V),this.getAttributeManager().add({collisionPriorities:{size:1,stepMode:"dynamic",accessor:"getCollisionPriority"}})}getNeedsPickingBuffer(){return this.props.collisionEnabled}};j.defaultProps=io;j.extensionName="CollisionFilterExtension";var dt=j;var y=_(d(),1);var mt=_(d(),1);var so=`
|
|
1091
1091
|
uniform vec4 mask_bounds;
|
|
1092
1092
|
uniform bool mask_maskByInstance;
|
|
1093
1093
|
vec2 mask_getCoords(vec4 position) {
|
|
@@ -1137,13 +1137,13 @@ bool mask = mask_isInBounds(mask_texCoords);
|
|
|
1137
1137
|
fragColor = texture(mask_texture, mask_texCoords);
|
|
1138
1138
|
if (!mask) discard;
|
|
1139
1139
|
}
|
|
1140
|
-
`},lo=r=>r&&"maskMap"in r?{mask_texture:r.maskMap}:{},
|
|
1141
|
-
`),
|
|
1140
|
+
`},lo=r=>r&&"maskMap"in r?{mask_texture:r.maskMap}:{},ht={name:"mask",dependencies:[mt.project],vs:so,fs:no,inject:ao,getUniforms:lo};var ve=_(d(),1);var vt=_(d(),1),fo={blendColorOperation:"subtract",blendColorSrcFactor:"zero",blendColorDstFactor:"one",blendAlphaOperation:"subtract",blendAlphaSrcFactor:"zero",blendAlphaDstFactor:"one"},z=class extends vt._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 ie=_(d(),1);function M(r,e){let t=[1/0,1/0,-1/0,-1/0];for(let o of r){let i=o.getBounds();if(i){let s=o.projectPosition(i[0],{viewport:e,autoOffset:!1}),n=o.projectPosition(i[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 co=2048;function T(r){let{bounds:e,viewport:t,border:o=0}=r,{isGeospatial:i}=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-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 i?new ie.WebMercatorViewport({id:t.id,x:o,y:o,width:n,height:a,longitude:s[0],latitude:s[1],zoom:l,orthographic:!0}):new ie.OrthographicViewport({id:t.id,x:o,y:o,width:n,height:a,target:s,zoom:l,flipY:!1})}function uo(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 o=r.projectPosition(t.slice(0,2)),i=r.projectPosition(t.slice(2,4));return[o[0],o[1],i[0],i[1]]}function A(r,e,t){if(!r)return[0,0,1,1];let o=uo(e,t),i=po(o);return r[2]-r[0]<=i[2]-i[0]&&r[3]-r[1]<=i[3]-i[1]?r:[Math.max(r[0],i[0]),Math.max(r[1],i[1]),Math.min(r[2],i[2]),Math.min(r[3],i[3])]}function po(r){let e=r[2]-r[0],t=r[3]-r[1],o=(r[0]+r[2])/2,i=(r[1]+r[3])/2;return[o-e,i-t,o+e,i+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 z(e,{id:"default-mask"}),this.maskMap=this.maskPass.maskMap}preRender({layers:e,layerFilter:t,viewports:o,onViewportActive:i,views:s,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 ve.log.warn("MaskExtension is not supported in GlobeView")(),{didRender:a};for(let p in f){let m=this._renderChannel(f[p],{layerFilter:t,onViewportActive:i,views:s,viewport:c,viewportChanged:u});a||(a=m)}return{didRender:a}}_renderChannel(e,{layerFilter:t,onViewportActive:o,views:i,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=M(e.layers,s);if(e.bounds=c&&A(c,s),f||!E(e.bounds,l.bounds)){let{maskPass:u,maskMap:p}=this,m=c&&T({bounds:e.bounds,viewport:s,width:p.width,height:p.height,border:1});e.maskBounds=m?m.getBounds():[0,0,1,1],u.render({pass:"mask",channel:e.index,layers:e.layers,layerFilter:t,viewports:m?[m]:[],onViewportActive:o,views:i,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 i of e){let{id:s}=i.root,n=t[s];if(!n){if(++o>4){ve.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:i.root.props.coordinateOrigin,coordinateSystem:i.root.props.coordinateSystem},t[s]=n}n.layers.push(i),n.layerBounds.push(i.getBounds())}for(let i=0;i<4;i++){let s=this.channels[i];(!s||!(s.id in t))&&(this.channels[i]=null)}for(let i in t){let s=t[i];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 _o={maskId:"",maskByInstance:void 0,maskInverted:!1},U=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:[ht]}}draw({uniforms:e,context:t,moduleParameters:o}){e.mask_maskByInstance=this.state.maskByInstance;let{maskId:i,maskInverted:s}=this.props,{maskChannels:n}=o,{viewport:a}=t;if(n&&n[i]){let{index:l,bounds:f,coordinateOrigin:c}=n[i],{coordinateSystem:u}=n[i];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 p={modelMatrix:null,fromCoordinateOrigin:c,fromCoordinateSystem:u},m=this.projectPosition([f[0],f[1],0],p),x=this.projectPosition([f[2],f[3],0],p);e.mask_bounds=[m[0],m[1],x[0],x[1]]}else i&&y.log.warn(`Could not find a mask layer with id: ${i}`)(),e.mask_enabled=!1}};U.defaultProps=_o;U.extensionName="MaskExtension";var gt=U;var At=_(d(),1);var Tt=_(d(),1);var Pt=_(d(),1);var g={NONE:0,WRITE_HEIGHT_MAP:1,USE_HEIGHT_MAP:2,USE_COVER:3,USE_COVER_ONLY:4,SKIP:5},xt=Object.keys(g).map(r=>`const float TERRAIN_MODE_${r} = ${g[r]}.0;`).join(`
|
|
1141
|
+
`),q={name:"terrain",dependencies:[Pt.project],inject:{"vs:#decl":`
|
|
1142
1142
|
uniform float terrain_mode;
|
|
1143
1143
|
uniform sampler2D terrain_map;
|
|
1144
1144
|
uniform vec4 terrain_bounds;
|
|
1145
1145
|
out vec3 commonPos;
|
|
1146
|
-
`+
|
|
1146
|
+
`+xt,"vs:#main-start":`
|
|
1147
1147
|
if (terrain_mode == TERRAIN_MODE_SKIP) {
|
|
1148
1148
|
gl_Position = vec4(0.0);
|
|
1149
1149
|
return;
|
|
@@ -1171,7 +1171,7 @@ uniform float terrain_mode;
|
|
|
1171
1171
|
uniform sampler2D terrain_map;
|
|
1172
1172
|
uniform vec4 terrain_bounds;
|
|
1173
1173
|
in vec3 commonPos;
|
|
1174
|
-
`+
|
|
1174
|
+
`+xt,"fs:#main-start":`
|
|
1175
1175
|
if (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {
|
|
1176
1176
|
fragColor = vec4(commonPos.z, 0.0, 0.0, 1.0);
|
|
1177
1177
|
return;
|
|
@@ -1187,6 +1187,6 @@ color = pixel + color * (1.0 - pixel.a);
|
|
|
1187
1187
|
}
|
|
1188
1188
|
return;
|
|
1189
1189
|
}
|
|
1190
|
-
`},getUniforms:(r={},e)=>{if("dummyHeightMap"in r){let{drawToTerrainHeightMap:t,heightMap:o,heightMapBounds:i,dummyHeightMap:s,terrainCover:n,useTerrainHeightMap:a,terrainSkipRender:l}=r,{project_uCommonOrigin:f}=e,c=l?g.SKIP:g.NONE,u=s,p=null;if(t)c=g.WRITE_HEIGHT_MAP,p=i;else if(a&&o)c=g.USE_HEIGHT_MAP,u=o,p=i;else if(n){let m=r.picking?.isActive;u=(m?n.getPickingFramebuffer():n.getRenderFramebuffer())?.colorAttachments[0].texture,m&&(c=g.SKIP),u?(c=c===g.SKIP?g.USE_COVER_ONLY:g.USE_COVER,p=n.bounds):u=s}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
|
|
1190
|
+
`},getUniforms:(r={},e)=>{if("dummyHeightMap"in r){let{drawToTerrainHeightMap:t,heightMap:o,heightMapBounds:i,dummyHeightMap:s,terrainCover:n,useTerrainHeightMap:a,terrainSkipRender:l}=r,{project_uCommonOrigin:f}=e,c=l?g.SKIP:g.NONE,u=s,p=null;if(t)c=g.WRITE_HEIGHT_MAP,p=i;else if(a&&o)c=g.USE_HEIGHT_MAP,u=o,p=i;else if(n){let m=r.picking?.isActive;u=(m?n.getPickingFramebuffer():n.getRenderFramebuffer())?.colorAttachments[0].texture,m&&(c=g.SKIP),u?(c=c===g.SKIP?g.USE_COVER_ONLY:g.USE_COVER,p=n.bounds):u=s}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 H(r,e){return r.createFramebuffer({id:e.id,colorAttachments:[r.createTexture({id:e.id,...e.float&&{format:"rgba32float",type:5126},mipmaps:!1,sampler:e.interpolate===!1?{minFilter:"nearest",magFilter:"nearest"}:{minFilter:"linear",magFilter:"linear"}})]})}var se=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=yt(e)}get id(){return this.targetLayer.id}get isActive(){return Boolean(this.targetLayer.getCurrentLayer())}shouldUpdate({targetLayer:e,viewport:t,layers:o,layerNeedsRedraw:i}){e&&(this.targetLayer=e);let s=t?this._updateViewport(t):!1,n=o?this._updateLayers(o):!1;if(i){for(let a of this.layers)if(i[a]){n=!0;break}}return n||s}_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 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()&&(o=!0,this.targetBounds=t.getBounds(),this.targetBoundsCommon=M([t],e));if(!this.targetBoundsCommon)return!1;let i=Math.ceil(e.zoom+.5);if(this.tile)this.bounds=this.targetBoundsCommon;else{let s=this.renderViewport?.zoom;o=o||i!==s;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:i,viewport:e})),o}getRenderFramebuffer(){return!this.renderViewport||this.layers.length===0?null:(this.fbo||(this.fbo=H(this.targetLayer.context.device,{id:this.id})),this.fbo)}getPickingFramebuffer(){return!this.renderViewport||this.layers.length===0&&!this.targetLayer.props.pickable?null:(this.pickingFbo||(this.pickingFbo=H(this.targetLayer.context.device,{id:`${this.id}-picking`,interpolate:!1})),this.pickingFbo)}filterLayers(e){return e.filter(({id:t})=>this.layers.includes(t))}delete(){let{fbo:e,pickingFbo:t}=this;e&&(e.colorAttachments[0].destroy(),e.destroy()),t&&(t.colorAttachments[0].destroy(),t.destroy())}};function mo(r,e){return e.filter(t=>{let o=yt(t);return o?ho(r.boundingBox,o.boundingBox):!0})}function yt(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 bt=_(d(),1),vo={blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},ne=class extends bt._LayersPass{getRenderableLayers(e,t){let{layers:o}=t,i=[],s=this._getDrawLayerParams(e,t,!0);for(let n=0;n<o.length;n++){let a=o[n];!a.isComposite&&s[n].shouldDrawLayer&&i.push(a)}return i}renderHeightMap(e,t){let o=e.getRenderFramebuffer(),i=e.renderViewport;!o||!i||(o.resize(i),this.render({...t,target:o,pass:"terrain-height-map",layers:t.layers,viewports:[i],effects:[],clearColor:[0,0,0,0]}))}renderTerrainCover(e,t){let o=e.getRenderFramebuffer(),i=e.renderViewport;if(!o||!i)return;let s=e.filterLayers(t.layers);o.resize(i),this.render({...t,target:o,pass:`terrain-cover-${e.id}`,layers:s,effects:[],viewports:[i],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(),1),ae=class extends Et._PickLayersPass{constructor(){super(...arguments),this.drawParameters={}}getRenderableLayers(e,t){let{layers:o}=t,i=[];this.drawParameters={},this._resetColorEncoder(t.pickZ);let s=this._getDrawLayerParams(e,t);for(let n=0;n<o.length;n++){let a=o[n];!a.isComposite&&s[n].shouldDrawLayer&&(i.push(a),this.drawParameters[a.id]=s[n].layerParameters)}return i}renderTerrainCover(e,t){let o=e.getPickingFramebuffer(),i=e.renderViewport;if(!o||!i)return;let s=e.filterLayers(t.layers),n=e.targetLayer;n.props.pickable&&s.unshift(n),o.resize(i),this.render({...t,pickingFBO:o,pass:`terrain-cover-picking-${e.id}`,layers:s,effects:[],viewports:[i],cullRect:void 0,deviceRect:i,pickZ:!1})}getLayerParameters(e,t,o){let i;return this.drawParameters[e.id]?i=this.drawParameters[e.id]:(i=super.getLayerParameters(e,t,o),i.blend=!0),{...i,depthTest:!1}}};var Mt=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 o=e.length!==this.layers.length||e.some((s,n)=>s!==this.layers[n]||s.props.transitions||s.getBounds()!==this.layersBounds[n]);o&&(this.layers=e,this.layersBounds=e.map(s=>s.getBounds()),this.layersBoundsCommon=M(e,t));let i=!this.lastViewport||!t.equals(this.lastViewport);if(!this.layersBoundsCommon)this.renderViewport=null;else if(o||i){let s=A(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?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,Mt),height:Math.min(l,Mt),viewport:t}):null,!0}return!1}delete(){this.fbo&&(this.fbo.colorAttachments[0].delete(),this.fbo.delete())}};var le=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 ne(e,{id:"terrain"}),this.terrainPickingPass=new ae(e,{id:"terrain-picking"}),Y.isSupported(e)?this.heightMap=new Y(e):Tt.log.warn("Terrain offset mode is not supported by this browser")(),t._addDefaultShaderModule(q)}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 i=t[0],s=(o?this.terrainPickingPass:this.terrainPass).getRenderableLayers(i,e),n=s.filter(l=>l.props.operation.includes("terrain"));if(n.length===0)return;o||s.filter(f=>f.state.terrainDrawMode==="offset").length>0&&this._updateHeightMap(n,i,e);let a=s.filter(l=>l.state.terrainDrawMode==="drape");this._updateTerrainCovers(n,a,i,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(q)}_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,i){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,o,i);this.isPicking||this._pruneTerrainCovers()}_updateTerrainCover(e,t,o,i){let s=this.isPicking?this.terrainPickingPass:this.terrainPass,n=this.terrainCovers.get(e.id);n||(n=new se(e),this.terrainCovers.set(e.id,n));try{let a=n.shouldUpdate({targetLayer:e,viewport:o,layers:t});(this.isPicking||n.isDirty||a)&&(s.renderTerrainCover(n,{...i,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},W=class extends At.LayerExtension{getShaders(){return{modules:[q]}}initializeState(){this.context.deck?._addDefaultEffect(new le)}updateState(e){let{props:t,oldProps:o}=e;if(this.state.terrainDrawMode&&t.terrainDrawMode===o.terrainDrawMode&&t.extruded===o.extruded)return;let{terrainDrawMode:i}=t;if(!i){let s=this.props.extruded,n=this.getAttributeManager()?.attributes,a=n&&"instancePositions"in n;i=s||a?"offset":"drape"}this.setState({terrainDrawMode:i})}onNeedsRedraw(){let e=this.state;e.terrainDrawMode==="drape"&&(e.terrainCoverNeedsRedraw=!0)}};W.defaultProps=go;W.extensionName="TerrainExtension";var Ft=W;return wt(K);})();
|
|
1191
1191
|
return __exports__;
|
|
1192
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.32",
|
|
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": "fbb23d90639ff5fc3e2942216d5edc781cb14a89"
|
|
51
51
|
}
|
|
@@ -94,7 +94,7 @@ export type DataFilterExtensionProps<DataT = any> = {
|
|
|
94
94
|
}) => void;
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
type DataFilterExtensionOptions = {
|
|
97
|
+
export type DataFilterExtensionOptions = {
|
|
98
98
|
/**
|
|
99
99
|
* The size of the category filter (number of columns to filter by). The category filter can show/hide data based on 1-4 properties of each object. Set to `0` to disable category filtering.
|
|
100
100
|
* @default 0
|
|
@@ -69,7 +69,7 @@ export type FillStyleExtensionProps<DataT = any> = {
|
|
|
69
69
|
getFillPatternOffset?: Accessor<DataT, [number, number]>;
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
-
type FillStyleExtensionOptions = {
|
|
72
|
+
export type FillStyleExtensionOptions = {
|
|
73
73
|
/** If `true`, adds the ability to tile the filled area with a pattern.
|
|
74
74
|
* @default false
|
|
75
75
|
*/
|
package/src/index.ts
CHANGED
|
@@ -13,9 +13,18 @@ export {default as project64} from './fp64/project64';
|
|
|
13
13
|
|
|
14
14
|
// Types
|
|
15
15
|
export type {BrushingExtensionProps} from './brushing/brushing-extension';
|
|
16
|
-
export type {
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
export type {
|
|
17
|
+
DataFilterExtensionProps,
|
|
18
|
+
DataFilterExtensionOptions
|
|
19
|
+
} from './data-filter/data-filter-extension';
|
|
20
|
+
export type {
|
|
21
|
+
PathStyleExtensionProps,
|
|
22
|
+
PathStyleExtensionOptions
|
|
23
|
+
} from './path-style/path-style-extension';
|
|
24
|
+
export type {
|
|
25
|
+
FillStyleExtensionProps,
|
|
26
|
+
FillStyleExtensionOptions
|
|
27
|
+
} from './fill-style/fill-style-extension';
|
|
19
28
|
export type {ClipExtensionProps} from './clip/clip-extension';
|
|
20
29
|
export type {CollisionFilterExtensionProps} from './collision-filter/collision-filter-extension';
|
|
21
30
|
export type {MaskExtensionProps} from './mask/mask-extension';
|