@deck.gl/extensions 8.7.0-alpha.3 → 8.7.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.
Files changed (42) hide show
  1. package/dist/dist.dev.js +446 -258
  2. package/dist/es5/brushing/brushing.js +80 -49
  3. package/dist/es5/brushing/brushing.js.map +1 -1
  4. package/dist/es5/brushing/shader-module.js +16 -15
  5. package/dist/es5/brushing/shader-module.js.map +1 -1
  6. package/dist/es5/clip/clip.js +62 -35
  7. package/dist/es5/clip/clip.js.map +1 -1
  8. package/dist/es5/data-filter/aggregator.js +19 -14
  9. package/dist/es5/data-filter/aggregator.js.map +1 -1
  10. package/dist/es5/data-filter/data-filter.js +176 -148
  11. package/dist/es5/data-filter/data-filter.js.map +1 -1
  12. package/dist/es5/data-filter/shader-module.js +58 -37
  13. package/dist/es5/data-filter/shader-module.js.map +1 -1
  14. package/dist/es5/fill-style/fill-style.js +244 -158
  15. package/dist/es5/fill-style/fill-style.js.map +1 -1
  16. package/dist/es5/fill-style/shaders.glsl.js +18 -19
  17. package/dist/es5/fill-style/shaders.glsl.js.map +1 -1
  18. package/dist/es5/fp64/fp64.js +36 -12
  19. package/dist/es5/fp64/fp64.js.map +1 -1
  20. package/dist/es5/fp64/project64.js +18 -20
  21. package/dist/es5/fp64/project64.js.map +1 -1
  22. package/dist/es5/index.js +15 -7
  23. package/dist/es5/index.js.map +1 -1
  24. package/dist/es5/mask/mask.js +77 -0
  25. package/dist/es5/mask/mask.js.map +1 -0
  26. package/dist/es5/mask/shader-module.js +41 -0
  27. package/dist/es5/mask/shader-module.js.map +1 -0
  28. package/dist/es5/path-style/path-style.js +121 -89
  29. package/dist/es5/path-style/path-style.js.map +1 -1
  30. package/dist/es5/path-style/shaders.glsl.js +2 -2
  31. package/dist/es5/path-style/shaders.glsl.js.map +1 -1
  32. package/dist/esm/index.js +1 -0
  33. package/dist/esm/index.js.map +1 -1
  34. package/dist/esm/mask/mask.js +39 -0
  35. package/dist/esm/mask/mask.js.map +1 -0
  36. package/dist/esm/mask/shader-module.js +30 -0
  37. package/dist/esm/mask/shader-module.js.map +1 -0
  38. package/dist.min.js +1 -1
  39. package/package.json +2 -2
  40. package/src/{index.js → index.ts} +1 -0
  41. package/src/mask/mask.js +35 -0
  42. package/src/mask/shader-module.js +68 -0
@@ -0,0 +1,68 @@
1
+ import {project} from '@deck.gl/core';
2
+
3
+ const vs = `
4
+ uniform vec4 mask_bounds;
5
+ uniform bool mask_maskByInstance;
6
+ vec2 mask_getCoords(vec4 position) {
7
+ return (position.xy - mask_bounds.xy) / (mask_bounds.zw - mask_bounds.xy);
8
+ }
9
+ `;
10
+
11
+ const fs = `
12
+ uniform sampler2D mask_texture;
13
+ uniform bool mask_enabled;
14
+ bool mask_isInBounds(vec2 texCoords) {
15
+ if (!mask_enabled) {
16
+ return true;
17
+ }
18
+ vec4 maskColor = texture2D(mask_texture, texCoords);
19
+ return maskColor.a > 0.5;
20
+ }
21
+ `;
22
+
23
+ const inject = {
24
+ 'vs:#decl': `
25
+ varying vec2 mask_texCoords;
26
+ `,
27
+ 'vs:#main-end': `
28
+ vec4 mask_common_position;
29
+ if (mask_maskByInstance) {
30
+ mask_common_position = project_position(vec4(geometry.worldPosition, 1.0));
31
+ } else {
32
+ mask_common_position = geometry.position;
33
+ }
34
+ mask_texCoords = mask_getCoords(mask_common_position);
35
+ `,
36
+ 'fs:#decl': `
37
+ varying vec2 mask_texCoords;
38
+ `,
39
+ 'fs:#main-start': `
40
+ if (mask_enabled) {
41
+ bool mask = mask_isInBounds(mask_texCoords);
42
+
43
+ // Debug: show extent of render target
44
+ // gl_FragColor = vec4(mask_texCoords, 0.0, 1.0);
45
+ gl_FragColor = texture2D(mask_texture, mask_texCoords);
46
+
47
+ if (!mask) discard;
48
+ }
49
+ `
50
+ };
51
+
52
+ const getMaskUniforms = (opts = {}, context = {}) => {
53
+ const uniforms = {};
54
+ if (opts.maskMap) {
55
+ uniforms.mask_enabled = opts.maskEnabled !== false;
56
+ uniforms.mask_texture = opts.maskMap;
57
+ }
58
+ return uniforms;
59
+ };
60
+
61
+ export default {
62
+ name: 'mask',
63
+ dependencies: [project],
64
+ vs,
65
+ fs,
66
+ inject,
67
+ getUniforms: getMaskUniforms
68
+ };