A function called multiPickAsync has been added. It’s similar to the pickAsync function but accepts an array of IVector2Like coordinates as an input not just a single one.
Do you want to pick all meshes in a given region? If so, GPU picking is not the right tool to use. You can use bounds checking to get all meshes in the selected region. For example you can create a box (width: regionWidth, height: regionHeight, deprh: cameraMaxZ - cameraMinZ) a use the intersects function. Or I think you could use mesh.isInFrustum(planes) where you limit the frustum with planes positioned at the boundaries of the region.
Hmm, but bbox-based frustum checking is not as accurate as gpu picking, many meshes are not in a cube shape and there are many cases that mesh having a bounding box in rect with no triangle in it.
I just woke up and a solution has popped out of my mind. It seems that my brain is more rested because I could think of it right away
Basically you can ask for a multiPick with two coordinates. Left upper corner and right bottom corner - a region. All you have do then is read the gpuPicker._readBuffer’s data. It’s an Uint8Array with Color4 data. Each color represents a meshId - index + 1 in the pickingList.
Move the meshes into the magenta region.
The example reads only one color byte, so you’re limited to 255 meshes.
@Deltakosh maybe we could expose the _readBuffer or it would be more elegant to make the private _getColorIdFromReadBuffer(offset: number):IColor3Like function public.
EDIT:
Drag to create region and pick meshes in the region. Picks only visible meshes but can be easily updated to pick ocluded meshes as well.