@deck.gl/aggregation-layers 9.4.0-alpha.1 → 9.4.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/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts.map +1 -1
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js +1 -3
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js.map +1 -1
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js +0 -1
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js.map +1 -1
- package/dist/dist.dev.js +642 -38
- package/dist/grid-layer/grid-cell-layer.d.ts.map +1 -1
- package/dist/grid-layer/grid-cell-layer.js +3 -2
- package/dist/grid-layer/grid-cell-layer.js.map +1 -1
- package/dist/grid-layer/grid-cell-layer.wgsl.d.ts +3 -0
- package/dist/grid-layer/grid-cell-layer.wgsl.d.ts.map +1 -0
- package/dist/grid-layer/grid-cell-layer.wgsl.js +114 -0
- package/dist/grid-layer/grid-cell-layer.wgsl.js.map +1 -0
- package/dist/grid-layer/grid-layer-uniforms.d.ts +1 -0
- package/dist/grid-layer/grid-layer-uniforms.d.ts.map +1 -1
- package/dist/grid-layer/grid-layer-uniforms.js +14 -0
- package/dist/grid-layer/grid-layer-uniforms.js.map +1 -1
- package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts +2 -0
- package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts.map +1 -1
- package/dist/heatmap-layer/heatmap-layer-uniforms.js +19 -0
- package/dist/heatmap-layer/heatmap-layer-uniforms.js.map +1 -1
- package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -1
- package/dist/heatmap-layer/heatmap-layer.js +59 -12
- package/dist/heatmap-layer/heatmap-layer.js.map +1 -1
- package/dist/heatmap-layer/max.wgsl.d.ts +3 -0
- package/dist/heatmap-layer/max.wgsl.d.ts.map +1 -0
- package/dist/heatmap-layer/max.wgsl.js +48 -0
- package/dist/heatmap-layer/max.wgsl.js.map +1 -0
- package/dist/heatmap-layer/triangle-layer-uniforms.d.ts +1 -0
- package/dist/heatmap-layer/triangle-layer-uniforms.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer-uniforms.js +16 -0
- package/dist/heatmap-layer/triangle-layer-uniforms.js.map +1 -1
- package/dist/heatmap-layer/triangle-layer.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer.js +3 -2
- package/dist/heatmap-layer/triangle-layer.js.map +1 -1
- package/dist/heatmap-layer/triangle-layer.wgsl.d.ts +3 -0
- package/dist/heatmap-layer/triangle-layer.wgsl.d.ts.map +1 -0
- package/dist/heatmap-layer/triangle-layer.wgsl.js +65 -0
- package/dist/heatmap-layer/triangle-layer.wgsl.js.map +1 -0
- package/dist/heatmap-layer/weights.wgsl.d.ts +3 -0
- package/dist/heatmap-layer/weights.wgsl.d.ts.map +1 -0
- package/dist/heatmap-layer/weights.wgsl.js +64 -0
- package/dist/heatmap-layer/weights.wgsl.js.map +1 -0
- package/dist/hexagon-layer/hexagon-cell-layer.d.ts.map +1 -1
- package/dist/hexagon-layer/hexagon-cell-layer.js +2 -2
- package/dist/hexagon-layer/hexagon-cell-layer.js.map +1 -1
- package/dist/hexagon-layer/hexagon-cell-layer.wgsl.d.ts +3 -0
- package/dist/hexagon-layer/hexagon-cell-layer.wgsl.d.ts.map +1 -0
- package/dist/hexagon-layer/hexagon-cell-layer.wgsl.js +120 -0
- package/dist/hexagon-layer/hexagon-cell-layer.wgsl.js.map +1 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts +1 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts.map +1 -1
- package/dist/hexagon-layer/hexagon-layer-uniforms.js +13 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.js.map +1 -1
- package/dist/index.cjs +13268 -1488
- package/dist/index.cjs.map +3 -4
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts +1 -6
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-cell-layer.js +3 -2
- package/dist/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
- package/dist/screen-grid-layer/screen-grid-cell-layer.wgsl.d.ts +3 -0
- package/dist/screen-grid-layer/screen-grid-cell-layer.wgsl.d.ts.map +1 -0
- package/dist/screen-grid-layer/screen-grid-cell-layer.wgsl.js +76 -0
- package/dist/screen-grid-layer/screen-grid-cell-layer.wgsl.js.map +1 -0
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts +1 -0
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.js +12 -0
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.js.map +1 -1
- package/dist.min.js +545 -35
- package/dist.webgl-only/common/aggregation-layer.js +68 -0
- package/dist.webgl-only/common/aggregation-layer.js.map +1 -0
- package/dist.webgl-only/common/aggregator/aggregator.js +5 -0
- package/dist.webgl-only/common/aggregator/aggregator.js.map +1 -0
- package/dist.webgl-only/common/aggregator/cpu-aggregator/aggregate.js +69 -0
- package/dist.webgl-only/common/aggregator/cpu-aggregator/aggregate.js.map +1 -0
- package/dist.webgl-only/common/aggregator/cpu-aggregator/cpu-aggregator.js +141 -0
- package/dist.webgl-only/common/aggregator/cpu-aggregator/cpu-aggregator.js.map +1 -0
- package/dist.webgl-only/common/aggregator/cpu-aggregator/sort-bins.js +44 -0
- package/dist.webgl-only/common/aggregator/cpu-aggregator/sort-bins.js.map +1 -0
- package/dist.webgl-only/common/aggregator/cpu-aggregator/vertex-accessor.js +56 -0
- package/dist.webgl-only/common/aggregator/cpu-aggregator/vertex-accessor.js.map +1 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js +22 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js.map +1 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js +18 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js.map +1 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/utils.js +24 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/utils.js.map +1 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js +222 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js.map +1 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/webgl-aggregator.js +203 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/webgl-aggregator.js.map +1 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/webgl-bin-sorter.js +225 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/webgl-bin-sorter.js.map +1 -0
- package/dist.webgl-only/common/aggregator/index.js +6 -0
- package/dist.webgl-only/common/aggregator/index.js.map +1 -0
- package/dist.webgl-only/common/types.js +5 -0
- package/dist.webgl-only/common/types.js.map +1 -0
- package/dist.webgl-only/common/utils/bounds-utils.js +21 -0
- package/dist.webgl-only/common/utils/bounds-utils.js.map +1 -0
- package/dist.webgl-only/common/utils/color-utils.js +65 -0
- package/dist.webgl-only/common/utils/color-utils.js.map +1 -0
- package/dist.webgl-only/common/utils/prop-utils.js +13 -0
- package/dist.webgl-only/common/utils/prop-utils.js.map +1 -0
- package/dist.webgl-only/common/utils/scale-utils.js +181 -0
- package/dist.webgl-only/common/utils/scale-utils.js.map +1 -0
- package/dist.webgl-only/contour-layer/bin-options-uniforms.js +18 -0
- package/dist.webgl-only/contour-layer/bin-options-uniforms.js.map +1 -0
- package/dist.webgl-only/contour-layer/contour-layer.js +282 -0
- package/dist.webgl-only/contour-layer/contour-layer.js.map +1 -0
- package/dist.webgl-only/contour-layer/contour-utils.js +60 -0
- package/dist.webgl-only/contour-layer/contour-utils.js.map +1 -0
- package/dist.webgl-only/contour-layer/marching-squares-codes.js +341 -0
- package/dist.webgl-only/contour-layer/marching-squares-codes.js.map +1 -0
- package/dist.webgl-only/contour-layer/marching-squares.js +151 -0
- package/dist.webgl-only/contour-layer/marching-squares.js.map +1 -0
- package/dist.webgl-only/contour-layer/value-reader.js +47 -0
- package/dist.webgl-only/contour-layer/value-reader.js.map +1 -0
- package/dist.webgl-only/grid-layer/bin-options-uniforms.js +18 -0
- package/dist.webgl-only/grid-layer/bin-options-uniforms.js.map +1 -0
- package/dist.webgl-only/grid-layer/grid-cell-layer-vertex.glsl.js +51 -0
- package/dist.webgl-only/grid-layer/grid-cell-layer-vertex.glsl.js.map +1 -0
- package/dist.webgl-only/grid-layer/grid-cell-layer.js +95 -0
- package/dist.webgl-only/grid-layer/grid-cell-layer.js.map +1 -0
- package/dist.webgl-only/grid-layer/grid-cell-layer.wgsl.js +5 -0
- package/dist.webgl-only/grid-layer/grid-cell-layer.wgsl.js.map +1 -0
- package/dist.webgl-only/grid-layer/grid-layer-uniforms.js +26 -0
- package/dist.webgl-only/grid-layer/grid-layer-uniforms.js.map +1 -0
- package/dist.webgl-only/grid-layer/grid-layer.js +362 -0
- package/dist.webgl-only/grid-layer/grid-layer.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/aggregation-layer.js +140 -0
- package/dist.webgl-only/heatmap-layer/aggregation-layer.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/heatmap-layer-uniforms.js +36 -0
- package/dist.webgl-only/heatmap-layer/heatmap-layer-uniforms.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/heatmap-layer-utils.js +67 -0
- package/dist.webgl-only/heatmap-layer/heatmap-layer-utils.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/heatmap-layer.js +513 -0
- package/dist.webgl-only/heatmap-layer/heatmap-layer.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/max-fs.glsl.js +13 -0
- package/dist.webgl-only/heatmap-layer/max-fs.glsl.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/max-vs.glsl.js +18 -0
- package/dist.webgl-only/heatmap-layer/max-vs.glsl.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/max.wgsl.js +5 -0
- package/dist.webgl-only/heatmap-layer/max.wgsl.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer-fragment.glsl.js +34 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer-fragment.glsl.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer-uniforms.js +25 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer-uniforms.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer-vertex.glsl.js +28 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer-vertex.glsl.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer.js +49 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer.wgsl.js +5 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer.wgsl.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/weights-fs.glsl.js +21 -0
- package/dist.webgl-only/heatmap-layer/weights-fs.glsl.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/weights-vs.glsl.js +21 -0
- package/dist.webgl-only/heatmap-layer/weights-vs.glsl.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/weights.wgsl.js +5 -0
- package/dist.webgl-only/heatmap-layer/weights.wgsl.js.map +1 -0
- package/dist.webgl-only/hexagon-layer/bin-options-uniforms.js +18 -0
- package/dist.webgl-only/hexagon-layer/bin-options-uniforms.js.map +1 -0
- package/dist.webgl-only/hexagon-layer/hexagon-cell-layer-vertex.glsl.js +55 -0
- package/dist.webgl-only/hexagon-layer/hexagon-cell-layer-vertex.glsl.js.map +1 -0
- package/dist.webgl-only/hexagon-layer/hexagon-cell-layer.js +90 -0
- package/dist.webgl-only/hexagon-layer/hexagon-cell-layer.js.map +1 -0
- package/dist.webgl-only/hexagon-layer/hexagon-cell-layer.wgsl.js +5 -0
- package/dist.webgl-only/hexagon-layer/hexagon-cell-layer.wgsl.js.map +1 -0
- package/dist.webgl-only/hexagon-layer/hexagon-layer-uniforms.js +24 -0
- package/dist.webgl-only/hexagon-layer/hexagon-layer-uniforms.js.map +1 -0
- package/dist.webgl-only/hexagon-layer/hexagon-layer.js +360 -0
- package/dist.webgl-only/hexagon-layer/hexagon-layer.js.map +1 -0
- package/dist.webgl-only/hexagon-layer/hexbin.js +70 -0
- package/dist.webgl-only/hexagon-layer/hexbin.js.map +1 -0
- package/dist.webgl-only/index.cjs +15625 -0
- package/dist.webgl-only/index.cjs.map +6 -0
- package/dist.webgl-only/index.js +11 -0
- package/dist.webgl-only/index.js.map +1 -0
- package/dist.webgl-only/screen-grid-layer/bin-options-uniforms.js +16 -0
- package/dist.webgl-only/screen-grid-layer/bin-options-uniforms.js.map +1 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-cell-layer.js +88 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-cell-layer.js.map +1 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-cell-layer.wgsl.js +5 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-cell-layer.wgsl.js.map +1 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-layer-fragment.glsl.js +16 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +1 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-layer-uniforms.js +22 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-layer-uniforms.js.map +1 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-layer-vertex.glsl.js +31 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +1 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-layer.js +194 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-layer.js.map +1 -0
- package/package.json +14 -5
- package/src/common/aggregator/gpu-aggregator/webgl-aggregation-transform.ts +1 -3
- package/src/common/aggregator/gpu-aggregator/webgl-bin-sorter.ts +0 -1
- package/src/grid-layer/grid-cell-layer.ts +3 -2
- package/src/grid-layer/grid-cell-layer.wgsl.ts +114 -0
- package/src/grid-layer/grid-layer-uniforms.ts +15 -0
- package/src/heatmap-layer/heatmap-layer-uniforms.ts +20 -0
- package/src/heatmap-layer/heatmap-layer.ts +67 -13
- package/src/heatmap-layer/max.wgsl.ts +48 -0
- package/src/heatmap-layer/triangle-layer-uniforms.ts +17 -0
- package/src/heatmap-layer/triangle-layer.ts +3 -2
- package/src/heatmap-layer/triangle-layer.wgsl.ts +65 -0
- package/src/heatmap-layer/weights.wgsl.ts +64 -0
- package/src/hexagon-layer/hexagon-cell-layer.ts +2 -3
- package/src/hexagon-layer/hexagon-cell-layer.wgsl.ts +120 -0
- package/src/hexagon-layer/hexagon-layer-uniforms.ts +14 -0
- package/src/screen-grid-layer/screen-grid-cell-layer.ts +4 -4
- package/src/screen-grid-layer/screen-grid-cell-layer.wgsl.ts +76 -0
- package/src/screen-grid-layer/screen-grid-layer-uniforms.ts +13 -0
package/dist/dist.dev.js
CHANGED
|
@@ -13,7 +13,11 @@ var __exports__ = (() => {
|
|
|
13
13
|
var __getProtoOf = Object.getPrototypeOf;
|
|
14
14
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
15
15
|
var __commonJS = (cb, mod) => function __require() {
|
|
16
|
-
|
|
16
|
+
try {
|
|
17
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
|
+
} catch (e) {
|
|
19
|
+
throw mod = 0, e;
|
|
20
|
+
}
|
|
17
21
|
};
|
|
18
22
|
var __export = (target, all) => {
|
|
19
23
|
for (var name in all)
|
|
@@ -192,10 +196,8 @@ var __exports__ = (() => {
|
|
|
192
196
|
for (let j = 0; j < bins.length; j++) {
|
|
193
197
|
const { points } = bins[j];
|
|
194
198
|
target[j] = operation(points, getValue);
|
|
195
|
-
if (target[j] < min2)
|
|
196
|
-
|
|
197
|
-
if (target[j] > max2)
|
|
198
|
-
max2 = target[j];
|
|
199
|
+
if (target[j] < min2) min2 = target[j];
|
|
200
|
+
if (target[j] > max2) max2 = target[j];
|
|
199
201
|
}
|
|
200
202
|
return { value: target, domain: [min2, max2] };
|
|
201
203
|
}
|
|
@@ -631,7 +633,6 @@ void main() {
|
|
|
631
633
|
const model = new import_engine.Model(device, {
|
|
632
634
|
bufferLayout: props.bufferLayout,
|
|
633
635
|
modules: [...props.modules || [], binSorterUniforms],
|
|
634
|
-
// @ts-expect-error TODO fix luma type
|
|
635
636
|
defines: { ...props.defines, NON_INSTANCED_MODEL: 1, NUM_CHANNELS: props.channelCount },
|
|
636
637
|
isInstanced: false,
|
|
637
638
|
vs,
|
|
@@ -745,6 +746,7 @@ void main() {
|
|
|
745
746
|
transform.run({
|
|
746
747
|
id: "gpu-aggregation-domain",
|
|
747
748
|
framebuffer: target,
|
|
749
|
+
discard: false,
|
|
748
750
|
parameters: {
|
|
749
751
|
viewport: [0, 0, 2, 1]
|
|
750
752
|
},
|
|
@@ -872,11 +874,8 @@ void main() {
|
|
|
872
874
|
blendAlphaOperation: "max"
|
|
873
875
|
},
|
|
874
876
|
defines: {
|
|
875
|
-
// @ts-expect-error TODO fix luma type
|
|
876
877
|
NUM_DIMS: props.dimensions,
|
|
877
|
-
// @ts-expect-error TODO fix luma type
|
|
878
878
|
NUM_CHANNELS: props.channelCount,
|
|
879
|
-
// @ts-expect-error TODO fix luma type
|
|
880
879
|
SAMPLER_WIDTH: TEXTURE_WIDTH
|
|
881
880
|
},
|
|
882
881
|
varyings: ["binIds", "values"],
|
|
@@ -1146,11 +1145,11 @@ void main() {
|
|
|
1146
1145
|
flatArray = new ArrayType(colorRange.length * 4);
|
|
1147
1146
|
let index = 0;
|
|
1148
1147
|
for (let i = 0; i < colorRange.length; i++) {
|
|
1149
|
-
const
|
|
1150
|
-
flatArray[index++] =
|
|
1151
|
-
flatArray[index++] =
|
|
1152
|
-
flatArray[index++] =
|
|
1153
|
-
flatArray[index++] = Number.isFinite(
|
|
1148
|
+
const color3 = colorRange[i];
|
|
1149
|
+
flatArray[index++] = color3[0];
|
|
1150
|
+
flatArray[index++] = color3[1];
|
|
1151
|
+
flatArray[index++] = color3[2];
|
|
1152
|
+
flatArray[index++] = Number.isFinite(color3[3]) ? color3[3] : 255;
|
|
1154
1153
|
}
|
|
1155
1154
|
}
|
|
1156
1155
|
if (normalize) {
|
|
@@ -1188,6 +1187,83 @@ void main() {
|
|
|
1188
1187
|
});
|
|
1189
1188
|
}
|
|
1190
1189
|
|
|
1190
|
+
// src/screen-grid-layer/screen-grid-cell-layer.wgsl.ts
|
|
1191
|
+
var screen_grid_cell_layer_wgsl_default = (
|
|
1192
|
+
/* wgsl */
|
|
1193
|
+
`
|
|
1194
|
+
struct Attributes {
|
|
1195
|
+
@builtin(instance_index) instanceIndex: u32,
|
|
1196
|
+
@location(0) positions: vec2<f32>,
|
|
1197
|
+
@location(1) instancePositions: vec2<f32>,
|
|
1198
|
+
@location(2) instanceWeights: f32,
|
|
1199
|
+
};
|
|
1200
|
+
|
|
1201
|
+
struct Varyings {
|
|
1202
|
+
@builtin(position) position: vec4<f32>,
|
|
1203
|
+
@location(0) color: vec4<f32>,
|
|
1204
|
+
@location(1) pickingColor: vec3<f32>,
|
|
1205
|
+
};
|
|
1206
|
+
|
|
1207
|
+
fn sampleColorRange(value: f32, domain: vec2<f32>) -> vec4<f32> {
|
|
1208
|
+
let ratio = (value - domain.x) / (domain.y - domain.x);
|
|
1209
|
+
return textureSampleLevel(colorRange, colorRangeSampler, vec2<f32>(ratio, 0.5), 0.0);
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
@vertex
|
|
1213
|
+
fn vertexMain(attributes: Attributes) -> Varyings {
|
|
1214
|
+
var output: Varyings;
|
|
1215
|
+
output.pickingColor = picking_getPickingColorFromIndex(attributes.instanceIndex);
|
|
1216
|
+
|
|
1217
|
+
if (attributes.instanceWeights != attributes.instanceWeights) {
|
|
1218
|
+
output.position = vec4<f32>(0.0);
|
|
1219
|
+
output.color = vec4<f32>(0.0);
|
|
1220
|
+
return output;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
var position =
|
|
1224
|
+
attributes.instancePositions * screenGrid.gridSizeClipspace +
|
|
1225
|
+
attributes.positions * screenGrid.cellSizeClipspace;
|
|
1226
|
+
position.x -= 1.0;
|
|
1227
|
+
position.y = 1.0 - position.y;
|
|
1228
|
+
|
|
1229
|
+
output.position = vec4<f32>(position, 0.0, 1.0);
|
|
1230
|
+
let colorValue = sampleColorRange(attributes.instanceWeights, screenGrid.colorDomain);
|
|
1231
|
+
output.color = vec4<f32>(colorValue.rgb, colorValue.a * layer.opacity);
|
|
1232
|
+
return output;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
@fragment
|
|
1236
|
+
fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {
|
|
1237
|
+
if (picking.isActive > 0.5) {
|
|
1238
|
+
if (!picking_isColorValid(varyings.pickingColor)) {
|
|
1239
|
+
discard;
|
|
1240
|
+
}
|
|
1241
|
+
return vec4<f32>(varyings.pickingColor, 1.0);
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
var color = varyings.color;
|
|
1245
|
+
if (picking.isHighlightActive > 0.5) {
|
|
1246
|
+
let highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor);
|
|
1247
|
+
if (picking_isColorZero(abs(varyings.pickingColor - highlightedObjectColor))) {
|
|
1248
|
+
let highLightAlpha = picking.highlightColor.a;
|
|
1249
|
+
let blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha);
|
|
1250
|
+
if (blendedAlpha > 0.0) {
|
|
1251
|
+
let highLightRatio = highLightAlpha / blendedAlpha;
|
|
1252
|
+
color = vec4<f32>(
|
|
1253
|
+
mix(color.rgb, picking.highlightColor.rgb, highLightRatio),
|
|
1254
|
+
blendedAlpha
|
|
1255
|
+
);
|
|
1256
|
+
} else {
|
|
1257
|
+
color = vec4<f32>(color.rgb, 0.0);
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
return deckgl_premultiplied_alpha(color);
|
|
1263
|
+
}
|
|
1264
|
+
`
|
|
1265
|
+
);
|
|
1266
|
+
|
|
1191
1267
|
// src/screen-grid-layer/screen-grid-layer-vertex.glsl.ts
|
|
1192
1268
|
var screen_grid_layer_vertex_glsl_default = (
|
|
1193
1269
|
/* glsl */
|
|
@@ -1250,6 +1326,20 @@ void main(void) {
|
|
|
1250
1326
|
);
|
|
1251
1327
|
|
|
1252
1328
|
// src/screen-grid-layer/screen-grid-layer-uniforms.ts
|
|
1329
|
+
var uniformBlockWGSL = (
|
|
1330
|
+
/* wgsl */
|
|
1331
|
+
`
|
|
1332
|
+
struct ScreenGridUniforms {
|
|
1333
|
+
cellSizeClipspace: vec2<f32>,
|
|
1334
|
+
gridSizeClipspace: vec2<f32>,
|
|
1335
|
+
colorDomain: vec2<f32>,
|
|
1336
|
+
};
|
|
1337
|
+
|
|
1338
|
+
@group(0) @binding(auto) var<uniform> screenGrid: ScreenGridUniforms;
|
|
1339
|
+
@group(0) @binding(auto) var colorRange: texture_2d<f32>;
|
|
1340
|
+
@group(0) @binding(auto) var colorRangeSampler: sampler;
|
|
1341
|
+
`
|
|
1342
|
+
);
|
|
1253
1343
|
var uniformBlock3 = (
|
|
1254
1344
|
/* glsl */
|
|
1255
1345
|
`layout(std140) uniform screenGridUniforms {
|
|
@@ -1261,6 +1351,7 @@ void main(void) {
|
|
|
1261
1351
|
);
|
|
1262
1352
|
var screenGridUniforms = {
|
|
1263
1353
|
name: "screenGrid",
|
|
1354
|
+
source: uniformBlockWGSL,
|
|
1264
1355
|
vs: uniformBlock3,
|
|
1265
1356
|
uniformTypes: {
|
|
1266
1357
|
cellSizeClipspace: "vec2<f32>",
|
|
@@ -1272,7 +1363,7 @@ void main(void) {
|
|
|
1272
1363
|
// src/screen-grid-layer/screen-grid-cell-layer.ts
|
|
1273
1364
|
var ScreenGridCellLayer = class extends import_core4.Layer {
|
|
1274
1365
|
getShaders() {
|
|
1275
|
-
return super.getShaders({ vs: screen_grid_layer_vertex_glsl_default, fs: screen_grid_layer_fragment_glsl_default, modules: [import_core4.picking, screenGridUniforms] });
|
|
1366
|
+
return super.getShaders({ source: screen_grid_cell_layer_wgsl_default, vs: screen_grid_layer_vertex_glsl_default, fs: screen_grid_layer_fragment_glsl_default, modules: [import_core4.color, import_core4.picking, screenGridUniforms] });
|
|
1276
1367
|
}
|
|
1277
1368
|
initializeState() {
|
|
1278
1369
|
this.getAttributeManager().addInstanced({
|
|
@@ -1740,6 +1831,126 @@ void main(void) {
|
|
|
1740
1831
|
// src/hexagon-layer/hexagon-cell-layer.ts
|
|
1741
1832
|
var import_layers2 = __toESM(require_layers(), 1);
|
|
1742
1833
|
|
|
1834
|
+
// src/hexagon-layer/hexagon-cell-layer.wgsl.ts
|
|
1835
|
+
var hexagon_cell_layer_wgsl_default = (
|
|
1836
|
+
/* wgsl */
|
|
1837
|
+
`const HEXBIN_DISTANCE: vec2<f32> = vec2<f32>(1.7320508, 1.5);
|
|
1838
|
+
|
|
1839
|
+
struct Attributes {
|
|
1840
|
+
@builtin(instance_index) instanceIndex: u32,
|
|
1841
|
+
@location(0) positions: vec3<f32>,
|
|
1842
|
+
@location(1) normals: vec3<f32>,
|
|
1843
|
+
@location(2) instancePositions: vec2<f32>,
|
|
1844
|
+
@location(3) instanceColorValues: f32,
|
|
1845
|
+
@location(4) instanceElevationValues: f32,
|
|
1846
|
+
};
|
|
1847
|
+
|
|
1848
|
+
struct Varyings {
|
|
1849
|
+
@builtin(position) position: vec4<f32>,
|
|
1850
|
+
@location(0) color: vec4<f32>,
|
|
1851
|
+
@location(1) pickingColor: vec3<f32>,
|
|
1852
|
+
};
|
|
1853
|
+
|
|
1854
|
+
fn hexbinCentroid(binId: vec2<f32>, radius: f32) -> vec2<f32> {
|
|
1855
|
+
var adjustedBinId = binId;
|
|
1856
|
+
adjustedBinId.x += fract(adjustedBinId.y * 0.5);
|
|
1857
|
+
return adjustedBinId * HEXBIN_DISTANCE * radius;
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
fn interpolate(value: f32, domain: vec2<f32>, range: vec2<f32>) -> f32 {
|
|
1861
|
+
let ratio = clamp((value - domain.x) / (domain.y - domain.x), 0.0, 1.0);
|
|
1862
|
+
return mix(range.x, range.y, ratio);
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
fn sampleColorRange(value: f32, domain: vec2<f32>) -> vec4<f32> {
|
|
1866
|
+
let ratio = (value - domain.x) / (domain.y - domain.x);
|
|
1867
|
+
return textureSampleLevel(colorRange, colorRangeSampler, vec2<f32>(ratio, 0.5), 0.0);
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
@vertex
|
|
1871
|
+
fn vertexMain(attributes: Attributes) -> Varyings {
|
|
1872
|
+
var output: Varyings;
|
|
1873
|
+
geometry.pickingColor = picking_getPickingColorFromIndex(attributes.instanceIndex);
|
|
1874
|
+
output.pickingColor = geometry.pickingColor;
|
|
1875
|
+
|
|
1876
|
+
if (
|
|
1877
|
+
attributes.instanceColorValues != attributes.instanceColorValues ||
|
|
1878
|
+
attributes.instanceColorValues < hexagon.colorDomain.z ||
|
|
1879
|
+
attributes.instanceColorValues > hexagon.colorDomain.w ||
|
|
1880
|
+
attributes.instanceElevationValues < hexagon.elevationDomain.z ||
|
|
1881
|
+
attributes.instanceElevationValues > hexagon.elevationDomain.w
|
|
1882
|
+
) {
|
|
1883
|
+
output.position = vec4<f32>(0.0);
|
|
1884
|
+
output.color = vec4<f32>(0.0);
|
|
1885
|
+
return output;
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
var commonPosition =
|
|
1889
|
+
hexbinCentroid(attributes.instancePositions, column.radius) +
|
|
1890
|
+
(hexagon.originCommon - project.commonOrigin.xy);
|
|
1891
|
+
commonPosition += attributes.positions.xy * column.radius * column.coverage;
|
|
1892
|
+
geometry.position = vec4<f32>(commonPosition, 0.0, 1.0);
|
|
1893
|
+
geometry.normal = project_normal(attributes.normals);
|
|
1894
|
+
|
|
1895
|
+
if (column.extruded > 0.5) {
|
|
1896
|
+
var elevation = interpolate(
|
|
1897
|
+
attributes.instanceElevationValues,
|
|
1898
|
+
hexagon.elevationDomain.xy,
|
|
1899
|
+
hexagon.elevationRange
|
|
1900
|
+
);
|
|
1901
|
+
elevation = project_size_float(elevation);
|
|
1902
|
+
geometry.position.z = (attributes.positions.z + 1.0) / 2.0 * elevation;
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
output.position = project_common_position_to_clipspace(geometry.position);
|
|
1906
|
+
var colorValue = sampleColorRange(attributes.instanceColorValues, hexagon.colorDomain.xy);
|
|
1907
|
+
if (column.extruded > 0.5) {
|
|
1908
|
+
colorValue = vec4<f32>(
|
|
1909
|
+
lighting_getLightColor2(
|
|
1910
|
+
colorValue.rgb,
|
|
1911
|
+
project.cameraPosition,
|
|
1912
|
+
geometry.position.xyz,
|
|
1913
|
+
geometry.normal
|
|
1914
|
+
),
|
|
1915
|
+
colorValue.a
|
|
1916
|
+
);
|
|
1917
|
+
}
|
|
1918
|
+
output.color = vec4<f32>(colorValue.rgb, colorValue.a * layer.opacity);
|
|
1919
|
+
return output;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
@fragment
|
|
1923
|
+
fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {
|
|
1924
|
+
if (picking.isActive > 0.5) {
|
|
1925
|
+
if (!picking_isColorValid(varyings.pickingColor)) {
|
|
1926
|
+
discard;
|
|
1927
|
+
}
|
|
1928
|
+
return vec4<f32>(varyings.pickingColor, 1.0);
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
var color = varyings.color;
|
|
1932
|
+
if (picking.isHighlightActive > 0.5) {
|
|
1933
|
+
let highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor);
|
|
1934
|
+
if (picking_isColorZero(abs(varyings.pickingColor - highlightedObjectColor))) {
|
|
1935
|
+
let highLightAlpha = picking.highlightColor.a;
|
|
1936
|
+
let blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha);
|
|
1937
|
+
if (blendedAlpha > 0.0) {
|
|
1938
|
+
let highLightRatio = highLightAlpha / blendedAlpha;
|
|
1939
|
+
color = vec4<f32>(
|
|
1940
|
+
mix(color.rgb, picking.highlightColor.rgb, highLightRatio),
|
|
1941
|
+
blendedAlpha
|
|
1942
|
+
);
|
|
1943
|
+
} else {
|
|
1944
|
+
color = vec4<f32>(color.rgb, 0.0);
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
return deckgl_premultiplied_alpha(color);
|
|
1950
|
+
}
|
|
1951
|
+
`
|
|
1952
|
+
);
|
|
1953
|
+
|
|
1743
1954
|
// src/hexagon-layer/hexbin.ts
|
|
1744
1955
|
var THIRD_PI = Math.PI / 3;
|
|
1745
1956
|
var DIST_X = 2 * Math.sin(THIRD_PI);
|
|
@@ -1874,6 +2085,20 @@ void main(void) {
|
|
|
1874
2085
|
);
|
|
1875
2086
|
|
|
1876
2087
|
// src/hexagon-layer/hexagon-layer-uniforms.ts
|
|
2088
|
+
var uniformBlockWGSL2 = (
|
|
2089
|
+
/* wgsl */
|
|
2090
|
+
`struct HexagonUniforms {
|
|
2091
|
+
colorDomain: vec4<f32>,
|
|
2092
|
+
elevationDomain: vec4<f32>,
|
|
2093
|
+
elevationRange: vec2<f32>,
|
|
2094
|
+
originCommon: vec2<f32>,
|
|
2095
|
+
};
|
|
2096
|
+
|
|
2097
|
+
@group(0) @binding(auto) var<uniform> hexagon: HexagonUniforms;
|
|
2098
|
+
@group(0) @binding(auto) var colorRange: texture_2d<f32>;
|
|
2099
|
+
@group(0) @binding(auto) var colorRangeSampler: sampler;
|
|
2100
|
+
`
|
|
2101
|
+
);
|
|
1877
2102
|
var uniformBlock5 = (
|
|
1878
2103
|
/* glsl */
|
|
1879
2104
|
`layout(std140) uniform hexagonUniforms {
|
|
@@ -1886,6 +2111,7 @@ void main(void) {
|
|
|
1886
2111
|
);
|
|
1887
2112
|
var hexagonUniforms = {
|
|
1888
2113
|
name: "hexagon",
|
|
2114
|
+
source: uniformBlockWGSL2,
|
|
1889
2115
|
vs: uniformBlock5,
|
|
1890
2116
|
uniformTypes: {
|
|
1891
2117
|
colorDomain: "vec4<f32>",
|
|
@@ -1900,7 +2126,7 @@ void main(void) {
|
|
|
1900
2126
|
getShaders() {
|
|
1901
2127
|
const shaders = super.getShaders();
|
|
1902
2128
|
shaders.modules.push(hexagonUniforms);
|
|
1903
|
-
return { ...shaders, vs: hexagon_cell_layer_vertex_glsl_default };
|
|
2129
|
+
return { ...shaders, source: hexagon_cell_layer_wgsl_default, vs: hexagon_cell_layer_vertex_glsl_default };
|
|
1904
2130
|
}
|
|
1905
2131
|
initializeState() {
|
|
1906
2132
|
super.initializeState();
|
|
@@ -1964,7 +2190,6 @@ void main(void) {
|
|
|
1964
2190
|
const colorCutoff = this.props.colorCutoff || [-Infinity, Infinity];
|
|
1965
2191
|
const elevationCutoff = this.props.elevationCutoff || [-Infinity, Infinity];
|
|
1966
2192
|
const fillModel = this.state.fillModel;
|
|
1967
|
-
fillModel.setVertexCount(this.state.fillVertexCount);
|
|
1968
2193
|
const hexagonProps = {
|
|
1969
2194
|
colorDomain: [
|
|
1970
2195
|
Math.max(colorDomain[0], colorCutoff[0]),
|
|
@@ -3233,7 +3458,7 @@ void main(void) {
|
|
|
3233
3458
|
out[1] = m[1] * x + m[5] * y + m[13];
|
|
3234
3459
|
return out;
|
|
3235
3460
|
}
|
|
3236
|
-
var forEach = function() {
|
|
3461
|
+
var forEach = (function() {
|
|
3237
3462
|
const vec = create();
|
|
3238
3463
|
return function(a, stride, offset, count2, fn, arg) {
|
|
3239
3464
|
let i;
|
|
@@ -3258,7 +3483,7 @@ void main(void) {
|
|
|
3258
3483
|
}
|
|
3259
3484
|
return a;
|
|
3260
3485
|
};
|
|
3261
|
-
}();
|
|
3486
|
+
})();
|
|
3262
3487
|
|
|
3263
3488
|
// ../../node_modules/@math.gl/core/dist/lib/gl-matrix-extras.js
|
|
3264
3489
|
function vec2_transformMat4AsVector(out, a, m) {
|
|
@@ -3301,7 +3526,7 @@ void main(void) {
|
|
|
3301
3526
|
out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
|
|
3302
3527
|
return out;
|
|
3303
3528
|
}
|
|
3304
|
-
var forEach2 = function() {
|
|
3529
|
+
var forEach2 = (function() {
|
|
3305
3530
|
const vec = create2();
|
|
3306
3531
|
return function(a, stride, offset, count2, fn, arg) {
|
|
3307
3532
|
let i;
|
|
@@ -3328,7 +3553,7 @@ void main(void) {
|
|
|
3328
3553
|
}
|
|
3329
3554
|
return a;
|
|
3330
3555
|
};
|
|
3331
|
-
}();
|
|
3556
|
+
})();
|
|
3332
3557
|
|
|
3333
3558
|
// ../../node_modules/@math.gl/core/dist/classes/base/matrix.js
|
|
3334
3559
|
var Matrix = class extends MathArray {
|
|
@@ -4034,7 +4259,7 @@ void main(void) {
|
|
|
4034
4259
|
out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;
|
|
4035
4260
|
return out;
|
|
4036
4261
|
}
|
|
4037
|
-
var forEach3 = function() {
|
|
4262
|
+
var forEach3 = (function() {
|
|
4038
4263
|
const vec = create3();
|
|
4039
4264
|
return function(a, stride, offset, count2, fn, arg) {
|
|
4040
4265
|
let i;
|
|
@@ -4063,7 +4288,7 @@ void main(void) {
|
|
|
4063
4288
|
}
|
|
4064
4289
|
return a;
|
|
4065
4290
|
};
|
|
4066
|
-
}();
|
|
4291
|
+
})();
|
|
4067
4292
|
|
|
4068
4293
|
// ../../node_modules/@math.gl/core/dist/classes/matrix4.js
|
|
4069
4294
|
var INDICES;
|
|
@@ -4859,6 +5084,120 @@ void main(void) {
|
|
|
4859
5084
|
var import_layers4 = __toESM(require_layers(), 1);
|
|
4860
5085
|
var import_engine4 = __toESM(require_engine(), 1);
|
|
4861
5086
|
|
|
5087
|
+
// src/grid-layer/grid-cell-layer.wgsl.ts
|
|
5088
|
+
var grid_cell_layer_wgsl_default = (
|
|
5089
|
+
/* wgsl */
|
|
5090
|
+
`struct Attributes {
|
|
5091
|
+
@builtin(instance_index) instanceIndex: u32,
|
|
5092
|
+
@location(0) positions: vec3<f32>,
|
|
5093
|
+
@location(1) normals: vec3<f32>,
|
|
5094
|
+
@location(2) instancePositions: vec2<f32>,
|
|
5095
|
+
@location(3) instanceColorValues: f32,
|
|
5096
|
+
@location(4) instanceElevationValues: f32,
|
|
5097
|
+
};
|
|
5098
|
+
|
|
5099
|
+
struct Varyings {
|
|
5100
|
+
@builtin(position) position: vec4<f32>,
|
|
5101
|
+
@location(0) color: vec4<f32>,
|
|
5102
|
+
@location(1) pickingColor: vec3<f32>,
|
|
5103
|
+
};
|
|
5104
|
+
|
|
5105
|
+
fn interpolate(value: f32, domain: vec2<f32>, range: vec2<f32>) -> f32 {
|
|
5106
|
+
let ratio = clamp((value - domain.x) / (domain.y - domain.x), 0.0, 1.0);
|
|
5107
|
+
return mix(range.x, range.y, ratio);
|
|
5108
|
+
}
|
|
5109
|
+
|
|
5110
|
+
fn sampleColorRange(value: f32, domain: vec2<f32>) -> vec4<f32> {
|
|
5111
|
+
let ratio = (value - domain.x) / (domain.y - domain.x);
|
|
5112
|
+
return textureSampleLevel(colorRange, colorRangeSampler, vec2<f32>(ratio, 0.5), 0.0);
|
|
5113
|
+
}
|
|
5114
|
+
|
|
5115
|
+
@vertex
|
|
5116
|
+
fn vertexMain(attributes: Attributes) -> Varyings {
|
|
5117
|
+
var output: Varyings;
|
|
5118
|
+
geometry.pickingColor = picking_getPickingColorFromIndex(attributes.instanceIndex);
|
|
5119
|
+
output.pickingColor = geometry.pickingColor;
|
|
5120
|
+
|
|
5121
|
+
if (
|
|
5122
|
+
attributes.instanceColorValues != attributes.instanceColorValues ||
|
|
5123
|
+
attributes.instanceColorValues < grid.colorDomain.z ||
|
|
5124
|
+
attributes.instanceColorValues > grid.colorDomain.w ||
|
|
5125
|
+
attributes.instanceElevationValues < grid.elevationDomain.z ||
|
|
5126
|
+
attributes.instanceElevationValues > grid.elevationDomain.w
|
|
5127
|
+
) {
|
|
5128
|
+
output.position = vec4<f32>(0.0);
|
|
5129
|
+
output.color = vec4<f32>(0.0);
|
|
5130
|
+
return output;
|
|
5131
|
+
}
|
|
5132
|
+
|
|
5133
|
+
let commonPosition =
|
|
5134
|
+
(attributes.instancePositions +
|
|
5135
|
+
(attributes.positions.xy + vec2<f32>(1.0)) * 0.5 * column.coverage) *
|
|
5136
|
+
grid.sizeCommon +
|
|
5137
|
+
grid.originCommon -
|
|
5138
|
+
project.commonOrigin.xy;
|
|
5139
|
+
geometry.position = vec4<f32>(commonPosition, 0.0, 1.0);
|
|
5140
|
+
geometry.normal = project_normal(attributes.normals);
|
|
5141
|
+
|
|
5142
|
+
if (column.extruded > 0.5) {
|
|
5143
|
+
var elevation = interpolate(
|
|
5144
|
+
attributes.instanceElevationValues,
|
|
5145
|
+
grid.elevationDomain.xy,
|
|
5146
|
+
grid.elevationRange
|
|
5147
|
+
);
|
|
5148
|
+
elevation = project_size_float(elevation);
|
|
5149
|
+
geometry.position.z = (attributes.positions.z + 1.0) * 0.5 * elevation;
|
|
5150
|
+
}
|
|
5151
|
+
|
|
5152
|
+
output.position = project_common_position_to_clipspace(geometry.position);
|
|
5153
|
+
var colorValue = sampleColorRange(attributes.instanceColorValues, grid.colorDomain.xy);
|
|
5154
|
+
if (column.extruded > 0.5) {
|
|
5155
|
+
colorValue = vec4<f32>(
|
|
5156
|
+
lighting_getLightColor2(
|
|
5157
|
+
colorValue.rgb,
|
|
5158
|
+
project.cameraPosition,
|
|
5159
|
+
geometry.position.xyz,
|
|
5160
|
+
geometry.normal
|
|
5161
|
+
),
|
|
5162
|
+
colorValue.a
|
|
5163
|
+
);
|
|
5164
|
+
}
|
|
5165
|
+
output.color = vec4<f32>(colorValue.rgb, colorValue.a * layer.opacity);
|
|
5166
|
+
return output;
|
|
5167
|
+
}
|
|
5168
|
+
|
|
5169
|
+
@fragment
|
|
5170
|
+
fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {
|
|
5171
|
+
if (picking.isActive > 0.5) {
|
|
5172
|
+
if (!picking_isColorValid(varyings.pickingColor)) {
|
|
5173
|
+
discard;
|
|
5174
|
+
}
|
|
5175
|
+
return vec4<f32>(varyings.pickingColor, 1.0);
|
|
5176
|
+
}
|
|
5177
|
+
|
|
5178
|
+
var color = varyings.color;
|
|
5179
|
+
if (picking.isHighlightActive > 0.5) {
|
|
5180
|
+
let highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor);
|
|
5181
|
+
if (picking_isColorZero(abs(varyings.pickingColor - highlightedObjectColor))) {
|
|
5182
|
+
let highlightAlpha = picking.highlightColor.a;
|
|
5183
|
+
let blendedAlpha = highlightAlpha + color.a * (1.0 - highlightAlpha);
|
|
5184
|
+
if (blendedAlpha > 0.0) {
|
|
5185
|
+
let highlightRatio = highlightAlpha / blendedAlpha;
|
|
5186
|
+
color = vec4<f32>(
|
|
5187
|
+
mix(color.rgb, picking.highlightColor.rgb, highlightRatio),
|
|
5188
|
+
blendedAlpha
|
|
5189
|
+
);
|
|
5190
|
+
} else {
|
|
5191
|
+
color = vec4<f32>(color.rgb, 0.0);
|
|
5192
|
+
}
|
|
5193
|
+
}
|
|
5194
|
+
}
|
|
5195
|
+
|
|
5196
|
+
return deckgl_premultiplied_alpha(color);
|
|
5197
|
+
}
|
|
5198
|
+
`
|
|
5199
|
+
);
|
|
5200
|
+
|
|
4862
5201
|
// src/grid-layer/grid-cell-layer-vertex.glsl.ts
|
|
4863
5202
|
var grid_cell_layer_vertex_glsl_default = (
|
|
4864
5203
|
/* glsl */
|
|
@@ -4928,6 +5267,21 @@ void main(void) {
|
|
|
4928
5267
|
);
|
|
4929
5268
|
|
|
4930
5269
|
// src/grid-layer/grid-layer-uniforms.ts
|
|
5270
|
+
var uniformBlockWGSL3 = (
|
|
5271
|
+
/* wgsl */
|
|
5272
|
+
`struct gridUniforms {
|
|
5273
|
+
colorDomain: vec4<f32>,
|
|
5274
|
+
elevationDomain: vec4<f32>,
|
|
5275
|
+
elevationRange: vec2<f32>,
|
|
5276
|
+
originCommon: vec2<f32>,
|
|
5277
|
+
sizeCommon: vec2<f32>,
|
|
5278
|
+
};
|
|
5279
|
+
|
|
5280
|
+
@group(0) @binding(auto) var<uniform> grid: gridUniforms;
|
|
5281
|
+
@group(0) @binding(auto) var colorRange: texture_2d<f32>;
|
|
5282
|
+
@group(0) @binding(auto) var colorRangeSampler: sampler;
|
|
5283
|
+
`
|
|
5284
|
+
);
|
|
4931
5285
|
var uniformBlock8 = (
|
|
4932
5286
|
/* glsl */
|
|
4933
5287
|
`layout(std140) uniform gridUniforms {
|
|
@@ -4941,6 +5295,7 @@ void main(void) {
|
|
|
4941
5295
|
);
|
|
4942
5296
|
var gridUniforms = {
|
|
4943
5297
|
name: "grid",
|
|
5298
|
+
source: uniformBlockWGSL3,
|
|
4944
5299
|
vs: uniformBlock8,
|
|
4945
5300
|
uniformTypes: {
|
|
4946
5301
|
colorDomain: "vec4<f32>",
|
|
@@ -4956,7 +5311,7 @@ void main(void) {
|
|
|
4956
5311
|
getShaders() {
|
|
4957
5312
|
const shaders = super.getShaders();
|
|
4958
5313
|
shaders.modules.push(gridUniforms);
|
|
4959
|
-
return { ...shaders, vs: grid_cell_layer_vertex_glsl_default };
|
|
5314
|
+
return { ...shaders, source: grid_cell_layer_wgsl_default, vs: grid_cell_layer_vertex_glsl_default };
|
|
4960
5315
|
}
|
|
4961
5316
|
initializeState() {
|
|
4962
5317
|
super.initializeState();
|
|
@@ -5008,7 +5363,7 @@ void main(void) {
|
|
|
5008
5363
|
}
|
|
5009
5364
|
_updateGeometry() {
|
|
5010
5365
|
const geometry = new import_engine4.CubeGeometry();
|
|
5011
|
-
this.
|
|
5366
|
+
this._setFillGeometry(geometry);
|
|
5012
5367
|
}
|
|
5013
5368
|
draw({ uniforms }) {
|
|
5014
5369
|
const {
|
|
@@ -5494,6 +5849,71 @@ void main(void) {
|
|
|
5494
5849
|
var import_engine5 = __toESM(require_engine(), 1);
|
|
5495
5850
|
var import_core10 = __toESM(require_core(), 1);
|
|
5496
5851
|
|
|
5852
|
+
// src/heatmap-layer/triangle-layer.wgsl.ts
|
|
5853
|
+
var triangle_layer_wgsl_default = (
|
|
5854
|
+
/* wgsl */
|
|
5855
|
+
`struct TriangleAttributes {
|
|
5856
|
+
@location(0) positions: vec3<f32>,
|
|
5857
|
+
@location(1) texCoords: vec2<f32>,
|
|
5858
|
+
};
|
|
5859
|
+
|
|
5860
|
+
struct TriangleVaryings {
|
|
5861
|
+
@builtin(position) position: vec4<f32>,
|
|
5862
|
+
@location(0) textureCoordinates: vec2<f32>,
|
|
5863
|
+
@location(1) intensityMinimum: f32,
|
|
5864
|
+
@location(2) intensityMaximum: f32,
|
|
5865
|
+
};
|
|
5866
|
+
|
|
5867
|
+
@vertex
|
|
5868
|
+
fn vertexMain(attributes: TriangleAttributes) -> TriangleVaryings {
|
|
5869
|
+
var output: TriangleVaryings;
|
|
5870
|
+
output.position = project_position_to_clipspace(
|
|
5871
|
+
attributes.positions,
|
|
5872
|
+
vec3<f32>(0.0),
|
|
5873
|
+
vec3<f32>(0.0)
|
|
5874
|
+
);
|
|
5875
|
+
// WebGPU render-target textures use a top-left origin.
|
|
5876
|
+
output.textureCoordinates = vec2<f32>(attributes.texCoords.x, 1.0 - attributes.texCoords.y);
|
|
5877
|
+
|
|
5878
|
+
let maxWeights = textureLoad(maxTexture, vec2<i32>(0), 0);
|
|
5879
|
+
var maximumValue = select(maxWeights.r, maxWeights.g, triangle.aggregationMode > 0.5);
|
|
5880
|
+
var minimumValue = maximumValue * triangle.threshold;
|
|
5881
|
+
|
|
5882
|
+
if (triangle.colorDomain.y > 0.0) {
|
|
5883
|
+
maximumValue = triangle.colorDomain.y;
|
|
5884
|
+
minimumValue = triangle.colorDomain.x;
|
|
5885
|
+
}
|
|
5886
|
+
|
|
5887
|
+
output.intensityMaximum = triangle.intensity / maximumValue;
|
|
5888
|
+
output.intensityMinimum = triangle.intensity / minimumValue;
|
|
5889
|
+
return output;
|
|
5890
|
+
}
|
|
5891
|
+
|
|
5892
|
+
@fragment
|
|
5893
|
+
fn fragmentMain(varyings: TriangleVaryings) -> @location(0) vec4<f32> {
|
|
5894
|
+
let weights = textureSample(weightsTexture, weightsTextureSampler, varyings.textureCoordinates);
|
|
5895
|
+
var weight = weights.r;
|
|
5896
|
+
|
|
5897
|
+
if (triangle.aggregationMode > 0.5) {
|
|
5898
|
+
weight /= max(1.0, weights.a);
|
|
5899
|
+
}
|
|
5900
|
+
|
|
5901
|
+
let colorCoordinates = vec2<f32>(
|
|
5902
|
+
clamp(weight * varyings.intensityMaximum, 0.0, 1.0),
|
|
5903
|
+
0.5
|
|
5904
|
+
);
|
|
5905
|
+
var color = textureSample(colorTexture, colorTextureSampler, colorCoordinates);
|
|
5906
|
+
|
|
5907
|
+
if (weight <= 0.0) {
|
|
5908
|
+
discard;
|
|
5909
|
+
}
|
|
5910
|
+
|
|
5911
|
+
color.a *= min(weight * varyings.intensityMinimum, 1.0) * layer.opacity;
|
|
5912
|
+
return deckgl_premultiplied_alpha(color);
|
|
5913
|
+
}
|
|
5914
|
+
`
|
|
5915
|
+
);
|
|
5916
|
+
|
|
5497
5917
|
// src/heatmap-layer/triangle-layer-vertex.glsl.ts
|
|
5498
5918
|
var triangle_layer_vertex_glsl_default = `#version 300 es
|
|
5499
5919
|
#define SHADER_NAME heatp-map-layer-vertex-shader
|
|
@@ -5565,6 +5985,23 @@ void main(void) {
|
|
|
5565
5985
|
`;
|
|
5566
5986
|
|
|
5567
5987
|
// src/heatmap-layer/triangle-layer-uniforms.ts
|
|
5988
|
+
var uniformBlockWGSL4 = (
|
|
5989
|
+
/* wgsl */
|
|
5990
|
+
`struct triangleUniforms {
|
|
5991
|
+
aggregationMode: f32,
|
|
5992
|
+
colorDomain: vec2<f32>,
|
|
5993
|
+
intensity: f32,
|
|
5994
|
+
threshold: f32,
|
|
5995
|
+
};
|
|
5996
|
+
|
|
5997
|
+
@group(0) @binding(auto) var<uniform> triangle: triangleUniforms;
|
|
5998
|
+
@group(0) @binding(auto) var colorTexture: texture_2d<f32>;
|
|
5999
|
+
@group(0) @binding(auto) var colorTextureSampler: sampler;
|
|
6000
|
+
@group(0) @binding(auto) var maxTexture: texture_2d<f32>;
|
|
6001
|
+
@group(0) @binding(auto) var weightsTexture: texture_2d<f32>;
|
|
6002
|
+
@group(0) @binding(auto) var weightsTextureSampler: sampler;
|
|
6003
|
+
`
|
|
6004
|
+
);
|
|
5568
6005
|
var uniformBlock10 = `layout(std140) uniform triangleUniforms {
|
|
5569
6006
|
float aggregationMode;
|
|
5570
6007
|
vec2 colorDomain;
|
|
@@ -5574,6 +6011,7 @@ void main(void) {
|
|
|
5574
6011
|
`;
|
|
5575
6012
|
var triangleUniforms = {
|
|
5576
6013
|
name: "triangle",
|
|
6014
|
+
source: uniformBlockWGSL4,
|
|
5577
6015
|
vs: uniformBlock10,
|
|
5578
6016
|
fs: uniformBlock10,
|
|
5579
6017
|
uniformTypes: {
|
|
@@ -5587,7 +6025,7 @@ void main(void) {
|
|
|
5587
6025
|
// src/heatmap-layer/triangle-layer.ts
|
|
5588
6026
|
var TriangleLayer = class extends import_core10.Layer {
|
|
5589
6027
|
getShaders() {
|
|
5590
|
-
return super.getShaders({ vs: triangle_layer_vertex_glsl_default, fs: triangle_layer_fragment_glsl_default, modules: [import_core10.project32, triangleUniforms] });
|
|
6028
|
+
return super.getShaders({ source: triangle_layer_wgsl_default, vs: triangle_layer_vertex_glsl_default, fs: triangle_layer_fragment_glsl_default, modules: [import_core10.project32, import_core10.color, triangleUniforms] });
|
|
5591
6029
|
}
|
|
5592
6030
|
initializeState({ device }) {
|
|
5593
6031
|
this.setState({ model: this._getModel(device) });
|
|
@@ -5840,7 +6278,131 @@ void main() {
|
|
|
5840
6278
|
}
|
|
5841
6279
|
`;
|
|
5842
6280
|
|
|
6281
|
+
// src/heatmap-layer/max.wgsl.ts
|
|
6282
|
+
var max_wgsl_default = (
|
|
6283
|
+
/* wgsl */
|
|
6284
|
+
`struct MaxWeightVaryings {
|
|
6285
|
+
@builtin(position) position: vec4<f32>,
|
|
6286
|
+
@location(0) weights: vec4<f32>,
|
|
6287
|
+
};
|
|
6288
|
+
|
|
6289
|
+
const MAX_WEIGHT_REDUCTION_SIZE: u32 = 16u;
|
|
6290
|
+
|
|
6291
|
+
@vertex
|
|
6292
|
+
fn vertexMain(@builtin(vertex_index) vertexIndex: u32) -> MaxWeightVaryings {
|
|
6293
|
+
var output: MaxWeightVaryings;
|
|
6294
|
+
let textureSize = u32(maxWeight.textureSize);
|
|
6295
|
+
let reducedTextureSize =
|
|
6296
|
+
(textureSize + MAX_WEIGHT_REDUCTION_SIZE - 1u) / MAX_WEIGHT_REDUCTION_SIZE;
|
|
6297
|
+
let blockCoordinates = vec2<u32>(
|
|
6298
|
+
vertexIndex % reducedTextureSize,
|
|
6299
|
+
vertexIndex / reducedTextureSize
|
|
6300
|
+
);
|
|
6301
|
+
var maximumWeights = vec4<f32>(0.0);
|
|
6302
|
+
|
|
6303
|
+
for (var y = 0u; y < MAX_WEIGHT_REDUCTION_SIZE; y++) {
|
|
6304
|
+
for (var x = 0u; x < MAX_WEIGHT_REDUCTION_SIZE; x++) {
|
|
6305
|
+
let textureCoordinates = blockCoordinates * MAX_WEIGHT_REDUCTION_SIZE + vec2<u32>(x, y);
|
|
6306
|
+
|
|
6307
|
+
if (textureCoordinates.x < textureSize && textureCoordinates.y < textureSize) {
|
|
6308
|
+
let weights = textureLoad(inTexture, vec2<i32>(textureCoordinates), 0);
|
|
6309
|
+
maximumWeights.r = max(maximumWeights.r, weights.r);
|
|
6310
|
+
maximumWeights.g = max(maximumWeights.g, weights.r / max(1.0, weights.a));
|
|
6311
|
+
maximumWeights.b = max(maximumWeights.b, weights.b);
|
|
6312
|
+
maximumWeights.a = max(maximumWeights.a, weights.a);
|
|
6313
|
+
}
|
|
6314
|
+
}
|
|
6315
|
+
}
|
|
6316
|
+
|
|
6317
|
+
output.position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
|
6318
|
+
output.weights = maximumWeights;
|
|
6319
|
+
return output;
|
|
6320
|
+
}
|
|
6321
|
+
|
|
6322
|
+
@fragment
|
|
6323
|
+
fn fragmentMain(varyings: MaxWeightVaryings) -> @location(0) vec4<f32> {
|
|
6324
|
+
return varyings.weights;
|
|
6325
|
+
}
|
|
6326
|
+
`
|
|
6327
|
+
);
|
|
6328
|
+
|
|
6329
|
+
// src/heatmap-layer/weights.wgsl.ts
|
|
6330
|
+
var weights_wgsl_default = (
|
|
6331
|
+
/* wgsl */
|
|
6332
|
+
`struct WeightAttributes {
|
|
6333
|
+
@builtin(vertex_index) vertexIndex: u32,
|
|
6334
|
+
@location(0) instancePositions: vec3<f32>,
|
|
6335
|
+
@location(1) instancePositions64Low: vec3<f32>,
|
|
6336
|
+
@location(2) instanceWeights: f32,
|
|
6337
|
+
};
|
|
6338
|
+
|
|
6339
|
+
struct WeightVaryings {
|
|
6340
|
+
@builtin(position) position: vec4<f32>,
|
|
6341
|
+
@location(0) pointCoordinates: vec2<f32>,
|
|
6342
|
+
@location(1) weights: vec4<f32>,
|
|
6343
|
+
};
|
|
6344
|
+
|
|
6345
|
+
const WEIGHT_QUAD_POSITIONS = array<vec2<f32>, 6>(
|
|
6346
|
+
vec2<f32>(-1.0, -1.0),
|
|
6347
|
+
vec2<f32>(1.0, -1.0),
|
|
6348
|
+
vec2<f32>(-1.0, 1.0),
|
|
6349
|
+
vec2<f32>(-1.0, 1.0),
|
|
6350
|
+
vec2<f32>(1.0, -1.0),
|
|
6351
|
+
vec2<f32>(1.0, 1.0)
|
|
6352
|
+
);
|
|
6353
|
+
|
|
6354
|
+
@vertex
|
|
6355
|
+
fn vertexMain(attributes: WeightAttributes) -> WeightVaryings {
|
|
6356
|
+
var output: WeightVaryings;
|
|
6357
|
+
let commonPosition = project_position_vec3_f64(
|
|
6358
|
+
attributes.instancePositions,
|
|
6359
|
+
attributes.instancePositions64Low
|
|
6360
|
+
);
|
|
6361
|
+
let clipPosition =
|
|
6362
|
+
(commonPosition.xy - weight.commonBounds.xy) /
|
|
6363
|
+
(weight.commonBounds.zw - weight.commonBounds.xy) * 2.0 - vec2<f32>(1.0);
|
|
6364
|
+
let radiusTexels =
|
|
6365
|
+
project_pixel_size_float(weight.radiusPixels) * weight.textureWidth /
|
|
6366
|
+
(weight.commonBounds.z - weight.commonBounds.x);
|
|
6367
|
+
let offset = WEIGHT_QUAD_POSITIONS[attributes.vertexIndex];
|
|
6368
|
+
|
|
6369
|
+
output.position = vec4<f32>(
|
|
6370
|
+
clipPosition + offset * radiusTexels * 2.0 / weight.textureWidth,
|
|
6371
|
+
0.0,
|
|
6372
|
+
1.0
|
|
6373
|
+
);
|
|
6374
|
+
output.pointCoordinates = (offset + vec2<f32>(1.0)) * 0.5;
|
|
6375
|
+
output.weights = vec4<f32>(attributes.instanceWeights * weight.weightsScale, 0.0, 0.0, 1.0);
|
|
6376
|
+
return output;
|
|
6377
|
+
}
|
|
6378
|
+
|
|
6379
|
+
@fragment
|
|
6380
|
+
fn fragmentMain(varyings: WeightVaryings) -> @location(0) vec4<f32> {
|
|
6381
|
+
let distanceFromCenter = length(varyings.pointCoordinates - vec2<f32>(0.5));
|
|
6382
|
+
if (distanceFromCenter > 0.5) {
|
|
6383
|
+
discard;
|
|
6384
|
+
}
|
|
6385
|
+
|
|
6386
|
+
let gaussian = exp(-pow(2.0 * distanceFromCenter, 2.0) / 0.05555) /
|
|
6387
|
+
(1.77245385 * 0.166666);
|
|
6388
|
+
return varyings.weights * gaussian;
|
|
6389
|
+
}
|
|
6390
|
+
`
|
|
6391
|
+
);
|
|
6392
|
+
|
|
5843
6393
|
// src/heatmap-layer/heatmap-layer-uniforms.ts
|
|
6394
|
+
var uniformBlockWGSL5 = (
|
|
6395
|
+
/* wgsl */
|
|
6396
|
+
`struct weightUniforms {
|
|
6397
|
+
commonBounds: vec4<f32>,
|
|
6398
|
+
radiusPixels: f32,
|
|
6399
|
+
textureWidth: f32,
|
|
6400
|
+
weightsScale: f32,
|
|
6401
|
+
};
|
|
6402
|
+
|
|
6403
|
+
@group(0) @binding(auto) var<uniform> weight: weightUniforms;
|
|
6404
|
+
`
|
|
6405
|
+
);
|
|
5844
6406
|
var uniformBlock11 = `layout(std140) uniform weightUniforms {
|
|
5845
6407
|
vec4 commonBounds;
|
|
5846
6408
|
float radiusPixels;
|
|
@@ -5850,6 +6412,7 @@ void main() {
|
|
|
5850
6412
|
`;
|
|
5851
6413
|
var weightUniforms = {
|
|
5852
6414
|
name: "weight",
|
|
6415
|
+
source: uniformBlockWGSL5,
|
|
5853
6416
|
vs: uniformBlock11,
|
|
5854
6417
|
uniformTypes: {
|
|
5855
6418
|
commonBounds: "vec4<f32>",
|
|
@@ -5860,6 +6423,16 @@ void main() {
|
|
|
5860
6423
|
};
|
|
5861
6424
|
var maxWeightUniforms = {
|
|
5862
6425
|
name: "maxWeight",
|
|
6426
|
+
source: (
|
|
6427
|
+
/* wgsl */
|
|
6428
|
+
`struct maxWeightUniforms {
|
|
6429
|
+
textureSize: f32,
|
|
6430
|
+
};
|
|
6431
|
+
|
|
6432
|
+
@group(0) @binding(auto) var<uniform> maxWeight: maxWeightUniforms;
|
|
6433
|
+
@group(0) @binding(auto) var inTexture: texture_2d<f32>;
|
|
6434
|
+
`
|
|
6435
|
+
),
|
|
5863
6436
|
vs: `layout(std140) uniform maxWeightUniforms {
|
|
5864
6437
|
float textureSize;
|
|
5865
6438
|
} maxWeight;
|
|
@@ -5871,6 +6444,7 @@ void main() {
|
|
|
5871
6444
|
|
|
5872
6445
|
// src/heatmap-layer/heatmap-layer.ts
|
|
5873
6446
|
var RESOLUTION = 2;
|
|
6447
|
+
var MAX_WEIGHT_REDUCTION_SIZE = 16;
|
|
5874
6448
|
var TEXTURE_PROPS = {
|
|
5875
6449
|
format: "rgba8unorm",
|
|
5876
6450
|
dimension: "2d",
|
|
@@ -6062,18 +6636,33 @@ void main() {
|
|
|
6062
6636
|
}
|
|
6063
6637
|
_setupAttributes() {
|
|
6064
6638
|
const attributeManager = this.getAttributeManager();
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6639
|
+
if (this.context.device.type === "webgpu") {
|
|
6640
|
+
attributeManager.addInstanced({
|
|
6641
|
+
instancePositions: {
|
|
6642
|
+
size: 3,
|
|
6643
|
+
type: "float64",
|
|
6644
|
+
accessor: "getPosition",
|
|
6645
|
+
// Normalize binary XY positions into the packed XYZ high/low layout WebGPU requires.
|
|
6646
|
+
transform: (position) => [position[0], position[1], position[2] ?? 0]
|
|
6647
|
+
},
|
|
6648
|
+
instanceWeights: { size: 1, accessor: "getWeight" }
|
|
6649
|
+
});
|
|
6650
|
+
this.setState({ positionAttributeName: "instancePositions" });
|
|
6651
|
+
} else {
|
|
6652
|
+
attributeManager.add({
|
|
6653
|
+
positions: { size: 3, type: "float64", accessor: "getPosition" },
|
|
6654
|
+
weights: { size: 1, accessor: "getWeight" }
|
|
6655
|
+
});
|
|
6656
|
+
this.setState({ positionAttributeName: "positions" });
|
|
6657
|
+
}
|
|
6070
6658
|
}
|
|
6071
6659
|
_setupTextureParams() {
|
|
6072
6660
|
const { device } = this.context;
|
|
6073
6661
|
const { weightsTextureSize } = this.props;
|
|
6074
6662
|
const textureSize = Math.min(weightsTextureSize, device.limits.maxTextureDimension2D);
|
|
6075
|
-
const
|
|
6076
|
-
const
|
|
6663
|
+
const isWebGPU = device.type === "webgpu";
|
|
6664
|
+
const floatTargetSupport = isWebGPU ? device.getTextureFormatCapabilities("rgba16float").blend : FLOAT_TARGET_FEATURES.every((feature) => device.features.has(feature));
|
|
6665
|
+
const format = floatTargetSupport ? isWebGPU ? "rgba16float" : "rgba32float" : "rgba8unorm";
|
|
6077
6666
|
const weightsScale = floatTargetSupport ? 1 : 1 / 255;
|
|
6078
6667
|
this.setState({ textureSize, format, weightsScale });
|
|
6079
6668
|
if (!floatTargetSupport) {
|
|
@@ -6085,13 +6674,20 @@ void main() {
|
|
|
6085
6674
|
_createWeightsTransform(shaders) {
|
|
6086
6675
|
let { weightsTransform } = this.state;
|
|
6087
6676
|
const { weightsTexture } = this.state;
|
|
6677
|
+
const isWebGPU = this.context.device.type === "webgpu";
|
|
6088
6678
|
const attributeManager = this.getAttributeManager();
|
|
6089
6679
|
weightsTransform?.destroy();
|
|
6090
6680
|
weightsTransform = new import_engine6.TextureTransform(this.context.device, {
|
|
6091
6681
|
id: `${this.id}-weights-transform`,
|
|
6092
6682
|
...shaders,
|
|
6093
|
-
|
|
6094
|
-
|
|
6683
|
+
source: weights_wgsl_default,
|
|
6684
|
+
bufferLayout: attributeManager.getBufferLayouts({ isInstanced: isWebGPU }),
|
|
6685
|
+
vertexCount: isWebGPU ? 6 : 1,
|
|
6686
|
+
...isWebGPU ? {
|
|
6687
|
+
colorAttachmentFormats: [weightsTexture.format],
|
|
6688
|
+
isInstanced: true,
|
|
6689
|
+
instanceCount: this.getNumInstances()
|
|
6690
|
+
} : {},
|
|
6095
6691
|
targetTexture: weightsTexture,
|
|
6096
6692
|
parameters: {
|
|
6097
6693
|
depthWriteEnabled: false,
|
|
@@ -6102,7 +6698,7 @@ void main() {
|
|
|
6102
6698
|
blendAlphaSrcFactor: "one",
|
|
6103
6699
|
blendAlphaDstFactor: "one"
|
|
6104
6700
|
},
|
|
6105
|
-
topology: "point-list",
|
|
6701
|
+
topology: isWebGPU ? "triangle-list" : "point-list",
|
|
6106
6702
|
modules: [...shaders.modules, weightUniforms]
|
|
6107
6703
|
});
|
|
6108
6704
|
this.setState({ weightsTransform });
|
|
@@ -6117,6 +6713,7 @@ void main() {
|
|
|
6117
6713
|
});
|
|
6118
6714
|
this._createWeightsTransform(weightsTransformShaders);
|
|
6119
6715
|
const maxWeightsTransformShaders = this.getShaders({
|
|
6716
|
+
source: max_wgsl_default,
|
|
6120
6717
|
vs: max_vs_glsl_default,
|
|
6121
6718
|
fs: max_fs_glsl_default,
|
|
6122
6719
|
modules: [maxWeightUniforms]
|
|
@@ -6125,7 +6722,8 @@ void main() {
|
|
|
6125
6722
|
id: `${this.id}-max-weights-transform`,
|
|
6126
6723
|
targetTexture: maxWeightsTexture,
|
|
6127
6724
|
...maxWeightsTransformShaders,
|
|
6128
|
-
|
|
6725
|
+
...device.type === "webgpu" ? { colorAttachmentFormats: [maxWeightsTexture.format] } : {},
|
|
6726
|
+
vertexCount: device.type === "webgpu" ? Math.ceil(textureSize / MAX_WEIGHT_REDUCTION_SIZE) ** 2 : textureSize * textureSize,
|
|
6129
6727
|
topology: "point-list",
|
|
6130
6728
|
parameters: {
|
|
6131
6729
|
depthWriteEnabled: false,
|
|
@@ -6239,7 +6837,13 @@ void main() {
|
|
|
6239
6837
|
const attributes = attributeManager.getAttributes();
|
|
6240
6838
|
const moduleSettings = this.getModuleSettings();
|
|
6241
6839
|
this._setModelAttributes(weightsTransform.model, attributes);
|
|
6242
|
-
|
|
6840
|
+
if (this.context.device.type === "webgpu") {
|
|
6841
|
+
const instanceCount = this.getNumInstances();
|
|
6842
|
+
weightsTransform.model.setVertexCount(instanceCount > 0 ? 6 : 0);
|
|
6843
|
+
weightsTransform.model.setInstanceCount(instanceCount);
|
|
6844
|
+
} else {
|
|
6845
|
+
weightsTransform.model.setVertexCount(this.getNumInstances());
|
|
6846
|
+
}
|
|
6243
6847
|
const weightProps = {
|
|
6244
6848
|
radiusPixels,
|
|
6245
6849
|
commonBounds,
|