Skip to content

Class: GpuPicker ​

Experimental

GPU ID picker for one 3D view (see the module docs for the design). Create one per viewport; Picker does this automatically for 3D viewports.

Constructors ​

Constructor ​

ts
new GpuPicker(
   renderer,
   view,
   host?
): GpuPicker;

Experimental

Parameters ​

ParameterType
rendererWebGLRenderer
viewGpuPickView
host?GpuPickHost

Returns ​

GpuPicker

Properties ​

PropertyModifierTypeDescription
rendererreadonlyWebGLRendererExperimental
viewreadonlyGpuPickViewExperimental

Accessors ​

disposed ​

Get Signature ​

ts
get disposed(): boolean;

Experimental

Returns ​

boolean


size ​

Get Signature ​

ts
get size(): number;

Experimental

Number of registrations.

Returns ​

number

Methods ​

dispose() ​

ts
dispose(): void;

Experimental

Release GPU resources, pick materials, and all registrations. In-flight picks resolve [].

Returns ​

void


has() ​

ts
has(target): boolean;

Experimental

Whether target is registered.

Parameters ​

ParameterType
target| Object3D<Object3DEventMap> | PickablePrimitive

Returns ​

boolean


pick() ​

ts
pick(request): Promise<PickResult[]>;

Experimental

Resolve the hits around a CSS position, nearest first. Resolves to [] when the position is outside the view, nothing is registered, the context is lost, or the picker is disposed. Several picks may be in flight; each has its own readback buffer.

Parameters ​

ParameterType
requestGpuPickRequest

Returns ​

Promise<PickResult[]>


register() ​

ts
register(target, options?): number;

Experimental

Make target pickable and return its registration id. Registering the same target again updates its options and returns the same id.

Parameters ​

ParameterType
target| Object3D<Object3DEventMap> | PickablePrimitive
optionsGpuPickableOptions

Returns ​

number


unregister() ​

ts
unregister(target): boolean;

Experimental

Stop picking a target (by registration id or the registered object). Returns whether found.

Parameters ​

ParameterType
target| number | Object3D<Object3DEventMap> | PickablePrimitive

Returns ​

boolean

Released under the MIT License.