@deck.gl/extensions 9.0.0-beta.1 → 9.0.0-beta.10

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 (265) hide show
  1. package/dist/brushing/brushing-extension.js +80 -0
  2. package/{typed → dist}/brushing/shader-module.d.ts +1 -1
  3. package/{typed → dist}/brushing/shader-module.d.ts.map +1 -1
  4. package/dist/brushing/shader-module.js +92 -0
  5. package/{typed → dist}/clip/clip-extension.d.ts.map +1 -1
  6. package/dist/clip/clip-extension.js +117 -0
  7. package/{typed → dist}/collision-filter/collision-filter-effect.d.ts.map +1 -1
  8. package/dist/collision-filter/collision-filter-effect.js +193 -0
  9. package/dist/collision-filter/collision-filter-extension.js +49 -0
  10. package/{typed → dist}/collision-filter/collision-filter-pass.d.ts.map +1 -1
  11. package/dist/collision-filter/collision-filter-pass.js +25 -0
  12. package/{typed → dist}/collision-filter/shader-module.d.ts.map +1 -1
  13. package/dist/collision-filter/shader-module.js +87 -0
  14. package/dist/data-filter/aggregator.d.ts.map +1 -0
  15. package/dist/{esm/data-filter → data-filter}/aggregator.js +40 -41
  16. package/{typed → dist}/data-filter/data-filter-extension.d.ts +38 -6
  17. package/dist/data-filter/data-filter-extension.d.ts.map +1 -0
  18. package/dist/data-filter/data-filter-extension.js +249 -0
  19. package/{typed → dist}/data-filter/shader-module.d.ts +1 -1
  20. package/dist/data-filter/shader-module.d.ts.map +1 -0
  21. package/dist/data-filter/shader-module.js +179 -0
  22. package/dist/dist.dev.js +2203 -10630
  23. package/{typed → dist}/fill-style/fill-style-extension.d.ts +2 -30
  24. package/dist/fill-style/fill-style-extension.d.ts.map +1 -0
  25. package/dist/fill-style/fill-style-extension.js +116 -0
  26. package/{typed/fill-style/shaders.glsl.d.ts → dist/fill-style/shader-module.d.ts} +1 -1
  27. package/dist/fill-style/shader-module.d.ts.map +1 -0
  28. package/dist/fill-style/shader-module.js +96 -0
  29. package/dist/fp64/fp64-extension.js +35 -0
  30. package/dist/fp64/project64.glsl.js +81 -0
  31. package/dist/fp64/project64.js +50 -0
  32. package/dist/index.cjs +2756 -0
  33. package/dist/index.cjs.map +7 -0
  34. package/dist/index.d.ts +19 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +11 -0
  37. package/{typed → dist}/mask/mask-effect.d.ts +1 -1
  38. package/dist/mask/mask-effect.d.ts.map +1 -0
  39. package/dist/mask/mask-effect.js +194 -0
  40. package/dist/mask/mask-extension.js +57 -0
  41. package/{typed → dist}/mask/mask-pass.d.ts.map +1 -1
  42. package/dist/mask/mask-pass.js +44 -0
  43. package/{typed → dist}/mask/shader-module.d.ts.map +1 -1
  44. package/dist/mask/shader-module.js +77 -0
  45. package/dist/path-style/path-style-extension.js +111 -0
  46. package/dist/path-style/shaders.glsl.js +86 -0
  47. package/{typed → dist}/terrain/height-map-builder.d.ts +1 -1
  48. package/dist/terrain/height-map-builder.d.ts.map +1 -0
  49. package/dist/terrain/height-map-builder.js +104 -0
  50. package/{typed → dist}/terrain/shader-module.d.ts +2 -2
  51. package/dist/terrain/shader-module.d.ts.map +1 -0
  52. package/dist/terrain/shader-module.js +137 -0
  53. package/{typed → dist}/terrain/terrain-cover.d.ts +1 -1
  54. package/dist/terrain/terrain-cover.d.ts.map +1 -0
  55. package/dist/terrain/terrain-cover.js +187 -0
  56. package/{typed → dist}/terrain/terrain-effect.d.ts +2 -2
  57. package/dist/terrain/terrain-effect.d.ts.map +1 -0
  58. package/dist/terrain/terrain-effect.js +184 -0
  59. package/dist/terrain/terrain-extension.js +44 -0
  60. package/{typed → dist}/terrain/terrain-pass.d.ts +2 -2
  61. package/dist/terrain/terrain-pass.d.ts.map +1 -0
  62. package/dist/terrain/terrain-pass.js +61 -0
  63. package/{typed → dist}/terrain/terrain-picking-pass.d.ts +1 -1
  64. package/dist/terrain/terrain-picking-pass.d.ts.map +1 -0
  65. package/dist/terrain/terrain-picking-pass.js +66 -0
  66. package/dist/terrain/utils.js +21 -0
  67. package/{typed → dist}/utils/debug.d.ts.map +1 -1
  68. package/dist/utils/debug.js +50 -0
  69. package/dist/utils/projection-utils.js +153 -0
  70. package/dist/utils/syntax-tags.d.ts +6 -0
  71. package/dist/utils/syntax-tags.d.ts.map +1 -0
  72. package/dist/utils/syntax-tags.js +5 -0
  73. package/dist.min.js +898 -1257
  74. package/package.json +19 -16
  75. package/src/brushing/shader-module.ts +4 -3
  76. package/src/clip/clip-extension.ts +10 -9
  77. package/src/collision-filter/collision-filter-effect.ts +12 -8
  78. package/src/collision-filter/collision-filter-pass.ts +1 -3
  79. package/src/collision-filter/shader-module.ts +6 -4
  80. package/src/data-filter/aggregator.ts +8 -13
  81. package/src/data-filter/data-filter-extension.ts +147 -30
  82. package/src/data-filter/shader-module.ts +38 -9
  83. package/src/fill-style/fill-style-extension.ts +4 -5
  84. package/src/fill-style/{shaders.glsl.ts → shader-module.ts} +6 -5
  85. package/src/mask/mask-effect.ts +0 -1
  86. package/src/mask/mask-pass.ts +1 -3
  87. package/src/mask/shader-module.ts +7 -6
  88. package/src/terrain/shader-module.ts +14 -13
  89. package/src/terrain/terrain-effect.ts +12 -5
  90. package/src/terrain/terrain-pass.ts +2 -5
  91. package/src/terrain/terrain-picking-pass.ts +1 -3
  92. package/src/terrain/utils.ts +1 -1
  93. package/src/utils/debug.ts +1 -2
  94. package/src/utils/syntax-tags.ts +5 -0
  95. package/dist/es5/brushing/brushing-extension.js +0 -108
  96. package/dist/es5/brushing/brushing-extension.js.map +0 -1
  97. package/dist/es5/brushing/shader-module.js +0 -50
  98. package/dist/es5/brushing/shader-module.js.map +0 -1
  99. package/dist/es5/clip/clip-extension.js +0 -98
  100. package/dist/es5/clip/clip-extension.js.map +0 -1
  101. package/dist/es5/collision-filter/collision-filter-effect.js +0 -294
  102. package/dist/es5/collision-filter/collision-filter-effect.js.map +0 -1
  103. package/dist/es5/collision-filter/collision-filter-extension.js +0 -109
  104. package/dist/es5/collision-filter/collision-filter-extension.js.map +0 -1
  105. package/dist/es5/collision-filter/collision-filter-pass.js +0 -79
  106. package/dist/es5/collision-filter/collision-filter-pass.js.map +0 -1
  107. package/dist/es5/collision-filter/shader-module.js +0 -39
  108. package/dist/es5/collision-filter/shader-module.js.map +0 -1
  109. package/dist/es5/data-filter/aggregator.js +0 -79
  110. package/dist/es5/data-filter/aggregator.js.map +0 -1
  111. package/dist/es5/data-filter/data-filter-extension.js +0 -236
  112. package/dist/es5/data-filter/data-filter-extension.js.map +0 -1
  113. package/dist/es5/data-filter/shader-module.js +0 -122
  114. package/dist/es5/data-filter/shader-module.js.map +0 -1
  115. package/dist/es5/fill-style/fill-style-extension.js +0 -190
  116. package/dist/es5/fill-style/fill-style-extension.js.map +0 -1
  117. package/dist/es5/fill-style/shaders.glsl.js +0 -59
  118. package/dist/es5/fill-style/shaders.glsl.js.map +0 -1
  119. package/dist/es5/fp64/fp64-extension.js +0 -55
  120. package/dist/es5/fp64/fp64-extension.js.map +0 -1
  121. package/dist/es5/fp64/project64.glsl.js +0 -9
  122. package/dist/es5/fp64/project64.glsl.js.map +0 -1
  123. package/dist/es5/fp64/project64.js +0 -52
  124. package/dist/es5/fp64/project64.js.map +0 -1
  125. package/dist/es5/index.js +0 -88
  126. package/dist/es5/index.js.map +0 -1
  127. package/dist/es5/mask/mask-effect.js +0 -279
  128. package/dist/es5/mask/mask-effect.js.map +0 -1
  129. package/dist/es5/mask/mask-extension.js +0 -113
  130. package/dist/es5/mask/mask-extension.js.map +0 -1
  131. package/dist/es5/mask/mask-pass.js +0 -106
  132. package/dist/es5/mask/mask-pass.js.map +0 -1
  133. package/dist/es5/mask/shader-module.js +0 -38
  134. package/dist/es5/mask/shader-module.js.map +0 -1
  135. package/dist/es5/path-style/path-style-extension.js +0 -169
  136. package/dist/es5/path-style/path-style-extension.js.map +0 -1
  137. package/dist/es5/path-style/shaders.glsl.js +0 -25
  138. package/dist/es5/path-style/shaders.glsl.js.map +0 -1
  139. package/dist/es5/terrain/height-map-builder.js +0 -111
  140. package/dist/es5/terrain/height-map-builder.js.map +0 -1
  141. package/dist/es5/terrain/shader-module.js +0 -86
  142. package/dist/es5/terrain/shader-module.js.map +0 -1
  143. package/dist/es5/terrain/terrain-cover.js +0 -256
  144. package/dist/es5/terrain/terrain-cover.js.map +0 -1
  145. package/dist/es5/terrain/terrain-effect.js +0 -326
  146. package/dist/es5/terrain/terrain-effect.js.map +0 -1
  147. package/dist/es5/terrain/terrain-extension.js +0 -94
  148. package/dist/es5/terrain/terrain-extension.js.map +0 -1
  149. package/dist/es5/terrain/terrain-pass.js +0 -121
  150. package/dist/es5/terrain/terrain-pass.js.map +0 -1
  151. package/dist/es5/terrain/terrain-picking-pass.js +0 -124
  152. package/dist/es5/terrain/terrain-picking-pass.js.map +0 -1
  153. package/dist/es5/terrain/utils.js +0 -35
  154. package/dist/es5/terrain/utils.js.map +0 -1
  155. package/dist/es5/utils/debug.js +0 -71
  156. package/dist/es5/utils/debug.js.map +0 -1
  157. package/dist/es5/utils/projection-utils.js +0 -168
  158. package/dist/es5/utils/projection-utils.js.map +0 -1
  159. package/dist/esm/brushing/brushing-extension.js +0 -68
  160. package/dist/esm/brushing/brushing-extension.js.map +0 -1
  161. package/dist/esm/brushing/shader-module.js +0 -103
  162. package/dist/esm/brushing/shader-module.js.map +0 -1
  163. package/dist/esm/clip/clip-extension.js +0 -86
  164. package/dist/esm/clip/clip-extension.js.map +0 -1
  165. package/dist/esm/collision-filter/collision-filter-effect.js +0 -246
  166. package/dist/esm/collision-filter/collision-filter-effect.js.map +0 -1
  167. package/dist/esm/collision-filter/collision-filter-extension.js +0 -75
  168. package/dist/esm/collision-filter/collision-filter-extension.js.map +0 -1
  169. package/dist/esm/collision-filter/collision-filter-pass.js +0 -32
  170. package/dist/esm/collision-filter/collision-filter-pass.js.map +0 -1
  171. package/dist/esm/collision-filter/shader-module.js +0 -104
  172. package/dist/esm/collision-filter/shader-module.js.map +0 -1
  173. package/dist/esm/data-filter/aggregator.js.map +0 -1
  174. package/dist/esm/data-filter/data-filter-extension.js +0 -189
  175. package/dist/esm/data-filter/data-filter-extension.js.map +0 -1
  176. package/dist/esm/data-filter/shader-module.js +0 -164
  177. package/dist/esm/data-filter/shader-module.js.map +0 -1
  178. package/dist/esm/fill-style/fill-style-extension.js +0 -156
  179. package/dist/esm/fill-style/fill-style-extension.js.map +0 -1
  180. package/dist/esm/fill-style/shaders.glsl.js +0 -108
  181. package/dist/esm/fill-style/shaders.glsl.js.map +0 -1
  182. package/dist/esm/fp64/fp64-extension.js +0 -20
  183. package/dist/esm/fp64/fp64-extension.js.map +0 -1
  184. package/dist/esm/fp64/project64.glsl.js +0 -82
  185. package/dist/esm/fp64/project64.glsl.js.map +0 -1
  186. package/dist/esm/fp64/project64.js +0 -43
  187. package/dist/esm/fp64/project64.js.map +0 -1
  188. package/dist/esm/index.js +0 -11
  189. package/dist/esm/index.js.map +0 -1
  190. package/dist/esm/mask/mask-effect.js +0 -228
  191. package/dist/esm/mask/mask-effect.js.map +0 -1
  192. package/dist/esm/mask/mask-extension.js +0 -83
  193. package/dist/esm/mask/mask-extension.js.map +0 -1
  194. package/dist/esm/mask/mask-pass.js +0 -58
  195. package/dist/esm/mask/mask-pass.js.map +0 -1
  196. package/dist/esm/mask/shader-module.js +0 -84
  197. package/dist/esm/mask/shader-module.js.map +0 -1
  198. package/dist/esm/path-style/path-style-extension.js +0 -130
  199. package/dist/esm/path-style/path-style-extension.js.map +0 -1
  200. package/dist/esm/path-style/shaders.glsl.js +0 -84
  201. package/dist/esm/path-style/shaders.glsl.js.map +0 -1
  202. package/dist/esm/terrain/height-map-builder.js +0 -86
  203. package/dist/esm/terrain/height-map-builder.js.map +0 -1
  204. package/dist/esm/terrain/shader-module.js +0 -127
  205. package/dist/esm/terrain/shader-module.js.map +0 -1
  206. package/dist/esm/terrain/terrain-cover.js +0 -212
  207. package/dist/esm/terrain/terrain-cover.js.map +0 -1
  208. package/dist/esm/terrain/terrain-effect.js +0 -219
  209. package/dist/esm/terrain/terrain-effect.js.map +0 -1
  210. package/dist/esm/terrain/terrain-extension.js +0 -59
  211. package/dist/esm/terrain/terrain-extension.js.map +0 -1
  212. package/dist/esm/terrain/terrain-pass.js +0 -71
  213. package/dist/esm/terrain/terrain-pass.js.map +0 -1
  214. package/dist/esm/terrain/terrain-picking-pass.js +0 -73
  215. package/dist/esm/terrain/terrain-picking-pass.js.map +0 -1
  216. package/dist/esm/terrain/utils.js +0 -19
  217. package/dist/esm/terrain/utils.js.map +0 -1
  218. package/dist/esm/utils/debug.js +0 -61
  219. package/dist/esm/utils/debug.js.map +0 -1
  220. package/dist/esm/utils/projection-utils.js +0 -134
  221. package/dist/esm/utils/projection-utils.js.map +0 -1
  222. package/typed/data-filter/aggregator.d.ts.map +0 -1
  223. package/typed/data-filter/data-filter-extension.d.ts.map +0 -1
  224. package/typed/data-filter/shader-module.d.ts.map +0 -1
  225. package/typed/fill-style/fill-style-extension.d.ts.map +0 -1
  226. package/typed/fill-style/shaders.glsl.d.ts.map +0 -1
  227. package/typed/index.d.ts +0 -19
  228. package/typed/index.d.ts.map +0 -1
  229. package/typed/mask/mask-effect.d.ts.map +0 -1
  230. package/typed/terrain/height-map-builder.d.ts.map +0 -1
  231. package/typed/terrain/shader-module.d.ts.map +0 -1
  232. package/typed/terrain/terrain-cover.d.ts.map +0 -1
  233. package/typed/terrain/terrain-effect.d.ts.map +0 -1
  234. package/typed/terrain/terrain-pass.d.ts.map +0 -1
  235. package/typed/terrain/terrain-picking-pass.d.ts.map +0 -1
  236. /package/{typed → dist}/brushing/brushing-extension.d.ts +0 -0
  237. /package/{typed → dist}/brushing/brushing-extension.d.ts.map +0 -0
  238. /package/{typed → dist}/clip/clip-extension.d.ts +0 -0
  239. /package/{typed → dist}/collision-filter/collision-filter-effect.d.ts +0 -0
  240. /package/{typed → dist}/collision-filter/collision-filter-extension.d.ts +0 -0
  241. /package/{typed → dist}/collision-filter/collision-filter-extension.d.ts.map +0 -0
  242. /package/{typed → dist}/collision-filter/collision-filter-pass.d.ts +0 -0
  243. /package/{typed → dist}/collision-filter/shader-module.d.ts +0 -0
  244. /package/{typed → dist}/data-filter/aggregator.d.ts +0 -0
  245. /package/{typed → dist}/fp64/fp64-extension.d.ts +0 -0
  246. /package/{typed → dist}/fp64/fp64-extension.d.ts.map +0 -0
  247. /package/{typed → dist}/fp64/project64.d.ts +0 -0
  248. /package/{typed → dist}/fp64/project64.d.ts.map +0 -0
  249. /package/{typed → dist}/fp64/project64.glsl.d.ts +0 -0
  250. /package/{typed → dist}/fp64/project64.glsl.d.ts.map +0 -0
  251. /package/{typed → dist}/mask/mask-extension.d.ts +0 -0
  252. /package/{typed → dist}/mask/mask-extension.d.ts.map +0 -0
  253. /package/{typed → dist}/mask/mask-pass.d.ts +0 -0
  254. /package/{typed → dist}/mask/shader-module.d.ts +0 -0
  255. /package/{typed → dist}/path-style/path-style-extension.d.ts +0 -0
  256. /package/{typed → dist}/path-style/path-style-extension.d.ts.map +0 -0
  257. /package/{typed → dist}/path-style/shaders.glsl.d.ts +0 -0
  258. /package/{typed → dist}/path-style/shaders.glsl.d.ts.map +0 -0
  259. /package/{typed → dist}/terrain/terrain-extension.d.ts +0 -0
  260. /package/{typed → dist}/terrain/terrain-extension.d.ts.map +0 -0
  261. /package/{typed → dist}/terrain/utils.d.ts +0 -0
  262. /package/{typed → dist}/terrain/utils.d.ts.map +0 -0
  263. /package/{typed → dist}/utils/debug.d.ts +0 -0
  264. /package/{typed → dist}/utils/projection-utils.d.ts +0 -0
  265. /package/{typed → dist}/utils/projection-utils.d.ts.map +0 -0
