@deck.gl/core 9.3.0-alpha.3 → 9.3.0-alpha.5
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/controllers/terrain-controller.d.ts +7 -6
- package/dist/controllers/terrain-controller.d.ts.map +1 -1
- package/dist/controllers/terrain-controller.js +58 -39
- package/dist/controllers/terrain-controller.js.map +1 -1
- package/dist/dist.dev.js +3076 -1197
- package/dist/index.cjs +525 -212
- package/dist/index.cjs.map +4 -4
- package/dist/lib/attribute/gl-utils.d.ts +1 -2
- package/dist/lib/attribute/gl-utils.d.ts.map +1 -1
- package/dist/lib/attribute/gl-utils.js +2 -2
- package/dist/lib/attribute/gl-utils.js.map +1 -1
- package/dist/lib/deck-picker.d.ts +3 -2
- package/dist/lib/deck-picker.d.ts.map +1 -1
- package/dist/lib/deck-picker.js +74 -17
- package/dist/lib/deck-picker.js.map +1 -1
- package/dist/lib/deck.d.ts +62 -0
- package/dist/lib/deck.d.ts.map +1 -1
- package/dist/lib/deck.js +219 -77
- package/dist/lib/deck.js.map +1 -1
- package/dist/lib/init.js +2 -2
- package/dist/lib/layer.d.ts.map +1 -1
- package/dist/lib/layer.js +60 -9
- package/dist/lib/layer.js.map +1 -1
- package/dist/lib/view-manager.js +1 -1
- package/dist/lib/view-manager.js.map +1 -1
- package/dist/passes/pick-layers-pass.d.ts.map +1 -1
- package/dist/passes/pick-layers-pass.js +7 -2
- package/dist/passes/pick-layers-pass.js.map +1 -1
- package/dist/passes/screen-pass-uniforms.d.ts +1 -1
- package/dist/passes/screen-pass-uniforms.js +1 -1
- package/dist/shaderlib/color/color.d.ts +1 -4
- package/dist/shaderlib/color/color.d.ts.map +1 -1
- package/dist/shaderlib/color/color.js +0 -12
- package/dist/shaderlib/color/color.js.map +1 -1
- package/dist/shaderlib/misc/layer-uniforms.d.ts +3 -2
- package/dist/shaderlib/misc/layer-uniforms.d.ts.map +1 -1
- package/dist/shaderlib/misc/layer-uniforms.js +10 -1
- package/dist/shaderlib/misc/layer-uniforms.js.map +1 -1
- package/dist/shaderlib/picking/picking.d.ts +3 -2
- package/dist/shaderlib/picking/picking.d.ts.map +1 -1
- package/dist/shaderlib/picking/picking.js +29 -0
- package/dist/shaderlib/picking/picking.js.map +1 -1
- package/dist/shaderlib/project/project.glsl.js +1 -1
- package/dist/shaderlib/project/project.wgsl.d.ts.map +1 -1
- package/dist/shaderlib/project/project.wgsl.js +4 -6
- package/dist/shaderlib/project/project.wgsl.js.map +1 -1
- package/dist/shaderlib/shadow/shadow.d.ts +2 -2
- package/dist/shaderlib/shadow/shadow.js +1 -1
- package/dist/transitions/gpu-interpolation-transition.js +2 -2
- package/dist/transitions/gpu-interpolation-transition.js.map +1 -1
- package/dist/transitions/gpu-spring-transition.js +1 -1
- package/dist/transitions/gpu-transition-utils.d.ts.map +1 -1
- package/dist/transitions/gpu-transition-utils.js +3 -4
- package/dist/transitions/gpu-transition-utils.js.map +1 -1
- package/dist/utils/typed-array-manager.js.map +1 -1
- package/dist.min.js +506 -234
- package/package.json +6 -7
- package/src/controllers/terrain-controller.ts +60 -51
- package/src/lib/attribute/gl-utils.ts +2 -2
- package/src/lib/deck-picker.ts +98 -17
- package/src/lib/deck.ts +334 -86
- package/src/lib/layer.ts +98 -8
- package/src/lib/view-manager.ts +1 -1
- package/src/passes/pick-layers-pass.ts +6 -2
- package/src/passes/screen-pass-uniforms.ts +1 -1
- package/src/shaderlib/color/color.ts +0 -12
- package/src/shaderlib/misc/layer-uniforms.ts +11 -1
- package/src/shaderlib/picking/picking.ts +30 -0
- package/src/shaderlib/project/project.glsl.ts +1 -1
- package/src/shaderlib/project/project.wgsl.ts +4 -6
- package/src/shaderlib/shadow/shadow.ts +1 -1
- package/src/transitions/gpu-interpolation-transition.ts +2 -2
- package/src/transitions/gpu-spring-transition.ts +1 -1
- package/src/transitions/gpu-transition-utils.ts +4 -5
- package/src/utils/typed-array-manager.ts +3 -3
|
@@ -148,8 +148,12 @@ export default class PickLayersPass extends LayersPass {
|
|
|
148
148
|
// Encode pickable layers that include 'draw' operation (including 'terrain+draw')
|
|
149
149
|
Object.assign(pickParameters, PICKING_BLENDING);
|
|
150
150
|
pickParameters.blend = true;
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
if (this.device.type === 'webgpu') {
|
|
152
|
+
// WebGPU uses render-pass dynamic state for constant blending.
|
|
153
|
+
pickParameters.blendConstant = encodeColor(this._colorEncoderState, layer, viewport);
|
|
154
|
+
} else {
|
|
155
|
+
pickParameters.blendColor = encodeColor(this._colorEncoderState, layer, viewport);
|
|
156
|
+
}
|
|
153
157
|
if (operation.includes('terrain') && layer.state?._hasPickingCover) {
|
|
154
158
|
// For terrain+draw layers with a valid cover FBO, the terrain shader outputs the
|
|
155
159
|
// cover FBO pixel which already has correctly encoded alpha from the cover encoder.
|
|
@@ -7,15 +7,6 @@ import {LayerProps} from '../../types/layer-props';
|
|
|
7
7
|
|
|
8
8
|
const colorWGSL = /* WGSL */ `
|
|
9
9
|
|
|
10
|
-
struct ColorUniforms {
|
|
11
|
-
opacity: f32,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
var<private> color: ColorUniforms = ColorUniforms(1.0);
|
|
15
|
-
// TODO (kaapp) avoiding binding index collisions to handle layer opacity
|
|
16
|
-
// requires some thought.
|
|
17
|
-
// @group(0) @binding(0) var<uniform> color: ColorUniforms;
|
|
18
|
-
|
|
19
10
|
@must_use
|
|
20
11
|
fn deckgl_premultiplied_alpha(fragColor: vec4<f32>) -> vec4<f32> {
|
|
21
12
|
return vec4(fragColor.rgb * fragColor.a, fragColor.a);
|
|
@@ -43,9 +34,6 @@ export default {
|
|
|
43
34
|
// TODO - v10: use raw opacity?
|
|
44
35
|
// opacity: Math.pow(props.opacity!, 1 / 2.2)
|
|
45
36
|
return {};
|
|
46
|
-
},
|
|
47
|
-
uniformTypes: {
|
|
48
|
-
opacity: 'f32'
|
|
49
37
|
}
|
|
50
38
|
// @ts-ignore TODO v9.1
|
|
51
39
|
} as const satisfies ShaderModule<LayerProps, ColorUniforms, {}>;
|
|
@@ -5,8 +5,17 @@
|
|
|
5
5
|
import type {ShaderModule} from '@luma.gl/shadertools';
|
|
6
6
|
import type {LayerProps} from '../../types/layer-props';
|
|
7
7
|
|
|
8
|
+
const uniformBlockWGSL = /* wgsl */ `\
|
|
9
|
+
struct LayerUniforms {
|
|
10
|
+
opacity: f32,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
@group(0) @binding(auto)
|
|
14
|
+
var<uniform> layer: LayerUniforms;
|
|
15
|
+
`;
|
|
16
|
+
|
|
8
17
|
const uniformBlock = `\
|
|
9
|
-
uniform layerUniforms {
|
|
18
|
+
layout(std140) uniform layerUniforms {
|
|
10
19
|
uniform float opacity;
|
|
11
20
|
} layer;
|
|
12
21
|
`;
|
|
@@ -17,6 +26,7 @@ export type LayerUniforms = {
|
|
|
17
26
|
|
|
18
27
|
export const layerUniforms = {
|
|
19
28
|
name: 'layer',
|
|
29
|
+
source: uniformBlockWGSL,
|
|
20
30
|
vs: uniformBlock,
|
|
21
31
|
fs: uniformBlock,
|
|
22
32
|
getUniforms: (props: Partial<LayerProps>) => {
|
|
@@ -4,8 +4,38 @@
|
|
|
4
4
|
|
|
5
5
|
import {picking} from '@luma.gl/shadertools';
|
|
6
6
|
|
|
7
|
+
const sourceWGSL = /* wgsl */ `\
|
|
8
|
+
struct pickingUniforms {
|
|
9
|
+
isActive: f32,
|
|
10
|
+
isAttribute: f32,
|
|
11
|
+
isHighlightActive: f32,
|
|
12
|
+
useFloatColors: f32,
|
|
13
|
+
highlightedObjectColor: vec3<f32>,
|
|
14
|
+
highlightColor: vec4<f32>,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
@group(0) @binding(auto) var<uniform> picking: pickingUniforms;
|
|
18
|
+
|
|
19
|
+
fn picking_normalizeColor(color: vec3<f32>) -> vec3<f32> {
|
|
20
|
+
return select(color / 255.0, color, picking.useFloatColors > 0.5);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
fn picking_normalizeColor4(color: vec4<f32>) -> vec4<f32> {
|
|
24
|
+
return select(color / 255.0, color, picking.useFloatColors > 0.5);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
fn picking_isColorZero(color: vec3<f32>) -> bool {
|
|
28
|
+
return dot(color, vec3<f32>(1.0)) < 0.00001;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
fn picking_isColorValid(color: vec3<f32>) -> bool {
|
|
32
|
+
return dot(color, vec3<f32>(1.0)) > 0.00001;
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
|
|
7
36
|
export default {
|
|
8
37
|
...picking,
|
|
38
|
+
source: sourceWGSL,
|
|
9
39
|
defaultUniforms: {...picking.defaultUniforms, useFloatColors: false},
|
|
10
40
|
inject: {
|
|
11
41
|
'vs:DECKGL_FILTER_GL_POSITION': `
|
|
@@ -50,14 +50,13 @@ struct ProjectUniforms {
|
|
|
50
50
|
pseudoMeters: i32,
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
@group(0) @binding(
|
|
53
|
+
@group(0) @binding(auto)
|
|
54
54
|
var<uniform> project: ProjectUniforms;
|
|
55
55
|
|
|
56
56
|
// -----------------------------------------------------------------------------
|
|
57
|
-
// Geometry data
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
// uniform struct for demonstration.)
|
|
57
|
+
// Geometry data shared across the project helpers.
|
|
58
|
+
// The active layer shader is responsible for populating this private module
|
|
59
|
+
// state before calling the project functions below.
|
|
61
60
|
// -----------------------------------------------------------------------------
|
|
62
61
|
|
|
63
62
|
// Structure to carry additional geometry data used by deck.gl filters.
|
|
@@ -70,7 +69,6 @@ struct Geometry {
|
|
|
70
69
|
pickingColor: vec3<f32>,
|
|
71
70
|
};
|
|
72
71
|
|
|
73
|
-
// @group(0) @binding(1)
|
|
74
72
|
var<private> geometry: Geometry;
|
|
75
73
|
`;
|
|
76
74
|
|
|
@@ -15,7 +15,7 @@ import type Viewport from '../../viewports/viewport';
|
|
|
15
15
|
import type {ProjectProps, ProjectUniforms} from '../project/viewport-uniforms';
|
|
16
16
|
|
|
17
17
|
const uniformBlock = /* glsl */ `
|
|
18
|
-
uniform shadowUniforms {
|
|
18
|
+
layout(std140) uniform shadowUniforms {
|
|
19
19
|
bool drawShadowMap;
|
|
20
20
|
bool useShadowMap;
|
|
21
21
|
vec4 color;
|
|
@@ -6,7 +6,7 @@ import type {Device} from '@luma.gl/core';
|
|
|
6
6
|
import {Timeline, BufferTransform} from '@luma.gl/engine';
|
|
7
7
|
import {fp64arithmetic} from '@luma.gl/shadertools';
|
|
8
8
|
import type {ShaderModule} from '@luma.gl/shadertools';
|
|
9
|
-
import {GL} from '@luma.gl/constants';
|
|
9
|
+
import {GL} from '@luma.gl/webgl/constants';
|
|
10
10
|
import Attribute from '../lib/attribute/attribute';
|
|
11
11
|
import {
|
|
12
12
|
getAttributeTypeFromSize,
|
|
@@ -112,7 +112,7 @@ export default class GPUInterpolationTransition extends GPUTransitionBase<Interp
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
const uniformBlock = `\
|
|
115
|
-
uniform interpolationUniforms {
|
|
115
|
+
layout(std140) uniform interpolationUniforms {
|
|
116
116
|
float time;
|
|
117
117
|
} interpolation;
|
|
118
118
|
`;
|
|
@@ -6,7 +6,7 @@ import type {Device, Buffer, VertexFormat} from '@luma.gl/core';
|
|
|
6
6
|
import {padArray} from '../utils/array-utils';
|
|
7
7
|
import {NumericArray, TypedArray, TypedArrayConstructor} from '../types/types';
|
|
8
8
|
import Attribute from '../lib/attribute/attribute';
|
|
9
|
-
import {GL} from '@luma.gl/constants';
|
|
9
|
+
import {GL} from '@luma.gl/webgl/constants';
|
|
10
10
|
|
|
11
11
|
/** Create a new empty attribute with the same settings: type, shader layout etc. */
|
|
12
12
|
export function cloneAttribute(attribute: Attribute): Attribute {
|
|
@@ -150,9 +150,8 @@ export function padBuffer({
|
|
|
150
150
|
? (attribute.value as TypedArray)
|
|
151
151
|
: // TODO(v9.1): Avoid non-portable synchronous reads.
|
|
152
152
|
new ArrayType(
|
|
153
|
-
attribute
|
|
154
|
-
.
|
|
155
|
-
.readSyncWebGL(byteOffset, toLength * ArrayType.BYTES_PER_ELEMENT).buffer
|
|
153
|
+
attribute.getBuffer()!.readSyncWebGL(byteOffset, toLength * ArrayType.BYTES_PER_ELEMENT)
|
|
154
|
+
.buffer as ArrayBuffer
|
|
156
155
|
);
|
|
157
156
|
if (attribute.settings.normalized && !isConstant) {
|
|
158
157
|
const getter = getData;
|
|
@@ -166,7 +165,7 @@ export function padBuffer({
|
|
|
166
165
|
|
|
167
166
|
// TODO(v9.1): Avoid non-portable synchronous reads.
|
|
168
167
|
const source = buffer
|
|
169
|
-
? new Float32Array(buffer.readSyncWebGL(targetByteOffset, fromLength * 4).buffer)
|
|
168
|
+
? new Float32Array(buffer.readSyncWebGL(targetByteOffset, fromLength * 4).buffer as ArrayBuffer)
|
|
170
169
|
: new Float32Array(0);
|
|
171
170
|
const target = new Float32Array(toLength);
|
|
172
171
|
padArray({
|
|
@@ -52,7 +52,7 @@ export class TypedArrayManager {
|
|
|
52
52
|
return typedArray;
|
|
53
53
|
}
|
|
54
54
|
if (newSize * typedArray.BYTES_PER_ELEMENT <= typedArray.buffer.byteLength) {
|
|
55
|
-
return new Type(typedArray.buffer, 0, newSize) as T;
|
|
55
|
+
return new Type(typedArray.buffer as ArrayBuffer, 0, newSize) as T;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -119,9 +119,9 @@ export class TypedArrayManager {
|
|
|
119
119
|
const {byteLength} = buffer;
|
|
120
120
|
const i = pool.findIndex(b => b.byteLength >= byteLength);
|
|
121
121
|
if (i < 0) {
|
|
122
|
-
pool.push(buffer);
|
|
122
|
+
pool.push(buffer as ArrayBuffer);
|
|
123
123
|
} else if (i > 0 || pool.length < this.opts.poolSize) {
|
|
124
|
-
pool.splice(i, 0, buffer);
|
|
124
|
+
pool.splice(i, 0, buffer as ArrayBuffer);
|
|
125
125
|
}
|
|
126
126
|
if (pool.length > this.opts.poolSize) {
|
|
127
127
|
// Drop the smallest one
|