You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api-reference/core/deck.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -773,7 +773,7 @@ Parameters:
773
773
* `y` (number) - y position in pixels
774
774
* `radius` (number, optional) - radius of tolerance in pixels. Default `0`.
775
775
* `layerIds` (string[], optional) - a list of layer ids to query from. If not specified, then all pickable and visible layers are queried.
776
-
* `depth` - Specifies the max number of objects to return. Default `10`. For layers without explicit picking color buffers, only the default depth of 10 unique objects per layer is guaranteed; higher custom depths may return duplicate results for these layers.
776
+
* `depth` - Specifies the max number of objects to return. Default `10`. For layers without explicit picking index buffers, only the default depth of 10 unique objects per layer is guaranteed; higher custom depths may return duplicate results for these layers.
777
777
* `unproject3D` (boolean, optional) - if `true`, `info.coordinate` will be a 3D point by unprojecting the `x, y` screen coordinates onto the picked geometry. Default `false`.
778
778
779
779
Returns:
@@ -783,7 +783,7 @@ Returns:
783
783
Notes:
784
784
785
785
* Deep picking is implemented as a sequence of simpler picking operations and can have a performance impact. Should this become a concern, you can use the `depth` parameter to limit the number of matches that can be returned, and thus the maximum number of picking operations.
786
-
* Layers that provide explicit picking color buffers support buffer mutation between picking passes and are not subject to the default-depth unique-object guarantee.
786
+
* Layers that provide explicit picking index buffers support buffer mutation between picking passes and are not subject to the default-depth unique-object guarantee.
Copy file name to clipboardExpand all lines: docs/developer-guide/custom-layers/attribute-management.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ While most apps rely on their layers to automatically generate appropriate GPU b
47
47
48
48
While this allows for ultimate performance and control of updates, as well as potential sharing of buffers between layers, the application will need to generate attributes in exactly the format that the layer shaders expect, creating a strong coupling between the application and the layer.
49
49
50
-
**Note:** The application can provide some buffers and let others be managed by the layer. Explicit picking color buffers are only needed when the logical picking id differs from the rendered instance id.
50
+
**Note:** The application can provide some buffers and let others be managed by the layer. Explicit picking index buffers are only needed when the logical picking id differs from the rendered instance id.
Copy file name to clipboardExpand all lines: docs/developer-guide/custom-layers/layer-attributes.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,7 +55,7 @@ For _variable primitive layers_ there are two options:
55
55
56
56
2) Copy each descriptive attribute `N` times (`N` being the number of vertices generated for that row during tesselation). This is the method that is used in deck.gl today.
57
57
58
-
3) Add a single `rowIndex` attribute and copy the same index `N` times as above. In this approach, descriptive values could then be read from textures where they are stored a single time. This provides flexibility at the price of performance (texture access latency) and complexity (working with data in textures).
58
+
3) Add a single `rowIndexes` attribute and copy the same index `N` times as above. In this approach, descriptive values could then be read from textures where they are stored a single time. This provides flexibility at the price of performance (texture access latency) and complexity (working with data in textures).
Copy file name to clipboardExpand all lines: docs/developer-guide/custom-layers/picking.md
+14-19Lines changed: 14 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,49 +55,44 @@ The following sections describe common ways to implement custom picking.
55
55
56
56
Instanced layer shaders can derive picking colors from the built-in instance id when each rendered instance maps to one picked object. In GLSL, use `picking_setPickingColorFromInstanceID()` or assign `geometry.pickingColor = picking_getPickingColorFromInstanceID()`. In WGSL, add `@builtin(instance_index)` to the vertex inputs and use `picking_getPickingColorFromIndex(instanceIndex)`.
57
57
58
-
Add an explicit picking color attribute only when the logical picking id within the current layer is different from the rendered instance id. For example:
58
+
Add an explicit picking index attribute only when the logical picking id within the current layer is different from the rendered instance id. For example:
59
59
60
60
* Binary GeoJSON or MVT point sublayers may render local point instances while picking should return a global feature index.
61
61
62
-
*`PathLayer` tessellates one path into multiple rendered segment or joint instances, so its generated geometry needs explicit picking colors that map back to the source path index instead of each rendered segment's instance id.
62
+
*`PathLayer` tessellates one path into multiple rendered segment or joint instances, so its generated geometry needs explicit picking indexes that map back to the source path index instead of each rendered segment's instance id.
63
63
64
-
### Creating A Picking Color Attribute
64
+
### Creating A Picking Index Attribute
65
65
66
-
Add an attribute for each vertex using the layer's [AttributeManager](../../api-reference/core/attribute-manager.md):
66
+
Add an attribute for each vertex or instance using the layer's [AttributeManager](../../api-reference/core/attribute-manager.md). Use the `rowIndexes` attribute name to let deck.gl handle deep-picking buffer mutation.
67
67
68
68
```js
69
-
import {GL} from'@luma.gl/webgl/constants';
70
-
71
69
classMyLayerextendsLayer {
72
70
initializeState() {
73
71
this.state.attributeManager.add({
74
-
customPickingColors: {
75
-
size:3,
76
-
type:GL.UNSIGNED_BYTE,
77
-
update:this.calculatePickingColors
72
+
rowIndexes: {
73
+
size:1,
74
+
type:'uint32',
75
+
update:this.calculatePickingIndexes
78
76
}
79
77
});
80
78
}
81
79
}
82
80
```
83
81
84
-
Populate the attribute by providing a different picking color for every object that you need to differentiate. The default implementation of [`layer.encodePickingColor()`](../../api-reference/core/layer.md#encodepickingcolor) and [`layer.decodePickingColor()`](../../api-reference/core/layer.md#decodepickingcolor) is likely sufficient, but you may need to implement your own pair.
82
+
Populate the attribute by providing the logical object index for every rendered vertex or instance that you need to differentiate.
85
83
86
84
```js
87
85
classMyLayerextendsLayer {
88
86
89
87
...
90
88
91
-
calculatePickingColors(attribute) {
89
+
calculatePickingIndexes(attribute) {
92
90
const {data} =this.props;
93
91
const {value} = attribute;
94
92
95
93
let i =0;
96
94
for (constobjectof data) {
97
-
constpickingColor=this.encodePickingColor(i);
98
-
value[i *3] = pickingColor[0];
99
-
value[i *3+1] = pickingColor[1];
100
-
value[i *3+2] = pickingColor[2];
95
+
value[i] = i;
101
96
i++;
102
97
}
103
98
}
@@ -129,15 +124,15 @@ All core layers (including composite layers) support picking using luma.gl's `pi
129
124
130
125
#### Vertex Shader
131
126
132
-
Vertex shader should set current picking color using `picking_setPickingColor` method provided by picking shader module.
127
+
Vertex shader should set current picking color using helpers provided by the picking shader module.
Copy file name to clipboardExpand all lines: docs/developer-guide/custom-layers/primitive-layers.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -149,4 +149,4 @@ By always using the following shader functions for handling projections and scal
149
149
150
150
If your layer is instanced (`data` prop is an array and each element is rendered as one primitive), then you may take advantage of the default implementation of the [layer picking methods](../../api-reference/core/layer.md#layer-picking-methods).
151
151
152
-
By default, instanced layer shaders can derive picking colors from the built-in instance id. Add an explicit picking color attribute only when the logical picking id within the current layer is different from the rendered instance id. See [Implementing Custom Picking](./picking.md#implementing-custom-picking) for custom picking details and examples.
152
+
By default, instanced layer shaders can derive picking colors from the built-in instance id. Add an explicit picking index attribute only when the logical picking id within the current layer is different from the rendered instance id. See [Implementing Custom Picking](./picking.md#implementing-custom-picking) for custom picking details and examples.
Copy file name to clipboardExpand all lines: docs/upgrade-guide.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
#### `pickMultipleObjects()` pick depth limits
6
6
7
-
For layers that use built-in shader instance ids instead of explicit picking color buffers, `pickMultipleObjects()` now only guarantees the default `depth` of 10 unique objects per layer. Applications that call `pickMultipleObjects()` with a custom `depth` above the default may receive duplicate results for these layers. Layers with explicit picking color buffers keep their previous buffer-mutation behavior.
7
+
For layers that use built-in shader instance ids instead of explicit picking index buffers, `pickMultipleObjects()` now only guarantees the default `depth` of 10 unique objects per layer. Applications that call `pickMultipleObjects()` with a custom `depth` above the default may receive duplicate results for these layers. Layers with explicit picking index buffers keep their previous buffer-mutation behavior.
8
8
9
9
### `instancePickingColors` attribute is no longer automatically generated
10
10
@@ -13,7 +13,7 @@ Most built-in and custom instanced layers now derive picking colors from built-i
13
13
In rare cases, custom WebGL layer shaders may need an update if they explicitly read the `instancePickingColors` attribute.
14
14
15
15
- In such cases, use the new picking shader helper functions to derive the color from the instance id, for example `picking_setPickingColorFromInstanceID()` in GLSL or `picking_getPickingColorFromIndex(instanceIndex)` in WGSL.
16
-
- However, if the logical picking id is different from the rendered instance id, layers can still continue to register and populate an explicit picking color attribute as before.
16
+
- However, if the logical picking id is different from the rendered instance id, layers can register and populate an explicit `rowIndexes`attribute.
0 commit comments