Table of Contents

Class ShapeBatchFeature

Namespace
Stride.CommunityToolkit.Shapes
Assembly
Stride.CommunityToolkit.Shapes.dll

Renders every ShapeBatch with ShapeShader: one instanced draw of a shared quad per batch, the shape records, their points and the points of space runs delivered through three structured buffers and evaluated per fragment as a signed distance function.

public class ShapeBatchFeature : RootRenderFeature, IComponent, IReferencable, ICollectorHolder, IGraphicsRendererCore, IDisposable
Inheritance
ShapeBatchFeature
Implements
Inherited Members

Remarks

The frame's shapes are uploaded once, in Prepare(RenderDrawContext), for every batch together, and the batches are emptied in Flush(RenderDrawContext), after the last view has drawn - so a second camera, a render-to-texture pass or the editor's view sees the same shapes as the first, and a batch whose stage never runs does not keep growing.

Constructors

ShapeBatchFeature()

Creates the feature. Shapes sort after everything else in their stage, so an overlay batch draws over the scene's other transparent objects and a depth-tested one still hides behind the opaque geometry it reads.

public ShapeBatchFeature()

Fields

ProfilingKey

The GPU timing scope around each batch's draw, for Stride's profiler and for a frame capture.

public static readonly ProfilingKey ProfilingKey

Field Value

ProfilingKey

Properties

SupportedRenderObjectType

public override Type SupportedRenderObjectType { get; }

Property Value

Type

Methods

BindPerViewShaderResource(string, RenderView, GraphicsResource)

Takes the depth buffer the forward renderer resolves for a view before its transparent stage, for the soft depth fade. The renderer offers it to every root render feature under the "Depth" logical group; anything else offered is ignored.

public override void BindPerViewShaderResource(string logicalGroupName, RenderView renderView, GraphicsResource resource)

Parameters

logicalGroupName string
renderView RenderView
resource GraphicsResource

Draw(RenderDrawContext, RenderView, RenderViewStage, int, int)

public override void Draw(RenderDrawContext context, RenderView renderView, RenderViewStage renderViewStage, int startIndex, int endIndex)

Parameters

context RenderDrawContext
renderView RenderView
renderViewStage RenderViewStage
startIndex int
endIndex int

Flush(RenderDrawContext)

Empties every batch once the frame's last view has drawn: immediate mode, one frame's submissions drawn by every view that wants them and then gone.

public override void Flush(RenderDrawContext context)

Parameters

context RenderDrawContext

InitializeCore()

protected override void InitializeCore()

Prepare(RenderDrawContext)

Gathers every batch's shapes into the two buffers, once per frame, before any view draws.

public override void Prepare(RenderDrawContext context)

Parameters

context RenderDrawContext

Unload()

public override void Unload()