HardwareSelector
Introduction
The WebGPU implementation of the hardware selector renders the scene into an rgba32uint texture whose texels hold the prop, composite and attribute ids of the fragment, then copies that texture, and the depth texture when z values are wanted, into mappable buffers. Because the copy covers the whole texture, the capture always spans the full canvas and the picking region is only applied when the read back buffers are decoded.
Methods
attach
Attach the selector to a render window and its renderer.
colorBufferWidth
The row stride, in texels, of the color buffer. Rounded up so that a row is a multiple of 256 bytes.
colorValues
The [propID, compositeID, attributeID + 1, unused] texels of the capture, row padded to colorBufferWidth.
endSelection
Detach this selector from the renderer it was capturing.
generateSelection
Resolve the props, composite ids and attribute ids hit inside a region of this capture.
| Argument | Type | Required | Description |
|---|---|---|---|
fx1 | number | Yes | top left x coord |
fy1 | number | Yes | top left y coord |
fx2 | number | Yes | bottom right x coord |
fy2 | number | Yes | bottom right y coord |
getPropIDForSelection
Get the index this prop is written to the selection buffer under, assigning it one on first use. The indices are reset at the start of every capture.
| Argument | Type | Required | Description |
|---|---|---|---|
runtimePropID | number | Yes | The prop id of the actor view node. |
prop | vtkProp | No | The prop the selection should report (default: null) |
getSourceDataAsync
Render the scene into the selection buffers and read them back. The whole canvas is always captured, so no region is taken.
| Argument | Type | Required | Description |
|---|---|---|---|
renderer | vtkRenderer | Yes | The renderer to capture. |
Returns
| Type | Description |
|---|---|
the capture, or false when there is no renderer or view, or the renderer has no view node. |
getWebGPURenderWindow
Get the render window view node the capture renders through.
props
The props hit during the capture, indexed by the prop id written into the selection buffer. An entry is null when the mapper did not name a prop.
setWebGPURenderWindow
Set the render window view node the capture renders through.