@@ -0,0 +1,87 @@
1
+ import { project } from '@deck.gl/core';
2
+ import { glsl } from "../utils/syntax-tags.js";
3
+ const vs = `
4
+ #ifdef NON_INSTANCED_MODEL
5
+ in float collisionPriorities;
6
+ #else
7
+ in float instanceCollisionPriorities;
8
+ #endif
9
+ uniform sampler2D collision_texture;
10
+ uniform bool collision_sort;
11
+ uniform bool collision_enabled;
12
+ vec2 collision_getCoords(vec4 position) {
13
+ vec4 collision_clipspace = project_common_position_to_clipspace(position);
14
+ return (1.0 + collision_clipspace.xy / collision_clipspace.w) / 2.0;
15
+ }
16
+ float collision_match(vec2 tex, vec3 pickingColor) {
17
+ vec4 collision_pickingColor = texture(collision_texture, tex);
18
+ float delta = dot(abs(collision_pickingColor.rgb - pickingColor), vec3(1.0));
19
+ float e = 0.001;
20
+ return step(delta, e);
21
+ }
22
+ float collision_isVisible(vec2 texCoords, vec3 pickingColor) {
23
+ if (!collision_enabled) {
24
+ return 1.0;
25
+ }
26
+ const int N = 2;
27
+ float accumulator = 0.0;
28
+ vec2 step = vec2(1.0 / project_uViewportSize);
29
+ const float floatN = float(N);
30
+ vec2 delta = -floatN * step;
31
+ for(int i = -N; i <= N; i++) {
32
+ delta.x = -step.x * floatN;
33
+ for(int j = -N; j <= N; j++) {
34
+ accumulator += collision_match(texCoords + delta, pickingColor);
35
+ delta.x += step.x;
36
+ }
37
+ delta.y += step.y;
38
+ }
39
+ float W = 2.0 * floatN + 1.0;
40
+ return pow(accumulator / (W * W), 2.2);
41
+ }
42
+ `;
43
+ const inject = {
44
+ 'vs:#decl': `
45
+ float collision_fade = 1.0;
46
+ `,
47
+ 'vs:DECKGL_FILTER_GL_POSITION': `
48
+ if (collision_sort) {
49
+ #ifdef NON_INSTANCED_MODEL
50
+ float collisionPriority = collisionPriorities;
51
+ #else
52
+ float collisionPriority = instanceCollisionPriorities;
53
+ #endif
54
+ position.z = -0.001 * collisionPriority * position.w;
55
+ }
56
+ if (collision_enabled) {
57
+ vec4 collision_common_position = project_position(vec4(geometry.worldPosition, 1.0));
58
+ vec2 collision_texCoords = collision_getCoords(collision_common_position);
59
+ collision_fade = collision_isVisible(collision_texCoords, geometry.pickingColor / 255.0);
60
+ if (collision_fade < 0.0001) {
61
+ position = vec4(0.0, 0.0, 2.0, 1.0);
62
+ }
63
+ }
64
+ `,
65
+ 'vs:DECKGL_FILTER_COLOR': `
66
+ color.a *= collision_fade;
67
+ `
68
+ };
69
+ const getCollisionUniforms = (opts, uniforms) => {
70
+ if (!opts || !('dummyCollisionMap' in opts)) {
71
+ return {};
72
+ }
73
+ const { collisionFBO, drawToCollisionMap, dummyCollisionMap } = opts;
74
+ return {
75
+ collision_sort: Boolean(drawToCollisionMap),
76
+ // @ts-ignore (v9 not sure why this isn't allowed now)
77
+ collision_texture: !drawToCollisionMap && collisionFBO ? collisionFBO.colorAttachments[0] : dummyCollisionMap
78
+ };
79
+ };
80
+ // @ts-expect-error
81
+ export default {
82
+ name: 'collision',
83
+ dependencies: [project],
84
+ vs,
85
+ inject,
86
+ getUniforms: getCollisionUniforms
87
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregator.d.ts","sourceRoot":"","sources":["../../src/data-filter/aggregator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAiB,WAAW,EAAC,MAAM,eAAe,CAAC;AACjE,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AA0DtC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE3D;AAGD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,GAAG,WAAW,CAmBnF;AAGD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,EAAE,OAAO,GAAG,KAAK,CAe3F;AAED,eAAO,MAAM,UAAU;;;;;CAKb,CAAC"}
@@ -49,54 +49,53 @@ void main() {
49
49
  fragColor = vColor;
50
50
  }
51
51
  `;
52
+ const FLOAT_TARGET_FEATURES = [
53
+ 'float32-renderable-webgl', // ability to render to float texture
54
+ 'texture-blend-float-webgl' // ability to blend when rendering to float texture
55
+ ];
52
56
  export function supportsFloatTarget(device) {
53
- const gl = device.gl;
54
- return Boolean(gl.getExtension('EXT_float_blend') && (gl.getExtension('EXT_color_buffer_float') || gl.getExtension('WEBGL_color_buffer_float')));
57
+ return FLOAT_TARGET_FEATURES.every(feature => device.features.has(feature));
55
58
  }
59
+ // A 1x1 framebuffer object that encodes the total count of filtered items
56
60
  export function getFramebuffer(device, useFloatTarget) {
57
- if (useFloatTarget) {
61
+ if (useFloatTarget) {
62
+ return device.createFramebuffer({
63
+ width: 1,
64
+ height: 1,
65
+ colorAttachments: [
66
+ device.createTexture({
67
+ format: 'rgba32float',
68
+ type: 5126,
69
+ mipmaps: false
70
+ })
71
+ ]
72
+ });
73
+ }
58
74
  return device.createFramebuffer({
59
- width: 1,
60
- height: 1,
61
- colorAttachments: [device.createTexture({
62
- format: device.info.type === 'webgl2' ? 'rgba32float' : 'rgba8unorm',
63
- type: 5126,
64
- mipmaps: false
65
- })]
75
+ width: 256,
76
+ height: 64,
77
+ colorAttachments: [device.createTexture({ format: 'rgba8unorm', type: 5126, mipmaps: false })]
66
78
  });
67
- }
68
-
69
- return device.createFramebuffer({
70
- width: 256,
71
- height: 64,
72
- colorAttachments: [device.createTexture({
73
- format: 'rgba8unorm',
74
- type: 5126,
75
- mipmaps: false
76
- })]
77
- });
78
79
  }
80
+ // Increments the counter based on dataFilter_value
79
81
  export function getModel(device, shaderOptions, useFloatTarget) {
80
- shaderOptions.defines.NON_INSTANCED_MODEL = 1;
81
-
82
- if (useFloatTarget) {
83
- shaderOptions.defines.FLOAT_TARGET = 1;
84
- }
85
-
86
- return new Model(device, {
87
- id: 'data-filter-aggregation-model',
88
- vertexCount: 1,
89
- isInstanced: false,
90
- drawMode: 0,
91
- vs: AGGREGATE_VS,
92
- fs: AGGREGATE_FS,
93
- ...shaderOptions
94
- });
82
+ shaderOptions.defines.NON_INSTANCED_MODEL = 1;
83
+ if (useFloatTarget) {
84
+ shaderOptions.defines.FLOAT_TARGET = 1;
85
+ }
86
+ return new Model(device, {
87
+ id: 'data-filter-aggregation-model',
88
+ vertexCount: 1,
89
+ isInstanced: false,
90
+ drawMode: 0,
91
+ vs: AGGREGATE_VS,
92
+ fs: AGGREGATE_FS,
93
+ ...shaderOptions
94
+ });
95
95
  }
96
96
  export const parameters = {
97
- blend: true,
98
- blendFunc: [1, 1, 1, 1],
99
- blendEquation: [32774, 32774],
100
- depthTest: false
97
+ blend: true,
98
+ blendFunc: [1, 1, 1, 1],
99
+ blendEquation: [32774, 32774],
100
+ depthTest: false
101
101
  };
102
- //# sourceMappingURL=aggregator.js.map
@@ -1,11 +1,17 @@
1
1
  import type { Layer, LayerContext, Accessor, UpdateParameters } from '@deck.gl/core';
2
2
  import { LayerExtension } from '@deck.gl/core';
3
+ type FilterCategory = number | string;
3
4
  export type DataFilterExtensionProps<DataT = any> = {
4
5
  /**
5
6
  * Accessor to retrieve the value for each object that it will be filtered by.
6
7
  * Returns either a number (if `filterSize: 1`) or an array of numbers.
7
8
  */
8
9
  getFilterValue?: Accessor<DataT, number | number[]>;
10
+ /**
11
+ * Accessor to retrieve the category (`number | string`) for each object that it will be filtered by.
12
+ * Returns either a single category (if `filterSize: 1`) or an array of categories.
13
+ */
14
+ getFilterCategory?: Accessor<DataT, FilterCategory | FilterCategory[]>;
9
15
  /**
10
16
  * Enable/disable the data filter. If the data filter is disabled, all objects are rendered.
11
17
  * @default true
@@ -33,6 +39,11 @@ export type DataFilterExtensionProps<DataT = any> = {
33
39
  * @default true
34
40
  */
35
41
  filterTransformColor?: boolean;
42
+ /**
43
+ * The categories which define whether an object should be rendered.
44
+ * @default []
45
+ */
46
+ filterCategories: FilterCategory[] | FilterCategory[][];
36
47
  /**
37
48
  * Only called if the `countItems` option is enabled.
38
49
  */
@@ -44,29 +55,38 @@ export type DataFilterExtensionProps<DataT = any> = {
44
55
  }) => void;
45
56
  };
46
57
  type DataFilterExtensionOptions = {
58
+ /**
59
+ * 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.
60
+ * @default 1
61
+ */
62
+ categorySize?: 1 | 2 | 3 | 4;
47
63
  /**
48
64
  * The size of the filter (number of columns to filter by). The data filter can show/hide data based on 1-4 numeric properties of each object.
49
65
  * @default 1
50
66
  */
51
- filterSize: number;
67
+ filterSize?: 1 | 2 | 3 | 4;
52
68
  /**
53
69
  * Use 64-bit precision instead of 32-bit.
54
70
  * @default false
55
71
  */
56
- fp64: boolean;
72
+ fp64?: boolean;
57
73
  /**
58
74
  * If `true`, reports the number of filtered objects with the `onFilteredItemsChange` callback.
59
75
  * @default `false`.
60
76
  */
61
- countItems: boolean;
77
+ countItems?: boolean;
62
78
  };
63
79
  /** Adds GPU-based data filtering functionalities to layers. It allows the layer to show/hide objects based on user-defined properties. */
64
- export default class DataFilterExtension extends LayerExtension<DataFilterExtensionOptions> {
80
+ export default class DataFilterExtension extends LayerExtension<Required<DataFilterExtensionOptions>> {
65
81
  static defaultProps: {
66
82
  getFilterValue: {
67
83
  type: string;
68
84
  value: number;
69
85
  };
86
+ getFilterCategory: {
87
+ type: string;
88
+ value: number;
89
+ };
70
90
  onFilteredItemsChange: {
71
91
  type: string;
72
92
  value: null;
@@ -75,16 +95,28 @@ export default class DataFilterExtension extends LayerExtension<DataFilterExtens
75
95
  filterEnabled: boolean;
76
96
  filterRange: number[];
77
97
  filterSoftRange: null;
98
+ filterCategories: number[];
78
99
  filterTransformSize: boolean;
79
100
  filterTransformColor: boolean;
80
101
  };
81
102
  static extensionName: string;
82
- constructor({ filterSize, fp64, countItems }?: Partial<DataFilterExtensionOptions>);
103
+ constructor(opts?: DataFilterExtensionOptions);
83
104
  getShaders(this: Layer<DataFilterExtensionProps>, extension: this): any;
84
105
  initializeState(this: Layer<DataFilterExtensionProps>, context: LayerContext, extension: this): void;
85
- updateState(this: Layer<DataFilterExtensionProps>, { props, oldProps }: UpdateParameters<Layer<DataFilterExtensionProps>>): void;
106
+ updateState(this: Layer<DataFilterExtensionProps>, { props, oldProps, changeFlags }: UpdateParameters<Layer<DataFilterExtensionProps>>, extension: this): void;
86
107
  draw(this: Layer<DataFilterExtensionProps>, params: any, extension: this): void;
87
108
  finalizeState(this: Layer<DataFilterExtensionProps>): void;
109
+ /**
110
+ * Updates the bitmask used on the GPU to perform the filter based on the
111
+ * `filterCategories` prop. The mapping between categories and bit in the bitmask
112
+ * is performed by `_getCategoryKey()`
113
+ */
114
+ _updateCategoryBitMask(this: Layer<DataFilterExtensionProps>, params: any, extension: this): void;
115
+ /**
116
+ * Returns an index of bit in the bitmask for a given category. If the category has
117
+ * not yet been assigned a bit, a new one is assigned.
118
+ */
119
+ _getCategoryKey(this: Layer<DataFilterExtensionProps>, category: FilterCategory, channel: number): number;
88
120
  }
89
121
  export {};
90
122
  //# sourceMappingURL=data-filter-extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-filter-extension.d.ts","sourceRoot":"","sources":["../../src/data-filter/data-filter-extension.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,249 @@
1
+ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
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.
20
+ import { _deepEqual as deepEqual, LayerExtension, log } from '@deck.gl/core';
21
+ import { shaderModule, shaderModule64 } from "./shader-module.js";
22
+ import * as aggregator from "./aggregator.js";
23
+ const defaultProps = {
24
+ getFilterValue: { type: 'accessor', value: 0 },
25
+ getFilterCategory: { type: 'accessor', value: 0 },
26
+ onFilteredItemsChange: { type: 'function', value: null, optional: true },
27
+ filterEnabled: true,
28
+ filterRange: [-1, 1],
29
+ filterSoftRange: null,
30
+ filterCategories: [0],
31
+ filterTransformSize: true,
32
+ filterTransformColor: true
33
+ };
34
+ const defaultOptions = {
35
+ categorySize: 1,
36
+ filterSize: 1,
37
+ fp64: false,
38
+ countItems: false
39
+ };
40
+ const DATA_TYPE_FROM_SIZE = {
41
+ 1: 'float',
42
+ 2: 'vec2',
43
+ 3: 'vec3',
44
+ 4: 'vec4'
45
+ };
46
+ /** Adds GPU-based data filtering functionalities to layers. It allows the layer to show/hide objects based on user-defined properties. */
47
+ export default class DataFilterExtension extends LayerExtension {
48
+ static { this.defaultProps = defaultProps; }
49
+ static { this.extensionName = 'DataFilterExtension'; }
50
+ constructor(opts = {}) {
51
+ super({ ...defaultOptions, ...opts });
52
+ }
53
+ getShaders(extension) {
54
+ const { categorySize, filterSize, fp64 } = extension.opts;
55
+ return {
56
+ modules: [fp64 ? shaderModule64 : shaderModule],
57
+ defines: {
58
+ DATACATEGORY_TYPE: DATA_TYPE_FROM_SIZE[categorySize],
59
+ DATACATEGORY_CHANNELS: categorySize,
60
+ DATAFILTER_TYPE: DATA_TYPE_FROM_SIZE[filterSize],
61
+ DATAFILTER_DOUBLE: Boolean(fp64)
62
+ }
63
+ };
64
+ }
65
+ initializeState(context, extension) {
66
+ const attributeManager = this.getAttributeManager();
67
+ const { categorySize, filterSize, fp64 } = extension.opts;
68
+ if (attributeManager) {
69
+ attributeManager.add({
70
+ filterValues: {
71
+ size: filterSize,
72
+ type: fp64 ? 'float64' : 'float32',
73
+ accessor: 'getFilterValue',
74
+ shaderAttributes: {
75
+ filterValues: {
76
+ divisor: 0
77
+ },
78
+ instanceFilterValues: {
79
+ divisor: 1
80
+ }
81
+ }
82
+ },
83
+ filterCategoryValues: {
84
+ size: categorySize,
85
+ accessor: 'getFilterCategory',
86
+ transform: categorySize === 1
87
+ ? d => extension._getCategoryKey.call(this, d, 0)
88
+ : d => d.map((x, i) => extension._getCategoryKey.call(this, x, i)),
89
+ shaderAttributes: {
90
+ filterCategoryValues: {
91
+ divisor: 0
92
+ },
93
+ instanceFilterCategoryValues: {
94
+ divisor: 1
95
+ }
96
+ }
97
+ }
98
+ });
99
+ }
100
+ const { device } = this.context;
101
+ if (attributeManager && extension.opts.countItems) {
102
+ const useFloatTarget = aggregator.supportsFloatTarget(device);
103
+ // This attribute is needed for variable-width data, e.g. Path, SolidPolygon, Text
104
+ // The vertex shader checks if a vertex has the same "index" as the previous vertex
105
+ // so that we only write one count cross multiple vertices of the same object
106
+ attributeManager.add({
107
+ filterIndices: {
108
+ size: useFloatTarget ? 1 : 2,
109
+ vertexOffset: 1,
110
+ type: 'unorm8',
111
+ accessor: (object, { index }) => {
112
+ const i = object && object.__source ? object.__source.index : index;
113
+ return useFloatTarget ? (i + 1) % 255 : [(i + 1) % 255, Math.floor(i / 255) % 255];
114
+ },
115
+ shaderAttributes: {
116
+ filterPrevIndices: {
117
+ vertexOffset: 0
118
+ },
119
+ filterIndices: {
120
+ vertexOffset: 1
121
+ }
122
+ }
123
+ }
124
+ });
125
+ const filterFBO = aggregator.getFramebuffer(device, useFloatTarget);
126
+ const filterModel = aggregator.getModel(device, extension.getShaders.call(this, extension), useFloatTarget);
127
+ this.setState({ filterFBO, filterModel });
128
+ }
129
+ }
130
+ updateState({ props, oldProps, changeFlags }, extension) {
131
+ const attributeManager = this.getAttributeManager();
132
+ const { categorySize } = extension.opts;
133
+ if (this.state.filterModel) {
134
+ const filterNeedsUpdate =
135
+ // attributeManager must be defined for filterModel to be set
136
+ attributeManager.attributes.filterValues.needsUpdate() ||
137
+ attributeManager.attributes.filterCategoryValues?.needsUpdate() ||
138
+ props.filterEnabled !== oldProps.filterEnabled ||
139
+ props.filterRange !== oldProps.filterRange ||
140
+ props.filterSoftRange !== oldProps.filterSoftRange ||
141
+ props.filterCategories !== oldProps.filterCategories;
142
+ if (filterNeedsUpdate) {
143
+ this.setState({ filterNeedsUpdate });
144
+ }
145
+ }
146
+ if (attributeManager?.attributes.filterCategoryValues) {
147
+ // Update bitmask if accessor or selected categories has changed
148
+ const categoryBitMaskNeedsUpdate = attributeManager.attributes.filterCategoryValues.needsUpdate() ||
149
+ !deepEqual(props.filterCategories, oldProps.filterCategories, 2);
150
+ if (categoryBitMaskNeedsUpdate) {
151
+ this.setState({ categoryBitMaskNeedsUpdate });
152
+ }
153
+ // Need to recreate category map if categorySize has changed
154
+ const resetCategories = changeFlags.dataChanged;
155
+ if (resetCategories) {
156
+ this.setState({
157
+ categoryMap: Array(categorySize)
158
+ .fill(0)
159
+ .map(() => ({}))
160
+ });
161
+ attributeManager.attributes.filterCategoryValues.setNeedsUpdate('categoryMap');
162
+ }
163
+ }
164
+ }
165
+ draw(params, extension) {
166
+ const filterFBO = this.state.filterFBO;
167
+ const filterModel = this.state.filterModel;
168
+ const filterNeedsUpdate = this.state.filterNeedsUpdate;
169
+ const categoryBitMaskNeedsUpdate = this.state.categoryBitMaskNeedsUpdate;
170
+ const { onFilteredItemsChange } = this.props;
171
+ if (categoryBitMaskNeedsUpdate) {
172
+ extension._updateCategoryBitMask.call(this, params, extension);
173
+ }
174
+ if (filterNeedsUpdate && onFilteredItemsChange && filterModel) {
175
+ const { attributes: { filterValues, filterCategoryValues, filterIndices } } = this.getAttributeManager();
176
+ filterModel.setVertexCount(this.getNumInstances());
177
+ this.context.device.clearWebGL({ framebuffer: filterFBO, color: [0, 0, 0, 0] });
178
+ filterModel.updateModuleSettings(params.moduleParameters);
179
+ // @ts-expect-error filterValue and filterIndices should always have buffer value
180
+ filterModel.setAttributes({
181
+ ...filterValues.getValue(),
182
+ ...filterCategoryValues?.getValue(),
183
+ ...filterIndices?.getValue()
184
+ });
185
+ filterModel.setUniforms(params.uniforms);
186
+ filterModel.device.withParametersWebGL({
187
+ framebuffer: filterFBO,
188
+ // ts-ignore 'readonly' cannot be assigned to the mutable type '[GLBlendEquation, GLBlendEquation]'
189
+ ...aggregator.parameters,
190
+ viewport: [0, 0, filterFBO.width, filterFBO.height]
191
+ }, () => {
192
+ filterModel.draw(this.context.renderPass);
193
+ });
194
+ const color = filterModel.device.readPixelsToArrayWebGL(filterFBO);
195
+ let count = 0;
196
+ for (let i = 0; i < color.length; i++) {
197
+ count += color[i];
198
+ }
199
+ onFilteredItemsChange({ id: this.id, count });
200
+ this.state.filterNeedsUpdate = false;
201
+ }
202
+ }
203
+ finalizeState() {
204
+ const filterFBO = this.state.filterFBO;
205
+ const filterModel = this.state.filterModel;
206
+ // filterFBO.color.delete();
207
+ filterFBO?.destroy();
208
+ filterModel?.destroy();
209
+ }
210
+ /**
211
+ * Updates the bitmask used on the GPU to perform the filter based on the
212
+ * `filterCategories` prop. The mapping between categories and bit in the bitmask
213
+ * is performed by `_getCategoryKey()`
214
+ */
215
+ _updateCategoryBitMask(params, extension) {
216
+ const { categorySize } = extension.opts;
217
+ const { filterCategories } = this.props;
218
+ const categoryBitMask = new Uint32Array([0, 0, 0, 0]);
219
+ const categoryFilters = (categorySize === 1 ? [filterCategories] : filterCategories);
220
+ const maxCategories = categorySize === 1 ? 128 : categorySize === 2 ? 64 : 32;
221
+ for (let c = 0; c < categoryFilters.length; c++) {
222
+ const categoryFilter = categoryFilters[c];
223
+ for (const category of categoryFilter) {
224
+ const key = extension._getCategoryKey.call(this, category, c);
225
+ if (key < maxCategories) {
226
+ const channel = c * (maxCategories / 32) + Math.floor(key / 32);
227
+ categoryBitMask[channel] += Math.pow(2, key % 32); // 1 << key fails for key > 30
228
+ }
229
+ else {
230
+ log.warn(`Exceeded maximum number of categories (${maxCategories})`)();
231
+ }
232
+ }
233
+ }
234
+ /* eslint-disable-next-line camelcase */
235
+ params.uniforms.filter_categoryBitMask = categoryBitMask;
236
+ this.state.categoryBitMaskNeedsUpdate = false;
237
+ }
238
+ /**
239
+ * Returns an index of bit in the bitmask for a given category. If the category has
240
+ * not yet been assigned a bit, a new one is assigned.
241
+ */
242
+ _getCategoryKey(category, channel) {
243
+ const categoryMap = this.state.categoryMap[channel];
244
+ if (!(category in categoryMap)) {
245
+ categoryMap[category] = Object.keys(categoryMap).length;
246
+ }
247
+ return categoryMap[category];
248
+ }
249
+ }
@@ -1,5 +1,5 @@
1
1
  import type { ShaderModule } from '@luma.gl/shadertools';
2
- import type { DataFilterExtensionProps } from './data-filter-extension';
2
+ import type { DataFilterExtensionProps } from "./data-filter-extension.js";
3
3
  type DataFilterModuleSettings = {
4
4
  extensions: any[];
5
5
  } & DataFilterExtensionProps;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader-module.d.ts","sourceRoot":"","sources":["../../src/data-filter/shader-module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAC,wBAAwB,EAAC,mCAAgC;AA+FtE,KAAK,wBAAwB,GAAG;IAC9B,UAAU,EAAE,GAAG,EAAE,CAAC;CACnB,GAAG,wBAAwB,CAAC;AAkG7B,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,wBAAwB,CAM/D,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,YAAY,CAAC,wBAAwB,CAMjE,CAAC"}