Class GpuPickerExtensions
Adds GPU picking to a game.
public static class GpuPickerExtensions
- Inheritance
-
GpuPickerExtensions
Methods
AddGpuPicker(IGame, RenderGroupMask)
Adds a picking pass over the main camera, so a screen point can be turned into the entity, mesh, instance and surface point under it without any collider. Call once, after the compositor exists; ask the returned picker every frame you need an answer.
public static GpuPicker AddGpuPicker(this IGame game, RenderGroupMask pickable = RenderGroupMask.All)
Parameters
gameIGameThe game whose compositor draws the pass.
pickableRenderGroupMaskWhich render groups the pass draws. Everything by default.
Returns
- GpuPicker
The picker. Dispose it to take the pass out again.
Remarks
Behind the call: a "Picking" render stage with a float target and a depth buffer, a SimpleGroupToRenderStageSelector on the compositor's mesh feature routing meshes into it under the picking effect, a GpuPickingRenderFeature writing each mesh's id, and a GpuPickingSceneRenderer over the main camera slot appended after the main view, drawing and reading back only on frames with a request.
Exceptions
- InvalidOperationException
The game has no compositor, no mesh render feature, or no camera slot.