@deck.gl/extensions 9.0.40 → 9.1.0-beta.3

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 (160) hide show
  1. package/dist/brushing/brushing-extension.d.ts +1 -0
  2. package/dist/brushing/brushing-extension.d.ts.map +1 -1
  3. package/dist/brushing/brushing-extension.js +16 -19
  4. package/dist/brushing/brushing-extension.js.map +1 -0
  5. package/dist/brushing/shader-module.d.ts +8 -2
  6. package/dist/brushing/shader-module.d.ts.map +1 -1
  7. package/dist/brushing/shader-module.js +75 -50
  8. package/dist/brushing/shader-module.js.map +1 -0
  9. package/dist/clip/clip-extension.d.ts +5 -2
  10. package/dist/clip/clip-extension.d.ts.map +1 -1
  11. package/dist/clip/clip-extension.js +37 -42
  12. package/dist/clip/clip-extension.js.map +1 -0
  13. package/dist/collision-filter/collision-filter-effect.d.ts +4 -4
  14. package/dist/collision-filter/collision-filter-effect.d.ts.map +1 -1
  15. package/dist/collision-filter/collision-filter-effect.js +28 -13
  16. package/dist/collision-filter/collision-filter-effect.js.map +1 -0
  17. package/dist/collision-filter/collision-filter-extension.d.ts +1 -1
  18. package/dist/collision-filter/collision-filter-extension.d.ts.map +1 -1
  19. package/dist/collision-filter/collision-filter-extension.js +6 -6
  20. package/dist/collision-filter/collision-filter-extension.js.map +1 -0
  21. package/dist/collision-filter/collision-filter-pass.d.ts +9 -5
  22. package/dist/collision-filter/collision-filter-pass.d.ts.map +1 -1
  23. package/dist/collision-filter/collision-filter-pass.js +15 -4
  24. package/dist/collision-filter/collision-filter-pass.js.map +1 -0
  25. package/dist/collision-filter/shader-module.d.ts +3 -2
  26. package/dist/collision-filter/shader-module.d.ts.map +1 -1
  27. package/dist/collision-filter/shader-module.js +75 -52
  28. package/dist/collision-filter/shader-module.js.map +1 -0
  29. package/dist/data-filter/aggregator.d.ts +4 -10
  30. package/dist/data-filter/aggregator.d.ts.map +1 -1
  31. package/dist/data-filter/aggregator.js +15 -8
  32. package/dist/data-filter/aggregator.js.map +1 -0
  33. package/dist/data-filter/data-filter-extension.d.ts.map +1 -1
  34. package/dist/data-filter/data-filter-extension.js +49 -39
  35. package/dist/data-filter/data-filter-extension.js.map +1 -0
  36. package/dist/data-filter/shader-module.d.ts +12 -5
  37. package/dist/data-filter/shader-module.d.ts.map +1 -1
  38. package/dist/data-filter/shader-module.js +190 -131
  39. package/dist/data-filter/shader-module.js.map +1 -0
  40. package/dist/dist.dev.js +2720 -2037
  41. package/dist/fill-style/fill-style-extension.d.ts.map +1 -1
  42. package/dist/fill-style/fill-style-extension.js +12 -4
  43. package/dist/fill-style/fill-style-extension.js.map +1 -0
  44. package/dist/fill-style/shader-module.d.ts +64 -6
  45. package/dist/fill-style/shader-module.d.ts.map +1 -1
  46. package/dist/fill-style/shader-module.js +74 -51
  47. package/dist/fill-style/shader-module.js.map +1 -0
  48. package/dist/fp64/fp64-extension.d.ts +1 -0
  49. package/dist/fp64/fp64-extension.d.ts.map +1 -1
  50. package/dist/fp64/fp64-extension.js +8 -19
  51. package/dist/fp64/fp64-extension.js.map +1 -0
  52. package/dist/fp64/project64.d.ts +2 -2
  53. package/dist/fp64/project64.d.ts.map +1 -1
  54. package/dist/fp64/project64.glsl.d.ts +1 -1
  55. package/dist/fp64/project64.glsl.d.ts.map +1 -1
  56. package/dist/fp64/project64.glsl.js +19 -21
  57. package/dist/fp64/project64.glsl.js.map +1 -0
  58. package/dist/fp64/project64.js +25 -24
  59. package/dist/fp64/project64.js.map +1 -0
  60. package/dist/index.cjs +1034 -528
  61. package/dist/index.cjs.map +4 -4
  62. package/dist/index.d.ts +1 -0
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +4 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/mask/mask-effect.d.ts +5 -3
  67. package/dist/mask/mask-effect.d.ts.map +1 -1
  68. package/dist/mask/mask-effect.js +13 -5
  69. package/dist/mask/mask-effect.js.map +1 -0
  70. package/dist/mask/mask-extension.d.ts +1 -1
  71. package/dist/mask/mask-extension.d.ts.map +1 -1
  72. package/dist/mask/mask-extension.js +14 -8
  73. package/dist/mask/mask-extension.js.map +1 -0
  74. package/dist/mask/mask-pass.d.ts +2 -43
  75. package/dist/mask/mask-pass.d.ts.map +1 -1
  76. package/dist/mask/mask-pass.js +5 -1
  77. package/dist/mask/mask-pass.js.map +1 -0
  78. package/dist/mask/shader-module.d.ts +60 -3
  79. package/dist/mask/shader-module.d.ts.map +1 -1
  80. package/dist/mask/shader-module.js +74 -46
  81. package/dist/mask/shader-module.js.map +1 -0
  82. package/dist/path-style/path-style-extension.d.ts.map +1 -1
  83. package/dist/path-style/path-style-extension.js +21 -24
  84. package/dist/path-style/path-style-extension.js.map +1 -0
  85. package/dist/path-style/shaders.glsl.d.ts.map +1 -1
  86. package/dist/path-style/shaders.glsl.js +12 -7
  87. package/dist/path-style/shaders.glsl.js.map +1 -0
  88. package/dist/terrain/height-map-builder.d.ts.map +1 -1
  89. package/dist/terrain/height-map-builder.js +4 -0
  90. package/dist/terrain/height-map-builder.js.map +1 -0
  91. package/dist/terrain/shader-module.d.ts +60 -6
  92. package/dist/terrain/shader-module.d.ts.map +1 -1
  93. package/dist/terrain/shader-module.js +70 -61
  94. package/dist/terrain/shader-module.js.map +1 -0
  95. package/dist/terrain/terrain-cover.d.ts.map +1 -1
  96. package/dist/terrain/terrain-cover.js +4 -0
  97. package/dist/terrain/terrain-cover.js.map +1 -0
  98. package/dist/terrain/terrain-effect.d.ts +4 -2
  99. package/dist/terrain/terrain-effect.d.ts.map +1 -1
  100. package/dist/terrain/terrain-effect.js +32 -18
  101. package/dist/terrain/terrain-effect.js.map +1 -0
  102. package/dist/terrain/terrain-extension.d.ts.map +1 -1
  103. package/dist/terrain/terrain-extension.js +4 -0
  104. package/dist/terrain/terrain-extension.js.map +1 -0
  105. package/dist/terrain/terrain-pass.d.ts +6 -41
  106. package/dist/terrain/terrain-pass.d.ts.map +1 -1
  107. package/dist/terrain/terrain-pass.js +12 -1
  108. package/dist/terrain/terrain-pass.js.map +1 -0
  109. package/dist/terrain/terrain-picking-pass.d.ts +7 -1
  110. package/dist/terrain/terrain-picking-pass.d.ts.map +1 -1
  111. package/dist/terrain/terrain-picking-pass.js +12 -1
  112. package/dist/terrain/terrain-picking-pass.js.map +1 -0
  113. package/dist/terrain/utils.d.ts.map +1 -1
  114. package/dist/terrain/utils.js +4 -0
  115. package/dist/terrain/utils.js.map +1 -0
  116. package/dist/utils/debug.d.ts +2 -2
  117. package/dist/utils/debug.d.ts.map +1 -1
  118. package/dist/utils/debug.js +4 -1
  119. package/dist/utils/debug.js.map +1 -0
  120. package/dist/utils/projection-utils.d.ts.map +1 -1
  121. package/dist/utils/projection-utils.js +4 -0
  122. package/dist/utils/projection-utils.js.map +1 -0
  123. package/dist.min.js +1102 -817
  124. package/package.json +8 -8
  125. package/src/brushing/brushing-extension.ts +17 -20
  126. package/src/brushing/shader-module.ts +58 -47
  127. package/src/clip/clip-extension.ts +38 -40
  128. package/src/collision-filter/collision-filter-effect.ts +31 -20
  129. package/src/collision-filter/collision-filter-extension.ts +6 -7
  130. package/src/collision-filter/collision-filter-pass.ts +17 -6
  131. package/src/collision-filter/shader-module.ts +40 -22
  132. package/src/data-filter/aggregator.ts +23 -11
  133. package/src/data-filter/data-filter-extension.ts +76 -49
  134. package/src/data-filter/shader-module.ts +150 -90
  135. package/src/fill-style/fill-style-extension.ts +13 -5
  136. package/src/fill-style/shader-module.ts +84 -52
  137. package/src/fp64/fp64-extension.ts +8 -19
  138. package/src/fp64/project64.glsl.ts +18 -21
  139. package/src/fp64/project64.ts +27 -28
  140. package/src/index.ts +5 -0
  141. package/src/mask/mask-effect.ts +17 -7
  142. package/src/mask/mask-extension.ts +16 -9
  143. package/src/mask/mask-pass.ts +17 -3
  144. package/src/mask/shader-module.ts +63 -27
  145. package/src/path-style/path-style-extension.ts +27 -28
  146. package/src/path-style/shaders.glsl.ts +13 -7
  147. package/src/terrain/height-map-builder.ts +4 -0
  148. package/src/terrain/shader-module.ts +62 -44
  149. package/src/terrain/terrain-cover.ts +4 -0
  150. package/src/terrain/terrain-effect.ts +36 -19
  151. package/src/terrain/terrain-extension.ts +4 -0
  152. package/src/terrain/terrain-pass.ts +19 -3
  153. package/src/terrain/terrain-picking-pass.ts +15 -2
  154. package/src/terrain/utils.ts +4 -0
  155. package/src/utils/debug.ts +4 -0
  156. package/src/utils/projection-utils.ts +4 -0
  157. package/dist/utils/syntax-tags.d.ts +0 -6
  158. package/dist/utils/syntax-tags.d.ts.map +0 -1
  159. package/dist/utils/syntax-tags.js +0 -5
  160. package/src/utils/syntax-tags.ts +0 -5
