Class GpuPickingSceneRenderer
The compositor's half of GPU picking: on a frame with a request, draws the picking stage from the main camera into a hidden target, scissored to the one pixel asked about, copies that pixel into a staging texture and reads it back two frames later, when the GPU has long finished with it, so the answer never stalls the frame.
public sealed class GpuPickingSceneRenderer : SceneCameraRenderer, IComponent, IReferencable, ICollectorHolder, ISceneRenderer, IRenderCollector, IGraphicsRenderer, IGraphicsRendererBase, IGraphicsRendererCore, IDisposable
- Inheritance
-
GpuPickingSceneRenderer
- Implements
- Inherited Members
Remarks
A camera renderer of its own, over the same camera slot as the main view, so the render system culls and sorts a view for it - but only on frames with a request: idle, it adds no view, no stage and no work. Game Studio's viewport does the same pass, reads it back at once and pays the stall; a game cannot.
Fields
ProfilingKey
The block the profiler shows the pass under.
public static readonly ProfilingKey ProfilingKey
Field Value
Properties
Continuous
Whether to pick at FollowSource on every frame that has no explicit request.
public bool Continuous { get; set; }
Property Value
Feature
The mesh feature's half: the sub-feature that writes the ids and remembers the components.
public required GpuPickingRenderFeature Feature { get; init; }
Property Value
FollowSource
Where the point comes from every frame while Continuous is on: the mouse, typically.
public Func<Vector2>? FollowSource { get; set; }
Property Value
Pending
The point to pick on the next frame, normalised over the viewport with (0, 0) at the top left; null asks for nothing.
public Vector2? Pending { get; set; }
Property Value
Result
The last answer read back, or null before the first one.
public PickResult? Result { get; }
Property Value
Stage
The stage meshes are routed to for picking, already registered with the compositor.
public required RenderStage Stage { get; init; }
Property Value
Methods
CollectCore(RenderContext)
protected override void CollectCore(RenderContext context)
Parameters
contextRenderContext
Destroy()
protected override void Destroy()
DrawCore(RenderContext, RenderDrawContext)
protected override void DrawCore(RenderContext context, RenderDrawContext drawContext)
Parameters
contextRenderContextdrawContextRenderDrawContext