Table of Contents

Class DebugShapeExtensions

Namespace
Stride.CommunityToolkit.DebugShapes
Assembly
Stride.CommunityToolkit.DebugShapes.dll

Provides extension methods for adding and managing debug rendering features in a game.

public static class DebugShapeExtensions
Inheritance
DebugShapeExtensions

Remarks

This static class includes methods to integrate immediate debug rendering capabilities into a game, such as adding debug render features to the graphics compositor, registering debug systems, and managing render stages. These methods are designed to simplify the process of enabling and using debug rendering in a game development environment.

Methods

AddDebugShapes(IGame, RenderGroup)

Adds ImmediateDebugRenderFeature and ImmediateDebugRenderSystem to the game.

Registers the system to the service registry for easy access.

public static ImmediateDebugRenderSystem AddDebugShapes(this IGame game, RenderGroup debugShapeRenderGroup = RenderGroup.Group1)

Parameters

game IGame

The game to add debug shapes to.

debugShapeRenderGroup RenderGroup

The render group the shapes are drawn in.

Returns

ImmediateDebugRenderSystem

The system the shapes are drawn through, also registered as a service.

Remarks

Shapes are visible by default only when the toolkit itself is a Debug build; set ImmediateDebugRenderSystem.Visible otherwise.

AddImmediateDebugRenderFeature(GraphicsCompositor)

Adds an immediate debug render feature to the specified GraphicsCompositor. This method ensures the debug render feature is added only once and links it with both the "Opaque" and "Transparent" render stages.

public static ImmediateDebugRenderFeature AddImmediateDebugRenderFeature(this GraphicsCompositor graphicsCompositor)

Parameters

graphicsCompositor GraphicsCompositor

The GraphicsCompositor to modify.

Returns

ImmediateDebugRenderFeature

The feature now in the compositor: the existing one, or the one just added.

Exceptions

NullReferenceException

Thrown when the "Opaque" or "Transparent" render stages are not found in the graphicsCompositor.

TryGetRenderStage(GraphicsCompositor, string, out RenderStage?)

Finds a render stage of the given name in the compositor's render system.

public static bool TryGetRenderStage(this GraphicsCompositor graphicsCompositor, string effectName, out RenderStage? renderStage)

Parameters

graphicsCompositor GraphicsCompositor

The GraphicsCompositor containing the render stages.

effectName string

The name of the render stage to search for.

renderStage RenderStage

When this method returns, contains the RenderStage if the render stage was found; otherwise, null.

Returns

bool

true if the render stage is found; otherwise, false.