Class GPUPicker
Accessors
default Render Materials
-
get defaultRenderMaterials(): readonly Nullable<ShaderMaterial>[]
Gets the default render materials used by the picker.
index is Material filling mode
Returns readonly Nullable<ShaderMaterial>[]
enable Depth Picking
-
get enableDepthPicking(): boolean
Gets or sets a boolean indicating if depth-based pickedPoint and normal reconstruction should be enabled.
When disabled, GPUPicker uses the original single-color render target and shader path. When enabled, GPUPicker switches to a MultiRenderTarget and compiles the default picking shader with GPUPICKER_DEPTH to output both the picking id and the depth required to reconstruct the picked point and normal.
Custom picking materials and special picking material plugins should also write the depth attachment. If they do not, GPUPicker will still try to reconstruct pickedPoint and normal from the depth target, but the returned values may be missing or incorrect.
Returns boolean
-
set enableDepthPicking(value: boolean): void
Parameters
- value: boolean
Returns void
picking In Progress
-
get pickingInProgress(): boolean
Gets a boolean indicating if the picking is in progress
Returns boolean
shader Language
-
get shaderLanguage(): ShaderLanguage
Gets the shader language used in this generator.
Returns ShaderLanguage
Methods
add Picking List
-
Add array of meshes to the current picking list
Parameters
- list: any[]
defines the array of meshes to add to the current picking list
Returns void
- list: any[]
box Pick Async
-
boxPickAsync(
x1: number,
y1: number,
x2: number,
y2: number,
disposeWhenDone?: boolean,
): Promise<Nullable<IGPUMultiPickingInfo>>Execute a picking operation on box defined by two screen coordinates
Parameters
- x1: number
defines the X coordinate of the first corner of the box where to run the pick
- y1: number
defines the Y coordinate of the first corner of the box where to run the pick
- x2: number
defines the X coordinate of the opposite corner of the box where to run the pick
- y2: number
defines the Y coordinate of the opposite corner of the box where to run the pick
- disposeWhenDone: boolean = false
defines a boolean indicating we do not want to keep resources alive (false by default)
Returns Promise<Nullable<IGPUMultiPickingInfo>>
A promise with the picking results. Contains one entry for each picked pixel in the box.
- x1: number
clear Picking List
-
Clear the current picking list and free resources
Returns void
dispose
-
Release the resources
Returns void
multi Pick Async
-
multiPickAsync(
xy: IVector2Like[],
disposeWhenDone?: boolean,
options?: IGPUMultiPickOptions,
): Promise<Nullable<IGPUMultiPickingInfo>>Execute a picking operation on multiple coordinates
Parameters
- xy: IVector2Like[]
defines the X,Y coordinates where to run the pick
- disposeWhenDone: boolean = false
defines a boolean indicating we do not want to keep resources alive (false by default)
Optionaloptions: IGPUMultiPickOptionsdefines options used to tune the multi pick readback strategy
Returns Promise<Nullable<IGPUMultiPickingInfo>>
A promise with the picking results. Always returns an array with the same length as the number of coordinates. The mesh or null at the index where no mesh was picked.
- xy: IVector2Like[]
pick Async
-
Execute a picking operation
Parameters
- x: number
defines the X coordinates where to run the pick
- y: number
defines the Y coordinates where to run the pick
- disposeWhenDone: boolean = false
defines a boolean indicating we do not want to keep resources alive (false by default)
Returns Promise<Nullable<IGPUPickingInfo>>
A promise with the picking results
- x: number
set Picking List
-
Set the list of meshes to pick from Set that value to null to clear the list (and avoid leaks) The module will read and delete from the array provided by reference. Disposing the module or setting the value to null will clear the array.
Parameters
- list: Nullable<any[]>
defines the list of meshes to pick from
Returns void
- list: Nullable<any[]>
Class used to perform a picking operation using GPU GPUPicker can pick meshes, instances and thin instances