@@ -1,14 +1,20 @@
1
- import {Framebuffer, Texture} from '@luma.gl/core';
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import {Framebuffer, Texture, TextureView} from '@luma.gl/core';
2
6
  import type {ShaderModule} from '@luma.gl/shadertools';
3
7
  import {project} from '@deck.gl/core';
4
- import {glsl} from '../utils/syntax-tags';
5
8
 
6
- const vs = glsl`
9
+ const vs = /* glsl */ `
7
10
  in float collisionPriorities;
8
11
 
9
12
  uniform sampler2D collision_texture;
10
- uniform bool collision_sort;
11
- uniform bool collision_enabled;
13
+
14
+ uniform collisionUniforms {
15
+ bool sort;
16
+ bool enabled;
17
+ } collision;
12
18
 
13
19
  vec2 collision_getCoords(vec4 position) {
14
20
  vec4 collision_clipspace = project_common_position_to_clipspace(position);
@@ -23,7 +29,7 @@ float collision_match(vec2 tex, vec3 pickingColor) {
23
29
  }
24
30
 
25
31
  float collision_isVisible(vec2 texCoords, vec3 pickingColor) {
26
- if (!collision_enabled) {
32
+ if (!collision.enabled) {
27
33
  return 1.0;
28
34
  }
29
35
 
@@ -32,7 +38,7 @@ float collision_isVisible(vec2 texCoords, vec3 pickingColor) {
32
38
  // This reduces the flicker present when objects are shown/hidden
33
39
  const int N = 2;
34
40
  float accumulator = 0.0;
35
- vec2 step = vec2(1.0 / project_uViewportSize);
41
+ vec2 step = vec2(1.0 / project.viewportSize);
36
42
 
37
43
  const float floatN = float(N);
38
44
  vec2 delta = -floatN * step;
@@ -51,16 +57,16 @@ float collision_isVisible(vec2 texCoords, vec3 pickingColor) {
51
57
  `;
52
58
 
53
59
  const inject = {
54
- 'vs:#decl': glsl`
60
+ 'vs:#decl': /* glsl */ `
55
61
  float collision_fade = 1.0;
56
62
  `,
57
- 'vs:DECKGL_FILTER_GL_POSITION': glsl`
58
- if (collision_sort) {
63
+ 'vs:DECKGL_FILTER_GL_POSITION': /* glsl */ `
64
+ if (collision.sort) {
59
65
  float collisionPriority = collisionPriorities;
60
66
  position.z = -0.001 * collisionPriority * position.w; // Support range -1000 -> 1000
61
67
  }
62
68
 
63
- if (collision_enabled) {
69
+ if (collision.enabled) {
64
70
  vec4 collision_common_position = project_position(vec4(geometry.worldPosition, 1.0));
65
71
  vec2 collision_texCoords = collision_getCoords(collision_common_position);
66
72
  collision_fade = collision_isVisible(collision_texCoords, geometry.pickingColor / 255.0);
@@ -70,40 +76,52 @@ const inject = {
70
76
  }
71
77
  }
72
78
  `,
73
- 'vs:DECKGL_FILTER_COLOR': glsl`
79
+ 'vs:DECKGL_FILTER_COLOR': /* glsl */ `
74
80
  color.a *= collision_fade;
75
81
  `
76
82
  };
77
83
 
78
- type CollisionModuleSettings = {
84
+ export type CollisionModuleProps = {
85
+ enabled: boolean;
79
86
  collisionFBO?: Framebuffer;
80
87
  drawToCollisionMap?: boolean;
81
88
  dummyCollisionMap?: Texture;
82
89
  };
83
90
 
84
91
  /* eslint-disable camelcase */
85
- type CollisionUniforms = {collision_sort?: boolean; collision_texture?: Texture};
92
+ type CollisionUniforms = {
93
+ enabled?: boolean;
94
+ sort?: boolean;
95
+ };
96
+
97
+ type CollisionBindings = {
98
+ collision_texture?: TextureView | Texture;
99
+ };
86
100
 
87
101
  const getCollisionUniforms = (
88
- opts: CollisionModuleSettings | {},
89
- uniforms: Record<string, any>
90
- ): CollisionUniforms => {
102
+ opts: CollisionModuleProps | {}
103
+ ): CollisionBindings & CollisionUniforms => {
91
104
  if (!opts || !('dummyCollisionMap' in opts)) {
92
105
  return {};
93
106
  }
94
- const {collisionFBO, drawToCollisionMap, dummyCollisionMap} = opts;
107
+ const {enabled, collisionFBO, drawToCollisionMap, dummyCollisionMap} = opts;
95
108
  return {
96
- collision_sort: Boolean(drawToCollisionMap),
97
- // @ts-ignore (v9 not sure why this isn't allowed now)
109
+ enabled: enabled && !drawToCollisionMap,
110
+ sort: Boolean(drawToCollisionMap),
98
111
  collision_texture:
99
112
  !drawToCollisionMap && collisionFBO ? collisionFBO.colorAttachments[0] : dummyCollisionMap
100
113
  };
101
114
  };
102
115
 
116
+ // @ts-ignore
103
117
  export default {
104
118
  name: 'collision',
105
119
  dependencies: [project],
106
120
  vs,
107
121
  inject,
108
- getUniforms: getCollisionUniforms
109
- } as ShaderModule<CollisionModuleSettings>;
122
+ getUniforms: getCollisionUniforms,
123
+ uniformTypes: {
124
+ sort: 'i32',
125
+ enabled: 'i32'
126
+ }
127
+ } as ShaderModule<CollisionModuleProps>;
@@ -1,6 +1,9 @@
1
- import {Device, DeviceFeature, Framebuffer} from '@luma.gl/core';
2
- import {Model} from '@luma.gl/engine';
3
- import {GL} from '@luma.gl/constants';
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import {Device, DeviceFeature, Framebuffer, RenderPipelineParameters} from '@luma.gl/core';
6
+ import {Model, ModelProps} from '@luma.gl/engine';
4
7
 
5
8
  const AGGREGATE_VS = `\
6
9
  #version 300 es
@@ -71,7 +74,6 @@ export function getFramebuffer(device: Device, useFloatTarget: boolean): Framebu
71
74
  colorAttachments: [
72
75
  device.createTexture({
73
76
  format: 'rgba32float',
74
- type: GL.FLOAT,
75
77
  mipmaps: false
76
78
  })
77
79
  ]
@@ -80,12 +82,17 @@ export function getFramebuffer(device: Device, useFloatTarget: boolean): Framebu
80
82
  return device.createFramebuffer({
81
83
  width: 256,
82
84
  height: 64,
83
- colorAttachments: [device.createTexture({format: 'rgba8unorm', type: GL.FLOAT, mipmaps: false})]
85
+ colorAttachments: [device.createTexture({format: 'rgba8unorm', mipmaps: false})]
84
86
  });
85
87
  }
86
88
 
87
89
  // Increments the counter based on dataFilter_value
88
- export function getModel(device: Device, shaderOptions: any, useFloatTarget: boolean): Model {
90
+ export function getModel(
91
+ device: Device,
92
+ bufferLayout: ModelProps['bufferLayout'],
93
+ shaderOptions: any,
94
+ useFloatTarget: boolean
95
+ ): Model {
89
96
  shaderOptions.defines.NON_INSTANCED_MODEL = 1;
90
97
  if (useFloatTarget) {
91
98
  shaderOptions.defines.FLOAT_TARGET = 1;
@@ -95,16 +102,21 @@ export function getModel(device: Device, shaderOptions: any, useFloatTarget: boo
95
102
  id: 'data-filter-aggregation-model',
96
103
  vertexCount: 1,
97
104
  isInstanced: false,
98
- drawMode: GL.POINTS,
105
+ topology: 'point-list',
99
106
  vs: AGGREGATE_VS,
100
107
  fs: AGGREGATE_FS,
108
+ bufferLayout,
101
109
  ...shaderOptions
102
110
  });
103
111
  }
104
112
 
105
- export const parameters = {
113
+ export const parameters: RenderPipelineParameters = {
106
114
  blend: true,
107
- blendFunc: [GL.ONE, GL.ONE, GL.ONE, GL.ONE],
108
- blendEquation: [GL.FUNC_ADD, GL.FUNC_ADD],
109
- depthTest: false
115
+ blendColorSrcFactor: 'one',
116
+ blendColorDstFactor: 'one',
117
+ blendAlphaSrcFactor: 'one',
118
+ blendAlphaDstFactor: 'one',
119
+ blendColorOperation: 'add',
120
+ blendAlphaOperation: 'add',
121
+ depthCompare: 'never'
110
122
  } as const;
@@ -1,29 +1,20 @@
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
-
21
- import type {Framebuffer} from '@luma.gl/core';
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {Buffer, Framebuffer} from '@luma.gl/core';
22
6
  import type {Model} from '@luma.gl/engine';
23
7
  import type {Layer, LayerContext, Accessor, UpdateParameters} from '@deck.gl/core';
24
8
  import {_deepEqual as deepEqual, LayerExtension, log} from '@deck.gl/core';
25
- import {Defines, shaderModule, shaderModule64} from './shader-module';
9
+ import {
10
+ CategoryBitMask,
11
+ DataFilterModuleProps,
12
+ Defines,
13
+ dataFilter,
14
+ dataFilter64
15
+ } from './shader-module';
26
16
  import * as aggregator from './aggregator';
17
+ import {NumberArray4} from '@math.gl/core';
27
18
 
28
19
  const defaultProps = {
29
20
  getFilterValue: {type: 'accessor', value: 0},
@@ -124,6 +115,12 @@ const defaultOptions: Required<DataFilterExtensionOptions> = {
124
115
  countItems: false
125
116
  };
126
117
 
118
+ const CATEGORY_TYPE_FROM_SIZE = {
119
+ 1: 'uint' as const,
120
+ 2: 'uvec2' as const,
121
+ 3: 'uvec3' as const,
122
+ 4: 'uvec4' as const
123
+ };
127
124
  const DATA_TYPE_FROM_SIZE = {
128
125
  1: 'float' as const,
129
126
  2: 'vec2' as const,
@@ -146,7 +143,7 @@ export default class DataFilterExtension extends LayerExtension<
146
143
  const {categorySize, filterSize, fp64} = extension.opts;
147
144
  const defines: Defines = {};
148
145
  if (categorySize) {
149
- defines.DATACATEGORY_TYPE = DATA_TYPE_FROM_SIZE[categorySize];
146
+ defines.DATACATEGORY_TYPE = CATEGORY_TYPE_FROM_SIZE[categorySize];
150
147
  defines.DATACATEGORY_CHANNELS = categorySize;
151
148
  }
152
149
  if (filterSize) {
@@ -154,7 +151,10 @@ export default class DataFilterExtension extends LayerExtension<
154
151
  defines.DATAFILTER_DOUBLE = Boolean(fp64);
155
152
  }
156
153
 
157
- return {modules: [fp64 ? shaderModule64 : shaderModule], defines};
154
+ const module = fp64 ? dataFilter64 : dataFilter;
155
+ module.uniformTypes = module.uniformTypesFromOptions(extension.opts);
156
+
157
+ return {modules: [module], defines};
158
158
  }
159
159
 
160
160
  initializeState(this: Layer<DataFilterExtensionProps>, context: LayerContext, extension: this) {
@@ -179,6 +179,7 @@ export default class DataFilterExtension extends LayerExtension<
179
179
  size: categorySize,
180
180
  stepMode: 'dynamic',
181
181
  accessor: 'getFilterCategory',
182
+ type: 'uint32',
182
183
  transform:
183
184
  categorySize === 1
184
185
  ? d => extension._getCategoryKey.call(this, d, 0)
@@ -195,7 +196,7 @@ export default class DataFilterExtension extends LayerExtension<
195
196
  // The vertex shader checks if a vertex has the same "index" as the previous vertex
196
197
  // so that we only write one count cross multiple vertices of the same object
197
198
  attributeManager.add({
198
- filterIndices: {
199
+ filterVertexIndices: {
199
200
  size: useFloatTarget ? 1 : 2,
200
201
  vertexOffset: 1,
201
202
  type: 'unorm8',
@@ -217,6 +218,7 @@ export default class DataFilterExtension extends LayerExtension<
217
218
  const filterFBO = aggregator.getFramebuffer(device, useFloatTarget);
218
219
  const filterModel = aggregator.getModel(
219
220
  device,
221
+ attributeManager.getBufferLayouts({isInstanced: false}),
220
222
  extension.getShaders.call(this, extension),
221
223
  useFloatTarget
222
224
  );
@@ -271,40 +273,65 @@ export default class DataFilterExtension extends LayerExtension<
271
273
  const filterModel = this.state.filterModel as Model;
272
274
  const filterNeedsUpdate = this.state.filterNeedsUpdate as boolean;
273
275
 
274
- const {onFilteredItemsChange} = this.props;
275
-
276
276
  if (!this.state.categoryBitMask) {
277
277
  extension._updateCategoryBitMask.call(this, params, extension);
278
278
  }
279
+
280
+ const {
281
+ onFilteredItemsChange,
282
+ extensions,
283
+ filterEnabled,
284
+ filterRange,
285
+ filterSoftRange,
286
+ filterTransformSize,
287
+ filterTransformColor,
288
+ filterCategories
289
+ } = this.props;
290
+ const dataFilterProps: DataFilterModuleProps = {
291
+ extensions,
292
+ filterEnabled,
293
+ filterRange,
294
+ filterSoftRange,
295
+ filterTransformSize,
296
+ filterTransformColor,
297
+ filterCategories
298
+ };
299
+ if (this.state.categoryBitMask) {
300
+ dataFilterProps.categoryBitMask = this.state.categoryBitMask as CategoryBitMask;
301
+ }
302
+ this.setShaderModuleProps({dataFilter: dataFilterProps});
303
+
279
304
  /* eslint-disable-next-line camelcase */
280
- params.uniforms.filter_categoryBitMask = this.state.categoryBitMask;
281
305
  if (filterNeedsUpdate && onFilteredItemsChange && filterModel) {
306
+ const attributeManager = this.getAttributeManager()!;
282
307
  const {
283
- attributes: {filterValues, filterCategoryValues, filterIndices}
284
- } = this.getAttributeManager()!;
308
+ attributes: {filterValues, filterCategoryValues, filterVertexIndices}
309
+ } = attributeManager;
285
310
  filterModel.setVertexCount(this.getNumInstances());
286
311
 
287
- this.context.device.clearWebGL({framebuffer: filterFBO, color: [0, 0, 0, 0]});
288
-
289
- filterModel.updateModuleSettings(params.moduleParameters);
290
- // @ts-expect-error filterValue and filterIndices should always have buffer value
291
- filterModel.setAttributes({
312
+ // @ts-expect-error filterValue and filterVertexIndices should always have buffer value
313
+ const attributes: Record<string, Buffer> = {
292
314
  ...filterValues?.getValue(),
293
315
  ...filterCategoryValues?.getValue(),
294
- ...filterIndices?.getValue()
316
+ ...filterVertexIndices?.getValue()
317
+ };
318
+ filterModel.setAttributes(attributes);
319
+ filterModel.shaderInputs.setProps({
320
+ dataFilter: dataFilterProps
295
321
  });
296
- filterModel.setUniforms(params.uniforms);
297
- filterModel.device.withParametersWebGL(
298
- {
299
- framebuffer: filterFBO,
300
- // ts-ignore 'readonly' cannot be assigned to the mutable type '[GLBlendEquation, GLBlendEquation]'
301
- ...(aggregator.parameters as any),
302
- viewport: [0, 0, filterFBO.width, filterFBO.height]
303
- },
304
- () => {
305
- filterModel.draw(this.context.renderPass);
306
- }
307
- );
322
+
323
+ const viewport = [0, 0, filterFBO.width, filterFBO.height] as NumberArray4;
324
+
325
+ const renderPass = filterModel.device.beginRenderPass({
326
+ id: 'data-filter-aggregation',
327
+ framebuffer: filterFBO,
328
+ parameters: {viewport},
329
+ clearColor: [0, 0, 0, 0]
330
+ });
331
+ filterModel.setParameters(aggregator.parameters);
332
+ filterModel.draw(renderPass);
333
+ renderPass.end();
334
+
308
335
  const color = filterModel.device.readPixelsToArrayWebGL(filterFBO);
309
336
  let count = 0;
310
337
  for (let i = 0; i < color.length; i++) {
@@ -338,7 +365,7 @@ export default class DataFilterExtension extends LayerExtension<
338
365
  const {categorySize} = extension.opts;
339
366
  if (!categorySize) return;
340
367
  const {filterCategories} = this.props;
341
- const categoryBitMask = new Uint32Array([0, 0, 0, 0]);
368
+ const categoryBitMask: CategoryBitMask = new Uint32Array([0, 0, 0, 0]);
342
369
  const categoryFilters = (
343
370
  categorySize === 1 ? [filterCategories] : filterCategories
344
371
  ) as FilterCategory[][];