@deck.gl/extensions 9.0.35 → 9.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brushing/brushing-extension.d.ts +1 -0
- package/dist/brushing/brushing-extension.d.ts.map +1 -1
- package/dist/brushing/brushing-extension.js +15 -19
- package/dist/brushing/shader-module.d.ts +8 -2
- package/dist/brushing/shader-module.d.ts.map +1 -1
- package/dist/brushing/shader-module.js +74 -50
- package/dist/clip/clip-extension.d.ts +5 -2
- package/dist/clip/clip-extension.d.ts.map +1 -1
- package/dist/clip/clip-extension.js +36 -42
- package/dist/collision-filter/collision-filter-effect.d.ts +4 -4
- package/dist/collision-filter/collision-filter-effect.d.ts.map +1 -1
- package/dist/collision-filter/collision-filter-effect.js +27 -13
- package/dist/collision-filter/collision-filter-extension.d.ts +1 -1
- package/dist/collision-filter/collision-filter-extension.d.ts.map +1 -1
- package/dist/collision-filter/collision-filter-extension.js +5 -6
- package/dist/collision-filter/collision-filter-pass.d.ts +7 -3
- package/dist/collision-filter/collision-filter-pass.d.ts.map +1 -1
- package/dist/collision-filter/collision-filter-pass.js +8 -3
- package/dist/collision-filter/shader-module.d.ts +3 -2
- package/dist/collision-filter/shader-module.d.ts.map +1 -1
- package/dist/collision-filter/shader-module.js +74 -52
- package/dist/data-filter/aggregator.d.ts +4 -10
- package/dist/data-filter/aggregator.d.ts.map +1 -1
- package/dist/data-filter/aggregator.js +14 -8
- package/dist/data-filter/data-filter-extension.d.ts.map +1 -1
- package/dist/data-filter/data-filter-extension.js +40 -38
- package/dist/data-filter/shader-module.d.ts +11 -4
- package/dist/data-filter/shader-module.d.ts.map +1 -1
- package/dist/data-filter/shader-module.js +189 -131
- package/dist/dist.dev.js +2699 -2028
- package/dist/fill-style/fill-style-extension.d.ts.map +1 -1
- package/dist/fill-style/fill-style-extension.js +11 -4
- package/dist/fill-style/shader-module.d.ts +64 -6
- package/dist/fill-style/shader-module.d.ts.map +1 -1
- package/dist/fill-style/shader-module.js +73 -51
- package/dist/fp64/fp64-extension.d.ts +1 -0
- package/dist/fp64/fp64-extension.d.ts.map +1 -1
- package/dist/fp64/fp64-extension.js +7 -19
- package/dist/fp64/project64.d.ts +2 -2
- package/dist/fp64/project64.d.ts.map +1 -1
- package/dist/fp64/project64.glsl.d.ts +1 -1
- package/dist/fp64/project64.glsl.d.ts.map +1 -1
- package/dist/fp64/project64.glsl.js +18 -21
- package/dist/fp64/project64.js +24 -24
- package/dist/index.cjs +1017 -523
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/mask/mask-effect.d.ts +5 -3
- package/dist/mask/mask-effect.d.ts.map +1 -1
- package/dist/mask/mask-effect.js +12 -5
- package/dist/mask/mask-extension.d.ts +1 -1
- package/dist/mask/mask-extension.d.ts.map +1 -1
- package/dist/mask/mask-extension.js +13 -8
- package/dist/mask/mask-pass.d.ts +38 -38
- package/dist/mask/mask-pass.d.ts.map +1 -1
- package/dist/mask/mask-pass.js +3 -0
- package/dist/mask/shader-module.d.ts +60 -3
- package/dist/mask/shader-module.d.ts.map +1 -1
- package/dist/mask/shader-module.js +73 -46
- package/dist/path-style/path-style-extension.d.ts.map +1 -1
- package/dist/path-style/path-style-extension.js +20 -24
- package/dist/path-style/shaders.glsl.d.ts.map +1 -1
- package/dist/path-style/shaders.glsl.js +11 -7
- package/dist/terrain/height-map-builder.d.ts.map +1 -1
- package/dist/terrain/height-map-builder.js +3 -0
- package/dist/terrain/shader-module.d.ts +60 -6
- package/dist/terrain/shader-module.d.ts.map +1 -1
- package/dist/terrain/shader-module.js +69 -61
- package/dist/terrain/terrain-cover.d.ts.map +1 -1
- package/dist/terrain/terrain-cover.js +3 -0
- package/dist/terrain/terrain-effect.d.ts +4 -2
- package/dist/terrain/terrain-effect.d.ts.map +1 -1
- package/dist/terrain/terrain-effect.js +31 -18
- package/dist/terrain/terrain-extension.d.ts.map +1 -1
- package/dist/terrain/terrain-extension.js +3 -0
- package/dist/terrain/terrain-pass.d.ts +43 -38
- package/dist/terrain/terrain-pass.d.ts.map +1 -1
- package/dist/terrain/terrain-pass.js +10 -0
- package/dist/terrain/terrain-picking-pass.d.ts +5 -0
- package/dist/terrain/terrain-picking-pass.d.ts.map +1 -1
- package/dist/terrain/terrain-picking-pass.js +10 -0
- package/dist/terrain/utils.d.ts.map +1 -1
- package/dist/terrain/utils.js +3 -0
- package/dist/utils/debug.d.ts +2 -2
- package/dist/utils/debug.d.ts.map +1 -1
- package/dist/utils/debug.js +3 -1
- package/dist/utils/projection-utils.d.ts.map +1 -1
- package/dist/utils/projection-utils.js +3 -0
- package/dist.min.js +1102 -817
- package/package.json +8 -8
- package/src/brushing/brushing-extension.ts +17 -20
- package/src/brushing/shader-module.ts +58 -47
- package/src/clip/clip-extension.ts +38 -40
- package/src/collision-filter/collision-filter-effect.ts +31 -20
- package/src/collision-filter/collision-filter-extension.ts +6 -7
- package/src/collision-filter/collision-filter-pass.ts +9 -3
- package/src/collision-filter/shader-module.ts +40 -22
- package/src/data-filter/aggregator.ts +23 -11
- package/src/data-filter/data-filter-extension.ts +68 -48
- package/src/data-filter/shader-module.ts +144 -84
- package/src/fill-style/fill-style-extension.ts +13 -5
- package/src/fill-style/shader-module.ts +84 -52
- package/src/fp64/fp64-extension.ts +8 -19
- package/src/fp64/project64.glsl.ts +18 -21
- package/src/fp64/project64.ts +27 -28
- package/src/index.ts +5 -0
- package/src/mask/mask-effect.ts +17 -7
- package/src/mask/mask-extension.ts +16 -9
- package/src/mask/mask-pass.ts +4 -0
- package/src/mask/shader-module.ts +63 -27
- package/src/path-style/path-style-extension.ts +27 -28
- package/src/path-style/shaders.glsl.ts +13 -7
- package/src/terrain/height-map-builder.ts +4 -0
- package/src/terrain/shader-module.ts +62 -44
- package/src/terrain/terrain-cover.ts +4 -0
- package/src/terrain/terrain-effect.ts +36 -19
- package/src/terrain/terrain-extension.ts +4 -0
- package/src/terrain/terrain-pass.ts +12 -0
- package/src/terrain/terrain-picking-pass.ts +12 -0
- package/src/terrain/utils.ts +4 -0
- package/src/utils/debug.ts +4 -0
- package/src/utils/projection-utils.ts +4 -0
- package/dist/utils/syntax-tags.d.ts +0 -6
- package/dist/utils/syntax-tags.d.ts.map +0 -1
- package/dist/utils/syntax-tags.js +0 -5
- package/src/utils/syntax-tags.ts +0 -5
|
@@ -1,78 +1,100 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { project } from '@deck.gl/core';
|
|
2
|
-
|
|
3
|
-
const vs = `
|
|
5
|
+
const vs = /* glsl */ `
|
|
4
6
|
in float collisionPriorities;
|
|
7
|
+
|
|
5
8
|
uniform sampler2D collision_texture;
|
|
6
|
-
|
|
7
|
-
uniform
|
|
9
|
+
|
|
10
|
+
uniform collisionUniforms {
|
|
11
|
+
bool sort;
|
|
12
|
+
bool enabled;
|
|
13
|
+
} collision;
|
|
14
|
+
|
|
8
15
|
vec2 collision_getCoords(vec4 position) {
|
|
9
|
-
vec4 collision_clipspace = project_common_position_to_clipspace(position);
|
|
10
|
-
return (1.0 + collision_clipspace.xy / collision_clipspace.w) / 2.0;
|
|
16
|
+
vec4 collision_clipspace = project_common_position_to_clipspace(position);
|
|
17
|
+
return (1.0 + collision_clipspace.xy / collision_clipspace.w) / 2.0;
|
|
11
18
|
}
|
|
19
|
+
|
|
12
20
|
float collision_match(vec2 tex, vec3 pickingColor) {
|
|
13
|
-
vec4 collision_pickingColor = texture(collision_texture, tex);
|
|
14
|
-
float delta = dot(abs(collision_pickingColor.rgb - pickingColor), vec3(1.0));
|
|
15
|
-
float e = 0.001;
|
|
16
|
-
return step(delta, e);
|
|
21
|
+
vec4 collision_pickingColor = texture(collision_texture, tex);
|
|
22
|
+
float delta = dot(abs(collision_pickingColor.rgb - pickingColor), vec3(1.0));
|
|
23
|
+
float e = 0.001;
|
|
24
|
+
return step(delta, e);
|
|
17
25
|
}
|
|
26
|
+
|
|
18
27
|
float collision_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
19
|
-
if (!
|
|
20
|
-
return 1.0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
delta
|
|
32
|
-
|
|
33
|
-
delta.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
if (!collision.enabled) {
|
|
29
|
+
return 1.0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Visibility test, sample area of 5x5 pixels in order to fade in/out.
|
|
33
|
+
// Due to the locality, the lookups will be cached
|
|
34
|
+
// This reduces the flicker present when objects are shown/hidden
|
|
35
|
+
const int N = 2;
|
|
36
|
+
float accumulator = 0.0;
|
|
37
|
+
vec2 step = vec2(1.0 / project.viewportSize);
|
|
38
|
+
|
|
39
|
+
const float floatN = float(N);
|
|
40
|
+
vec2 delta = -floatN * step;
|
|
41
|
+
for(int i = -N; i <= N; i++) {
|
|
42
|
+
delta.x = -step.x * floatN;
|
|
43
|
+
for(int j = -N; j <= N; j++) {
|
|
44
|
+
accumulator += collision_match(texCoords + delta, pickingColor);
|
|
45
|
+
delta.x += step.x;
|
|
46
|
+
}
|
|
47
|
+
delta.y += step.y;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
float W = 2.0 * floatN + 1.0;
|
|
51
|
+
return pow(accumulator / (W * W), 2.2);
|
|
37
52
|
}
|
|
38
53
|
`;
|
|
39
54
|
const inject = {
|
|
40
|
-
'vs:#decl': `
|
|
41
|
-
float collision_fade = 1.0;
|
|
42
|
-
`,
|
|
43
|
-
'vs:DECKGL_FILTER_GL_POSITION': `
|
|
44
|
-
if (collision_sort) {
|
|
45
|
-
float collisionPriority = collisionPriorities;
|
|
46
|
-
position.z = -0.001 * collisionPriority * position.w;
|
|
47
|
-
}
|
|
48
|
-
if (collision_enabled) {
|
|
49
|
-
vec4 collision_common_position = project_position(vec4(geometry.worldPosition, 1.0));
|
|
50
|
-
vec2 collision_texCoords = collision_getCoords(collision_common_position);
|
|
51
|
-
collision_fade = collision_isVisible(collision_texCoords, geometry.pickingColor / 255.0);
|
|
52
|
-
if (collision_fade < 0.0001) {
|
|
53
|
-
position = vec4(0.0, 0.0, 2.0, 1.0);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
55
|
+
'vs:#decl': /* glsl */ `
|
|
56
|
+
float collision_fade = 1.0;
|
|
56
57
|
`,
|
|
57
|
-
'vs:
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
'vs:DECKGL_FILTER_GL_POSITION': /* glsl */ `
|
|
59
|
+
if (collision.sort) {
|
|
60
|
+
float collisionPriority = collisionPriorities;
|
|
61
|
+
position.z = -0.001 * collisionPriority * position.w; // Support range -1000 -> 1000
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (collision.enabled) {
|
|
65
|
+
vec4 collision_common_position = project_position(vec4(geometry.worldPosition, 1.0));
|
|
66
|
+
vec2 collision_texCoords = collision_getCoords(collision_common_position);
|
|
67
|
+
collision_fade = collision_isVisible(collision_texCoords, geometry.pickingColor / 255.0);
|
|
68
|
+
if (collision_fade < 0.0001) {
|
|
69
|
+
// Position outside clip space bounds to discard
|
|
70
|
+
position = vec4(0.0, 0.0, 2.0, 1.0);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
`,
|
|
74
|
+
'vs:DECKGL_FILTER_COLOR': /* glsl */ `
|
|
75
|
+
color.a *= collision_fade;
|
|
76
|
+
`
|
|
60
77
|
};
|
|
61
|
-
const getCollisionUniforms = (opts
|
|
78
|
+
const getCollisionUniforms = (opts) => {
|
|
62
79
|
if (!opts || !('dummyCollisionMap' in opts)) {
|
|
63
80
|
return {};
|
|
64
81
|
}
|
|
65
|
-
const { collisionFBO, drawToCollisionMap, dummyCollisionMap } = opts;
|
|
82
|
+
const { enabled, collisionFBO, drawToCollisionMap, dummyCollisionMap } = opts;
|
|
66
83
|
return {
|
|
67
|
-
|
|
68
|
-
|
|
84
|
+
enabled: enabled && !drawToCollisionMap,
|
|
85
|
+
sort: Boolean(drawToCollisionMap),
|
|
69
86
|
collision_texture: !drawToCollisionMap && collisionFBO ? collisionFBO.colorAttachments[0] : dummyCollisionMap
|
|
70
87
|
};
|
|
71
88
|
};
|
|
89
|
+
// @ts-ignore
|
|
72
90
|
export default {
|
|
73
91
|
name: 'collision',
|
|
74
92
|
dependencies: [project],
|
|
75
93
|
vs,
|
|
76
94
|
inject,
|
|
77
|
-
getUniforms: getCollisionUniforms
|
|
95
|
+
getUniforms: getCollisionUniforms,
|
|
96
|
+
uniformTypes: {
|
|
97
|
+
sort: 'i32',
|
|
98
|
+
enabled: 'i32'
|
|
99
|
+
}
|
|
78
100
|
};
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import { Device, Framebuffer } from '@luma.gl/core';
|
|
2
|
-
import { Model } from '@luma.gl/engine';
|
|
3
|
-
import { GL } from '@luma.gl/constants';
|
|
1
|
+
import { Device, Framebuffer, RenderPipelineParameters } from '@luma.gl/core';
|
|
2
|
+
import { Model, ModelProps } from '@luma.gl/engine';
|
|
4
3
|
export declare function supportsFloatTarget(device: Device): boolean;
|
|
5
4
|
export declare function getFramebuffer(device: Device, useFloatTarget: boolean): Framebuffer;
|
|
6
|
-
export declare function getModel(device: Device, shaderOptions: any, useFloatTarget: boolean): Model;
|
|
7
|
-
export declare const parameters:
|
|
8
|
-
readonly blend: true;
|
|
9
|
-
readonly blendFunc: readonly [GL.LINES, GL.LINES, GL.LINES, GL.LINES];
|
|
10
|
-
readonly blendEquation: readonly [GL.FUNC_ADD, GL.FUNC_ADD];
|
|
11
|
-
readonly depthTest: false;
|
|
12
|
-
};
|
|
5
|
+
export declare function getModel(device: Device, bufferLayout: ModelProps['bufferLayout'], shaderOptions: any, useFloatTarget: boolean): Model;
|
|
6
|
+
export declare const parameters: RenderPipelineParameters;
|
|
13
7
|
//# sourceMappingURL=aggregator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregator.d.ts","sourceRoot":"","sources":["../../src/data-filter/aggregator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"aggregator.d.ts","sourceRoot":"","sources":["../../src/data-filter/aggregator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,MAAM,EAAiB,WAAW,EAAE,wBAAwB,EAAC,MAAM,eAAe,CAAC;AAC3F,OAAO,EAAC,KAAK,EAAE,UAAU,EAAC,MAAM,iBAAiB,CAAC;AA0DlD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE3D;AAGD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,GAAG,WAAW,CAkBnF;AAGD,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,UAAU,CAAC,cAAc,CAAC,EACxC,aAAa,EAAE,GAAG,EAClB,cAAc,EAAE,OAAO,GACtB,KAAK,CAgBP;AAED,eAAO,MAAM,UAAU,EAAE,wBASf,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { Model } from '@luma.gl/engine';
|
|
2
|
-
import { GL } from '@luma.gl/constants';
|
|
3
5
|
const AGGREGATE_VS = `\
|
|
4
6
|
#version 300 es
|
|
5
7
|
#define SHADER_NAME data-filter-vertex-shader
|
|
@@ -65,7 +67,6 @@ export function getFramebuffer(device, useFloatTarget) {
|
|
|
65
67
|
colorAttachments: [
|
|
66
68
|
device.createTexture({
|
|
67
69
|
format: 'rgba32float',
|
|
68
|
-
type: 5126,
|
|
69
70
|
mipmaps: false
|
|
70
71
|
})
|
|
71
72
|
]
|
|
@@ -74,11 +75,11 @@ export function getFramebuffer(device, useFloatTarget) {
|
|
|
74
75
|
return device.createFramebuffer({
|
|
75
76
|
width: 256,
|
|
76
77
|
height: 64,
|
|
77
|
-
colorAttachments: [device.createTexture({ format: 'rgba8unorm',
|
|
78
|
+
colorAttachments: [device.createTexture({ format: 'rgba8unorm', mipmaps: false })]
|
|
78
79
|
});
|
|
79
80
|
}
|
|
80
81
|
// Increments the counter based on dataFilter_value
|
|
81
|
-
export function getModel(device, shaderOptions, useFloatTarget) {
|
|
82
|
+
export function getModel(device, bufferLayout, shaderOptions, useFloatTarget) {
|
|
82
83
|
shaderOptions.defines.NON_INSTANCED_MODEL = 1;
|
|
83
84
|
if (useFloatTarget) {
|
|
84
85
|
shaderOptions.defines.FLOAT_TARGET = 1;
|
|
@@ -87,15 +88,20 @@ export function getModel(device, shaderOptions, useFloatTarget) {
|
|
|
87
88
|
id: 'data-filter-aggregation-model',
|
|
88
89
|
vertexCount: 1,
|
|
89
90
|
isInstanced: false,
|
|
90
|
-
|
|
91
|
+
topology: 'point-list',
|
|
91
92
|
vs: AGGREGATE_VS,
|
|
92
93
|
fs: AGGREGATE_FS,
|
|
94
|
+
bufferLayout,
|
|
93
95
|
...shaderOptions
|
|
94
96
|
});
|
|
95
97
|
}
|
|
96
98
|
export const parameters = {
|
|
97
99
|
blend: true,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
blendColorSrcFactor: 'one',
|
|
101
|
+
blendColorDstFactor: 'one',
|
|
102
|
+
blendAlphaSrcFactor: 'one',
|
|
103
|
+
blendAlphaDstFactor: 'one',
|
|
104
|
+
blendColorOperation: 'add',
|
|
105
|
+
blendAlphaOperation: 'add',
|
|
106
|
+
depthCompare: 'never'
|
|
101
107
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-filter-extension.d.ts","sourceRoot":"","sources":["../../src/data-filter/data-filter-extension.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"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AAE,KAAK,CAAC,wBAAwB,CAAC,EACrC,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,MAAM;CAQlB"}
|
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
20
4
|
import { _deepEqual as deepEqual, LayerExtension, log } from '@deck.gl/core';
|
|
21
|
-
import {
|
|
5
|
+
import { dataFilter, dataFilter64 } from "./shader-module.js";
|
|
22
6
|
import * as aggregator from "./aggregator.js";
|
|
23
7
|
const defaultProps = {
|
|
24
8
|
getFilterValue: { type: 'accessor', value: 0 },
|
|
@@ -59,7 +43,9 @@ class DataFilterExtension extends LayerExtension {
|
|
|
59
43
|
defines.DATAFILTER_TYPE = DATA_TYPE_FROM_SIZE[filterSize];
|
|
60
44
|
defines.DATAFILTER_DOUBLE = Boolean(fp64);
|
|
61
45
|
}
|
|
62
|
-
|
|
46
|
+
const module = fp64 ? dataFilter64 : dataFilter;
|
|
47
|
+
module.uniformTypes = module.uniformTypesFromOptions(extension.opts);
|
|
48
|
+
return { modules: [module], defines };
|
|
63
49
|
}
|
|
64
50
|
initializeState(context, extension) {
|
|
65
51
|
const attributeManager = this.getAttributeManager();
|
|
@@ -95,7 +81,7 @@ class DataFilterExtension extends LayerExtension {
|
|
|
95
81
|
// The vertex shader checks if a vertex has the same "index" as the previous vertex
|
|
96
82
|
// so that we only write one count cross multiple vertices of the same object
|
|
97
83
|
attributeManager.add({
|
|
98
|
-
|
|
84
|
+
filterVertexIndices: {
|
|
99
85
|
size: useFloatTarget ? 1 : 2,
|
|
100
86
|
vertexOffset: 1,
|
|
101
87
|
type: 'unorm8',
|
|
@@ -114,7 +100,7 @@ class DataFilterExtension extends LayerExtension {
|
|
|
114
100
|
}
|
|
115
101
|
});
|
|
116
102
|
const filterFBO = aggregator.getFramebuffer(device, useFloatTarget);
|
|
117
|
-
const filterModel = aggregator.getModel(device, extension.getShaders.call(this, extension), useFloatTarget);
|
|
103
|
+
const filterModel = aggregator.getModel(device, attributeManager.getBufferLayouts({ isInstanced: false }), extension.getShaders.call(this, extension), useFloatTarget);
|
|
118
104
|
this.setState({ filterFBO, filterModel });
|
|
119
105
|
}
|
|
120
106
|
}
|
|
@@ -157,32 +143,48 @@ class DataFilterExtension extends LayerExtension {
|
|
|
157
143
|
const filterFBO = this.state.filterFBO;
|
|
158
144
|
const filterModel = this.state.filterModel;
|
|
159
145
|
const filterNeedsUpdate = this.state.filterNeedsUpdate;
|
|
160
|
-
const { onFilteredItemsChange } = this.props;
|
|
161
146
|
if (!this.state.categoryBitMask) {
|
|
162
147
|
extension._updateCategoryBitMask.call(this, params, extension);
|
|
163
148
|
}
|
|
149
|
+
const { onFilteredItemsChange, extensions, filterEnabled, filterRange, filterSoftRange, filterTransformSize, filterTransformColor, filterCategories } = this.props;
|
|
150
|
+
const dataFilterProps = {
|
|
151
|
+
extensions,
|
|
152
|
+
filterEnabled,
|
|
153
|
+
filterRange,
|
|
154
|
+
filterSoftRange,
|
|
155
|
+
filterTransformSize,
|
|
156
|
+
filterTransformColor,
|
|
157
|
+
filterCategories
|
|
158
|
+
};
|
|
159
|
+
if (this.state.categoryBitMask) {
|
|
160
|
+
dataFilterProps.categoryBitMask = this.state.categoryBitMask;
|
|
161
|
+
}
|
|
162
|
+
this.setShaderModuleProps({ dataFilter: dataFilterProps });
|
|
164
163
|
/* eslint-disable-next-line camelcase */
|
|
165
|
-
params.uniforms.filter_categoryBitMask = this.state.categoryBitMask;
|
|
166
164
|
if (filterNeedsUpdate && onFilteredItemsChange && filterModel) {
|
|
167
|
-
const
|
|
165
|
+
const attributeManager = this.getAttributeManager();
|
|
166
|
+
const { attributes: { filterValues, filterCategoryValues, filterVertexIndices } } = attributeManager;
|
|
168
167
|
filterModel.setVertexCount(this.getNumInstances());
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
// @ts-expect-error filterValue and filterIndices should always have buffer value
|
|
172
|
-
filterModel.setAttributes({
|
|
168
|
+
// @ts-expect-error filterValue and filterVertexIndices should always have buffer value
|
|
169
|
+
const attributes = {
|
|
173
170
|
...filterValues?.getValue(),
|
|
174
171
|
...filterCategoryValues?.getValue(),
|
|
175
|
-
...
|
|
172
|
+
...filterVertexIndices?.getValue()
|
|
173
|
+
};
|
|
174
|
+
filterModel.setAttributes(attributes);
|
|
175
|
+
filterModel.shaderInputs.setProps({
|
|
176
|
+
dataFilter: dataFilterProps
|
|
176
177
|
});
|
|
177
|
-
|
|
178
|
-
filterModel.device.
|
|
178
|
+
const viewport = [0, 0, filterFBO.width, filterFBO.height];
|
|
179
|
+
const renderPass = filterModel.device.beginRenderPass({
|
|
180
|
+
id: 'data-filter-aggregation',
|
|
179
181
|
framebuffer: filterFBO,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
viewport: [0, 0, filterFBO.width, filterFBO.height]
|
|
183
|
-
}, () => {
|
|
184
|
-
filterModel.draw(this.context.renderPass);
|
|
182
|
+
parameters: { viewport },
|
|
183
|
+
clearColor: [0, 0, 0, 0]
|
|
185
184
|
});
|
|
185
|
+
filterModel.setParameters(aggregator.parameters);
|
|
186
|
+
filterModel.draw(renderPass);
|
|
187
|
+
renderPass.end();
|
|
186
188
|
const color = filterModel.device.readPixelsToArrayWebGL(filterFBO);
|
|
187
189
|
let count = 0;
|
|
188
190
|
for (let i = 0; i < color.length; i++) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ShaderModule } from '@luma.gl/shadertools';
|
|
2
|
-
import type { DataFilterExtensionProps } from "./data-filter-extension.js";
|
|
2
|
+
import type { DataFilterExtensionOptions, DataFilterExtensionProps } from "./data-filter-extension.js";
|
|
3
3
|
export type Defines = {
|
|
4
4
|
/**
|
|
5
5
|
* Primitive type of parameter used for category filtering. If undefined, category filtering disabled.
|
|
@@ -18,10 +18,17 @@ export type Defines = {
|
|
|
18
18
|
*/
|
|
19
19
|
DATAFILTER_DOUBLE?: boolean;
|
|
20
20
|
};
|
|
21
|
-
type
|
|
21
|
+
export type CategoryBitMask = Uint32Array;
|
|
22
|
+
export type DataFilterModuleProps = {
|
|
22
23
|
extensions: any[];
|
|
24
|
+
categoryBitMask?: CategoryBitMask;
|
|
23
25
|
} & DataFilterExtensionProps;
|
|
24
|
-
|
|
25
|
-
export declare const
|
|
26
|
+
type UniformTypesFunc = (opts: DataFilterExtensionOptions) => any;
|
|
27
|
+
export declare const dataFilter: ShaderModule<DataFilterModuleProps> & {
|
|
28
|
+
uniformTypesFromOptions: UniformTypesFunc;
|
|
29
|
+
};
|
|
30
|
+
export declare const dataFilter64: ShaderModule<DataFilterModuleProps> & {
|
|
31
|
+
uniformTypesFromOptions: UniformTypesFunc;
|
|
32
|
+
};
|
|
26
33
|
export {};
|
|
27
34
|
//# sourceMappingURL=shader-module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-module.d.ts","sourceRoot":"","sources":["../../src/data-filter/shader-module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shader-module.d.ts","sourceRoot":"","sources":["../../src/data-filter/shader-module.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAC,0BAA0B,EAAE,wBAAwB,EAAC,mCAAgC;AAMlG,MAAM,MAAM,OAAO,GAAG;IAEpB;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACvD;;OAEG;IACH,qBAAqB,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAEtC;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAErD;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAqHF,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC;AAC1C,MAAM,MAAM,qBAAqB,GAAG;IAClC,UAAU,EAAE,GAAG,EAAE,CAAC;IAClB,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,GAAG,wBAAwB,CAAC;AA4G7B,KAAK,gBAAgB,GAAG,CAAC,IAAI,EAAE,0BAA0B,KAAK,GAAG,CAAC;AA6BlE,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,qBAAqB,CAAC,GAAG;IAC7D,uBAAuB,EAAE,gBAAgB,CAAC;CAQ3C,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,qBAAqB,CAAC,GAAG;IAC/D,uBAAuB,EAAE,gBAAgB,CAAC;CAQ3C,CAAC"}
|