@deck.gl/extensions 9.0.0-beta.5 → 9.0.0-beta.7
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/shader-module.d.ts.map +1 -1
- package/dist/brushing/shader-module.js +52 -57
- package/dist/clip/clip-extension.d.ts.map +1 -1
- package/dist/clip/clip-extension.js +6 -6
- package/dist/collision-filter/shader-module.d.ts.map +1 -1
- package/dist/collision-filter/shader-module.js +46 -56
- package/dist/data-filter/aggregator.d.ts.map +1 -1
- package/dist/data-filter/aggregator.js +11 -14
- package/dist/data-filter/data-filter-extension.d.ts.map +1 -1
- package/dist/data-filter/data-filter-extension.js +2 -5
- package/dist/data-filter/shader-module.d.ts.map +1 -1
- package/dist/data-filter/shader-module.js +70 -78
- package/dist/dist.dev.js +799 -1007
- package/dist/fill-style/fill-style-extension.js +1 -1
- package/dist/fill-style/{shaders.glsl.d.ts → shader-module.d.ts} +1 -1
- package/dist/fill-style/shader-module.d.ts.map +1 -0
- package/dist/fill-style/{shaders.glsl.js → shader-module.js} +27 -33
- package/dist/fp64/project64.glsl.js +41 -60
- package/dist/index.cjs +363 -430
- package/dist/index.cjs.map +4 -4
- package/dist/mask/mask-pass.js +2 -2
- package/dist/mask/shader-module.d.ts.map +1 -1
- package/dist/mask/shader-module.js +33 -37
- package/dist/path-style/shaders.glsl.js +42 -47
- package/dist/terrain/shader-module.d.ts.map +1 -1
- package/dist/terrain/shader-module.js +30 -32
- package/dist/terrain/terrain-pass.js +2 -2
- package/dist/terrain/utils.js +2 -2
- package/dist/utils/syntax-tags.d.ts +6 -0
- package/dist/utils/syntax-tags.d.ts.map +1 -0
- package/dist/utils/syntax-tags.js +5 -0
- package/dist.min.js +862 -1120
- package/package.json +8 -12
- package/src/brushing/shader-module.ts +4 -3
- package/src/clip/clip-extension.ts +10 -9
- package/src/collision-filter/shader-module.ts +6 -4
- package/src/data-filter/aggregator.ts +8 -13
- package/src/data-filter/data-filter-extension.ts +2 -5
- package/src/data-filter/shader-module.ts +7 -6
- package/src/fill-style/fill-style-extension.ts +1 -1
- package/src/fill-style/{shaders.glsl.ts → shader-module.ts} +6 -5
- package/src/mask/shader-module.ts +7 -6
- package/src/terrain/shader-module.ts +11 -10
- package/src/terrain/utils.ts +1 -1
- package/src/utils/syntax-tags.ts +5 -0
- package/dist/fill-style/shaders.glsl.d.ts.map +0 -1
package/dist/mask/mask-pass.js
CHANGED
|
@@ -28,8 +28,8 @@ export default class MaskPass extends LayersPass {
|
|
|
28
28
|
const clearColor = [255, 255, 255, 255];
|
|
29
29
|
return this.device.withParametersWebGL({
|
|
30
30
|
blend: true,
|
|
31
|
-
blendFunc: [
|
|
32
|
-
blendEquation:
|
|
31
|
+
blendFunc: [0, 1],
|
|
32
|
+
blendEquation: 32778,
|
|
33
33
|
colorMask,
|
|
34
34
|
depthTest: false
|
|
35
35
|
}, () => super.render({ ...options, clearColor, target: this.fbo, pass: 'mask' }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-module.d.ts","sourceRoot":"","sources":["../../src/mask/shader-module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"shader-module.d.ts","sourceRoot":"","sources":["../../src/mask/shader-module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAqE3C,KAAK,kBAAkB,GAAG;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;;AAYF,wBAOsC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { project } from '@deck.gl/core';
|
|
2
|
+
import { glsl } from "../utils/syntax-tags.js";
|
|
2
3
|
const vs = `
|
|
3
4
|
uniform vec4 mask_bounds;
|
|
4
5
|
uniform bool mask_maskByInstance;
|
|
5
6
|
vec2 mask_getCoords(vec4 position) {
|
|
6
|
-
|
|
7
|
+
return (position.xy - mask_bounds.xy) / (mask_bounds.zw - mask_bounds.xy);
|
|
7
8
|
}
|
|
8
9
|
`;
|
|
9
10
|
const fs = `
|
|
@@ -12,26 +13,25 @@ uniform int mask_channel;
|
|
|
12
13
|
uniform bool mask_enabled;
|
|
13
14
|
uniform bool mask_inverted;
|
|
14
15
|
bool mask_isInBounds(vec2 texCoords) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
16
|
+
if (!mask_enabled) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
vec4 maskColor = texture(mask_texture, texCoords);
|
|
20
|
+
float maskValue = 1.0;
|
|
21
|
+
if (mask_channel == 0) {
|
|
22
|
+
maskValue = maskColor.r;
|
|
23
|
+
} else if (mask_channel == 1) {
|
|
24
|
+
maskValue = maskColor.g;
|
|
25
|
+
} else if (mask_channel == 2) {
|
|
26
|
+
maskValue = maskColor.b;
|
|
27
|
+
} else if (mask_channel == 3) {
|
|
28
|
+
maskValue = maskColor.a;
|
|
29
|
+
}
|
|
30
|
+
if (mask_inverted) {
|
|
31
|
+
return maskValue >= 0.5;
|
|
32
|
+
} else {
|
|
33
|
+
return maskValue < 0.5;
|
|
34
|
+
}
|
|
35
35
|
}
|
|
36
36
|
`;
|
|
37
37
|
const inject = {
|
|
@@ -39,27 +39,23 @@ const inject = {
|
|
|
39
39
|
out vec2 mask_texCoords;
|
|
40
40
|
`,
|
|
41
41
|
'vs:#main-end': `
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
vec4 mask_common_position;
|
|
43
|
+
if (mask_maskByInstance) {
|
|
44
|
+
mask_common_position = project_position(vec4(geometry.worldPosition, 1.0));
|
|
45
|
+
} else {
|
|
46
|
+
mask_common_position = geometry.position;
|
|
47
|
+
}
|
|
48
|
+
mask_texCoords = mask_getCoords(mask_common_position);
|
|
49
49
|
`,
|
|
50
50
|
'fs:#decl': `
|
|
51
51
|
in vec2 mask_texCoords;
|
|
52
52
|
`,
|
|
53
53
|
'fs:#main-start': `
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
fragColor = texture(mask_texture, mask_texCoords);
|
|
60
|
-
|
|
61
|
-
if (!mask) discard;
|
|
62
|
-
}
|
|
54
|
+
if (mask_enabled) {
|
|
55
|
+
bool mask = mask_isInBounds(mask_texCoords);
|
|
56
|
+
fragColor = texture(mask_texture, mask_texCoords);
|
|
57
|
+
if (!mask) discard;
|
|
58
|
+
}
|
|
63
59
|
`
|
|
64
60
|
};
|
|
65
61
|
/* eslint-disable camelcase */
|
|
@@ -26,41 +26,36 @@ in float vDashOffset;
|
|
|
26
26
|
// 1 - stretch to fit, draw half dash at each end for nicer joints
|
|
27
27
|
// o-- ---- ---- ---- --o-- --o-- ---- --o
|
|
28
28
|
'fs:#main-start': `
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
29
|
+
float solidLength = vDashArray.x;
|
|
30
|
+
float gapLength = vDashArray.y;
|
|
31
|
+
float unitLength = solidLength + gapLength;
|
|
32
|
+
float offset;
|
|
33
|
+
if (unitLength > 0.0) {
|
|
34
|
+
if (dashAlignMode == 0.0) {
|
|
35
|
+
offset = vDashOffset;
|
|
36
|
+
} else {
|
|
37
|
+
unitLength = vPathLength / round(vPathLength / unitLength);
|
|
38
|
+
offset = solidLength / 2.0;
|
|
39
|
+
}
|
|
40
|
+
float unitOffset = mod(vPathPosition.y + offset, unitLength);
|
|
41
|
+
if (gapLength > 0.0 && unitOffset > solidLength) {
|
|
42
|
+
if (capType <= 0.5) {
|
|
43
|
+
if (!(dashGapPickable && bool(picking.isActive))) {
|
|
44
|
+
discard;
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
float distToEnd = length(vec2(
|
|
48
|
+
min(unitOffset - solidLength, unitLength - unitOffset),
|
|
49
|
+
vPathPosition.x
|
|
50
|
+
));
|
|
51
|
+
if (distToEnd > 1.0) {
|
|
52
|
+
if (!(dashGapPickable && bool(picking.isActive))) {
|
|
53
|
+
discard;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
64
59
|
`
|
|
65
60
|
}
|
|
66
61
|
};
|
|
@@ -70,22 +65,22 @@ export const offsetShaders = {
|
|
|
70
65
|
in float instanceOffsets;
|
|
71
66
|
`,
|
|
72
67
|
'vs:DECKGL_FILTER_SIZE': `
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
|
|
69
|
+
size *= offsetWidth;
|
|
75
70
|
`,
|
|
76
71
|
'vs:#main-end': `
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
|
|
73
|
+
float offsetDir = sign(instanceOffsets);
|
|
74
|
+
vPathPosition.x = (vPathPosition.x + offsetDir) * offsetWidth - offsetDir;
|
|
75
|
+
vPathPosition.y *= offsetWidth;
|
|
76
|
+
vPathLength *= offsetWidth;
|
|
82
77
|
`,
|
|
83
78
|
'fs:#main-start': `
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
79
|
+
float isInside;
|
|
80
|
+
isInside = step(-1.0, vPathPosition.x) * step(vPathPosition.x, 1.0);
|
|
81
|
+
if (isInside == 0.0) {
|
|
82
|
+
discard;
|
|
83
|
+
}
|
|
89
84
|
`
|
|
90
85
|
}
|
|
91
86
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-module.d.ts","sourceRoot":"","sources":["../../src/terrain/shader-module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAGvD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAC,MAAM,EAAC,qCAAkC;AACtD,OAAO,KAAK,EAAC,YAAY,EAAC,2BAAwB;
|
|
1
|
+
{"version":3,"file":"shader-module.d.ts","sourceRoot":"","sources":["../../src/terrain/shader-module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAGvD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAC,MAAM,EAAC,qCAAkC;AACtD,OAAO,KAAK,EAAC,YAAY,EAAC,2BAAwB;AAGlD,8DAA8D;AAC9D,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC;IAC9B,SAAS,EAAE,OAAO,GAAG,IAAI,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IACnC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,kDAAkD;AAClD,eAAO,MAAM,YAAY;;IAEvB,6EAA6E;;IAE7E,2EAA2E;;IAE3E,6FAA6F;;IAE7F,0EAA0E;;IAE1E,mEAAmE;;CAEpE,CAAC;AAOF,eAAO,MAAM,aAAa,qCA6Hc,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
2
|
import { project } from '@deck.gl/core';
|
|
3
|
+
import { glsl } from "../utils/syntax-tags.js";
|
|
3
4
|
/** A model can have one of the following modes */
|
|
4
5
|
export const TERRAIN_MODE = {
|
|
5
6
|
NONE: 0,
|
|
@@ -27,59 +28,56 @@ uniform float terrain_mode;
|
|
|
27
28
|
uniform sampler2D terrain_map;
|
|
28
29
|
uniform vec4 terrain_bounds;
|
|
29
30
|
out vec3 commonPos;
|
|
30
|
-
|
|
31
|
-
`,
|
|
31
|
+
` + TERRAIN_MODE_CONSTANTS,
|
|
32
32
|
'vs:#main-start': `
|
|
33
33
|
if (terrain_mode == TERRAIN_MODE_SKIP) {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
gl_Position = vec4(0.0);
|
|
35
|
+
return;
|
|
36
36
|
}
|
|
37
37
|
`,
|
|
38
38
|
'vs:DECKGL_FILTER_GL_POSITION': `
|
|
39
39
|
commonPos = geometry.position.xyz;
|
|
40
40
|
if (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
vec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;
|
|
42
|
+
position = vec4(texCoords * 2.0 - 1.0, 0.0, 1.0);
|
|
43
|
+
commonPos.z += project_uCommonOrigin.z;
|
|
44
44
|
}
|
|
45
45
|
if (terrain_mode == TERRAIN_MODE_USE_HEIGHT_MAP) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
46
|
+
vec3 anchor = geometry.worldPosition;
|
|
47
|
+
anchor.z = 0.0;
|
|
48
|
+
vec3 anchorCommon = project_position(anchor);
|
|
49
|
+
vec2 texCoords = (anchorCommon.xy - terrain_bounds.xy) / terrain_bounds.zw;
|
|
50
|
+
if (texCoords.x >= 0.0 && texCoords.y >= 0.0 && texCoords.x <= 1.0 && texCoords.y <= 1.0) {
|
|
51
|
+
float terrainZ = texture(terrain_map, texCoords).r;
|
|
52
|
+
geometry.position.z += terrainZ;
|
|
53
|
+
position = project_common_position_to_clipspace(geometry.position);
|
|
55
54
|
}
|
|
56
|
-
|
|
55
|
+
}
|
|
56
|
+
`,
|
|
57
57
|
'fs:#decl': `
|
|
58
58
|
uniform float terrain_mode;
|
|
59
59
|
uniform sampler2D terrain_map;
|
|
60
60
|
uniform vec4 terrain_bounds;
|
|
61
61
|
in vec3 commonPos;
|
|
62
|
-
|
|
63
|
-
`,
|
|
62
|
+
` + TERRAIN_MODE_CONSTANTS,
|
|
64
63
|
'fs:#main-start': `
|
|
65
64
|
if (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
fragColor = vec4(commonPos.z, 0.0, 0.0, 1.0);
|
|
66
|
+
return;
|
|
68
67
|
}
|
|
69
|
-
|
|
68
|
+
`,
|
|
70
69
|
'fs:DECKGL_FILTER_COLOR': `
|
|
71
70
|
if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY)) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return;
|
|
71
|
+
vec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;
|
|
72
|
+
vec4 pixel = texture(terrain_map, texCoords);
|
|
73
|
+
if (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY) {
|
|
74
|
+
color = pixel;
|
|
75
|
+
} else {
|
|
76
|
+
color = pixel + color * (1.0 - pixel.a);
|
|
77
|
+
}
|
|
78
|
+
return;
|
|
81
79
|
}
|
|
82
|
-
|
|
80
|
+
`
|
|
83
81
|
},
|
|
84
82
|
// eslint-disable-next-line complexity
|
|
85
83
|
getUniforms: (opts = {}, uniforms) => {
|
|
@@ -25,8 +25,8 @@ export class TerrainPass extends LayersPass {
|
|
|
25
25
|
this.device.withParametersWebGL({
|
|
26
26
|
clearColor: [0, 0, 0, 0],
|
|
27
27
|
blend: true,
|
|
28
|
-
blendFunc: [
|
|
29
|
-
blendEquation:
|
|
28
|
+
blendFunc: [1, 1],
|
|
29
|
+
blendEquation: 32776,
|
|
30
30
|
depthTest: false
|
|
31
31
|
}, () => this.render({
|
|
32
32
|
...opts,
|
package/dist/terrain/utils.js
CHANGED
|
@@ -5,8 +5,8 @@ export function createRenderTarget(device, opts) {
|
|
|
5
5
|
colorAttachments: [
|
|
6
6
|
device.createTexture({
|
|
7
7
|
...(opts.float && {
|
|
8
|
-
format:
|
|
9
|
-
type:
|
|
8
|
+
format: 'rgba32float',
|
|
9
|
+
type: 5126
|
|
10
10
|
}),
|
|
11
11
|
mipmaps: false,
|
|
12
12
|
sampler: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syntax-tags.d.ts","sourceRoot":"","sources":["../../src/utils/syntax-tags.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,IAAI,MAAO,oBAAoB,WAAW,CAAC"}
|