Table of Contents

Class GpuPickingSceneRenderer

Namespace
Stride.CommunityToolkit.Effects.Picking
Assembly
Stride.CommunityToolkit.Effects.dll

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

ProfilingKey

Properties

Continuous

Whether to pick at FollowSource on every frame that has no explicit request.

public bool Continuous { get; set; }

Property Value

bool

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

GpuPickingRenderFeature

FollowSource

Where the point comes from every frame while Continuous is on: the mouse, typically.

public Func<Vector2>? FollowSource { get; set; }

Property Value

Func<Vector2>

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

Vector2?

Result

The last answer read back, or null before the first one.

public PickResult? Result { get; }

Property Value

PickResult

Stage

The stage meshes are routed to for picking, already registered with the compositor.

public required RenderStage Stage { get; init; }

Property Value

RenderStage

Methods

CollectCore(RenderContext)

protected override void CollectCore(RenderContext context)

Parameters

context RenderContext

Destroy()

protected override void Destroy()

DrawCore(RenderContext, RenderDrawContext)

protected override void DrawCore(RenderContext context, RenderDrawContext drawContext)

Parameters

context RenderContext
drawContext RenderDrawContext