@deck.gl/extensions 8.7.0-alpha.1 → 8.7.0-alpha.8
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/dist.dev.js +397 -349
- package/dist/es5/brushing/brushing.js +1 -1
- package/dist/es5/brushing/brushing.js.map +1 -1
- package/dist/es5/brushing/shader-module.js.map +1 -1
- package/dist/es5/clip/clip.js +1 -1
- package/dist/es5/clip/clip.js.map +1 -1
- package/dist/es5/data-filter/aggregator.js +1 -1
- package/dist/es5/data-filter/aggregator.js.map +1 -1
- package/dist/es5/data-filter/data-filter.js +8 -4
- package/dist/es5/data-filter/data-filter.js.map +1 -1
- package/dist/es5/data-filter/shader-module.js.map +1 -1
- package/dist/es5/fill-style/fill-style.js +1 -1
- package/dist/es5/fill-style/fill-style.js.map +1 -1
- package/dist/es5/fill-style/shaders.glsl.js.map +1 -1
- package/dist/es5/fp64/fp64.js +1 -1
- package/dist/es5/fp64/fp64.js.map +1 -1
- package/dist/es5/fp64/project64.js.map +1 -1
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/path-style/path-style.js +1 -1
- package/dist/es5/path-style/path-style.js.map +1 -1
- package/dist/esm/clip/clip.js.map +1 -1
- package/dist/esm/data-filter/aggregator.js.map +1 -1
- package/dist/esm/fill-style/fill-style.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist.min.js +1 -1
- package/package.json +2 -2
- package/src/clip/clip.js +1 -1
- package/src/data-filter/aggregator.js +107 -107
- /package/src/{index.js → index.ts} +0 -0
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
import {Model, Texture2D, Framebuffer, isWebGL2} from '@luma.gl/core';
|
|
2
|
-
import GL from '@luma.gl/constants';
|
|
3
|
-
|
|
4
|
-
const AGGREGATE_VS = `\
|
|
5
|
-
#define SHADER_NAME data-filter-vertex-shader
|
|
6
|
-
|
|
7
|
-
#ifdef FLOAT_TARGET
|
|
8
|
-
attribute float filterIndices;
|
|
9
|
-
attribute float filterPrevIndices;
|
|
10
|
-
#else
|
|
11
|
-
attribute vec2 filterIndices;
|
|
12
|
-
attribute vec2 filterPrevIndices;
|
|
13
|
-
#endif
|
|
14
|
-
|
|
15
|
-
varying vec4 vColor;
|
|
16
|
-
const float component = 1.0 / 255.0;
|
|
17
|
-
|
|
18
|
-
void main() {
|
|
19
|
-
#ifdef FLOAT_TARGET
|
|
20
|
-
dataFilter_value *= float(filterIndices != filterPrevIndices);
|
|
21
|
-
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
|
|
22
|
-
vColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
23
|
-
#else
|
|
24
|
-
// Float texture is not supported: pack result into 4 channels x 256 px x 64px
|
|
25
|
-
dataFilter_value *= float(filterIndices.x != filterPrevIndices.x);
|
|
26
|
-
float col = filterIndices.x;
|
|
27
|
-
float row = filterIndices.y * 4.0;
|
|
28
|
-
float channel = floor(row);
|
|
29
|
-
row = fract(row);
|
|
30
|
-
vColor = component * vec4(bvec4(channel == 0.0, channel == 1.0, channel == 2.0, channel == 3.0));
|
|
31
|
-
gl_Position = vec4(col * 2.0 - 1.0, row * 2.0 - 1.0, 0.0, 1.0);
|
|
32
|
-
#endif
|
|
33
|
-
gl_PointSize = 1.0;
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
const AGGREGATE_FS = `\
|
|
38
|
-
#define SHADER_NAME data-filter-fragment-shader
|
|
39
|
-
precision highp float;
|
|
40
|
-
|
|
41
|
-
varying vec4 vColor;
|
|
42
|
-
|
|
43
|
-
void main() {
|
|
44
|
-
if (dataFilter_value < 0.5) {
|
|
45
|
-
discard;
|
|
46
|
-
}
|
|
47
|
-
gl_FragColor = vColor;
|
|
48
|
-
}
|
|
49
|
-
`;
|
|
50
|
-
|
|
51
|
-
export function supportsFloatTarget(gl) {
|
|
52
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices#Support_for_float_textures_doesnt_mean_you_can_render_into_them!
|
|
53
|
-
return (
|
|
54
|
-
gl.getExtension('EXT_float_blend') &&
|
|
55
|
-
// WebGL 2
|
|
56
|
-
(gl.getExtension('EXT_color_buffer_float') ||
|
|
57
|
-
// WebGL 1
|
|
58
|
-
gl.getExtension('WEBGL_color_buffer_float'))
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// A 1x1 framebuffer object that encodes the total count of filtered items
|
|
63
|
-
export function getFramebuffer(gl, useFloatTarget) {
|
|
64
|
-
if (useFloatTarget) {
|
|
65
|
-
return new Framebuffer(gl, {
|
|
66
|
-
width: 1,
|
|
67
|
-
height: 1,
|
|
68
|
-
attachments: {
|
|
69
|
-
[GL.COLOR_ATTACHMENT0]: new Texture2D(gl, {
|
|
70
|
-
format: isWebGL2(gl) ? GL.RGBA32F : GL.RGBA,
|
|
71
|
-
type: GL.FLOAT,
|
|
72
|
-
mipmaps: false
|
|
73
|
-
})
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
return new Framebuffer(gl, {
|
|
78
|
-
width: 256,
|
|
79
|
-
height: 64,
|
|
80
|
-
depth: false
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Increments the counter based on dataFilter_value
|
|
85
|
-
export function getModel(gl, shaderOptions, useFloatTarget) {
|
|
86
|
-
shaderOptions.defines.NON_INSTANCED_MODEL = 1;
|
|
87
|
-
if (useFloatTarget) {
|
|
88
|
-
shaderOptions.defines.FLOAT_TARGET = 1;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return new Model(gl, {
|
|
92
|
-
id: 'data-filter-aggregation-model',
|
|
93
|
-
vertexCount: 1,
|
|
94
|
-
isInstanced: false,
|
|
95
|
-
drawMode: GL.POINTS,
|
|
96
|
-
vs: AGGREGATE_VS,
|
|
97
|
-
fs: AGGREGATE_FS,
|
|
98
|
-
...shaderOptions
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export const parameters = {
|
|
103
|
-
blend: true,
|
|
104
|
-
blendFunc: [GL.ONE, GL.ONE, GL.ONE, GL.ONE],
|
|
105
|
-
blendEquation: [GL.FUNC_ADD, GL.FUNC_ADD],
|
|
106
|
-
depthTest: false
|
|
107
|
-
};
|
|
1
|
+
import {Model, Texture2D, Framebuffer, isWebGL2} from '@luma.gl/core';
|
|
2
|
+
import GL from '@luma.gl/constants';
|
|
3
|
+
|
|
4
|
+
const AGGREGATE_VS = `\
|
|
5
|
+
#define SHADER_NAME data-filter-vertex-shader
|
|
6
|
+
|
|
7
|
+
#ifdef FLOAT_TARGET
|
|
8
|
+
attribute float filterIndices;
|
|
9
|
+
attribute float filterPrevIndices;
|
|
10
|
+
#else
|
|
11
|
+
attribute vec2 filterIndices;
|
|
12
|
+
attribute vec2 filterPrevIndices;
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
varying vec4 vColor;
|
|
16
|
+
const float component = 1.0 / 255.0;
|
|
17
|
+
|
|
18
|
+
void main() {
|
|
19
|
+
#ifdef FLOAT_TARGET
|
|
20
|
+
dataFilter_value *= float(filterIndices != filterPrevIndices);
|
|
21
|
+
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
|
|
22
|
+
vColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
23
|
+
#else
|
|
24
|
+
// Float texture is not supported: pack result into 4 channels x 256 px x 64px
|
|
25
|
+
dataFilter_value *= float(filterIndices.x != filterPrevIndices.x);
|
|
26
|
+
float col = filterIndices.x;
|
|
27
|
+
float row = filterIndices.y * 4.0;
|
|
28
|
+
float channel = floor(row);
|
|
29
|
+
row = fract(row);
|
|
30
|
+
vColor = component * vec4(bvec4(channel == 0.0, channel == 1.0, channel == 2.0, channel == 3.0));
|
|
31
|
+
gl_Position = vec4(col * 2.0 - 1.0, row * 2.0 - 1.0, 0.0, 1.0);
|
|
32
|
+
#endif
|
|
33
|
+
gl_PointSize = 1.0;
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
const AGGREGATE_FS = `\
|
|
38
|
+
#define SHADER_NAME data-filter-fragment-shader
|
|
39
|
+
precision highp float;
|
|
40
|
+
|
|
41
|
+
varying vec4 vColor;
|
|
42
|
+
|
|
43
|
+
void main() {
|
|
44
|
+
if (dataFilter_value < 0.5) {
|
|
45
|
+
discard;
|
|
46
|
+
}
|
|
47
|
+
gl_FragColor = vColor;
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
export function supportsFloatTarget(gl) {
|
|
52
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices#Support_for_float_textures_doesnt_mean_you_can_render_into_them!
|
|
53
|
+
return (
|
|
54
|
+
gl.getExtension('EXT_float_blend') &&
|
|
55
|
+
// WebGL 2
|
|
56
|
+
(gl.getExtension('EXT_color_buffer_float') ||
|
|
57
|
+
// WebGL 1
|
|
58
|
+
gl.getExtension('WEBGL_color_buffer_float'))
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// A 1x1 framebuffer object that encodes the total count of filtered items
|
|
63
|
+
export function getFramebuffer(gl, useFloatTarget) {
|
|
64
|
+
if (useFloatTarget) {
|
|
65
|
+
return new Framebuffer(gl, {
|
|
66
|
+
width: 1,
|
|
67
|
+
height: 1,
|
|
68
|
+
attachments: {
|
|
69
|
+
[GL.COLOR_ATTACHMENT0]: new Texture2D(gl, {
|
|
70
|
+
format: isWebGL2(gl) ? GL.RGBA32F : GL.RGBA,
|
|
71
|
+
type: GL.FLOAT,
|
|
72
|
+
mipmaps: false
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return new Framebuffer(gl, {
|
|
78
|
+
width: 256,
|
|
79
|
+
height: 64,
|
|
80
|
+
depth: false
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Increments the counter based on dataFilter_value
|
|
85
|
+
export function getModel(gl, shaderOptions, useFloatTarget) {
|
|
86
|
+
shaderOptions.defines.NON_INSTANCED_MODEL = 1;
|
|
87
|
+
if (useFloatTarget) {
|
|
88
|
+
shaderOptions.defines.FLOAT_TARGET = 1;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return new Model(gl, {
|
|
92
|
+
id: 'data-filter-aggregation-model',
|
|
93
|
+
vertexCount: 1,
|
|
94
|
+
isInstanced: false,
|
|
95
|
+
drawMode: GL.POINTS,
|
|
96
|
+
vs: AGGREGATE_VS,
|
|
97
|
+
fs: AGGREGATE_FS,
|
|
98
|
+
...shaderOptions
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export const parameters = {
|
|
103
|
+
blend: true,
|
|
104
|
+
blendFunc: [GL.ONE, GL.ONE, GL.ONE, GL.ONE],
|
|
105
|
+
blendEquation: [GL.FUNC_ADD, GL.FUNC_ADD],
|
|
106
|
+
depthTest: false
|
|
107
|
+
};
|
|
File without changes
|