Skip to content

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.

ArgumentTypeRequiredDescription
fx1numberYestop left x coord
fy1numberYestop left y coord
fx2numberYesbottom right x coord
fy2numberYesbottom 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.

ArgumentTypeRequiredDescription
runtimePropIDnumberYesThe prop id of the actor view node.
propvtkPropNoThe 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.

ArgumentTypeRequiredDescription
renderervtkRendererYesThe renderer to capture.

Returns ​

TypeDescription
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.