Table of Contents

Class GraphicsCompositorExtensions

Namespace
Stride.CommunityToolkit.Renderers
Assembly
Stride.CommunityToolkit.dll

Provides extension methods for the GraphicsCompositor class to enhance its functionality. These methods allow for the addition of UI stages, scene renderers, and debug render features, as well as utility methods for working with render stages.

public static class GraphicsCompositorExtensions
Inheritance
GraphicsCompositorExtensions

Methods

AddEntityDebugRenderer(GraphicsCompositor, EntityDebugSceneRendererOptions?)

Adds an EntityDebugSceneRenderer to the GraphicsCompositor for rendering entity debug information.

public static GraphicsCompositor AddEntityDebugRenderer(this GraphicsCompositor graphicsCompositor, EntityDebugSceneRendererOptions? options = null)

Parameters

graphicsCompositor GraphicsCompositor

The GraphicsCompositor to which the entity debug renderer will be added.

options EntityDebugSceneRendererOptions

Optional settings to customize the appearance of the debug renderer. If not provided, default options will be used.

Returns

GraphicsCompositor

The modified GraphicsCompositor instance with the entity debug renderer added.

Examples

The following example demonstrates how to add an entity debug renderer with default settings:

graphicsCompositor.AddEntityDebugRenderer();

You can also specify custom options:

var options = new EntityDebugSceneRendererOptions { FontSize = 16, FontColor = Color.Red };
graphicsCompositor.AddEntityDebugRenderer(options);

Remarks

This method adds a custom EntityDebugSceneRenderer to the graphics compositor, allowing the display of debug information such as entity names and positions in a 3D scene. The renderer can be customized using the options parameter, which allows the user to define font size, color, and other settings.

AddEntityDebugSceneRenderer(Game, EntityDebugSceneRendererOptions?)

Adds an EntityDebugSceneRenderer to the game's GraphicsCompositor for rendering entity debug information.

public static void AddEntityDebugSceneRenderer(this Game game, EntityDebugSceneRendererOptions? options = null)

Parameters

game Game

The Game instance to which the entity debug renderer will be added.

options EntityDebugSceneRendererOptions

Optional settings to customize the appearance of the debug renderer. If not provided, default options will be used.

Examples

The following example demonstrates how to add an entity debug renderer with default settings:

game.AddEntityDebugSceneRenderer();

You can also specify custom options:

var options = new EntityDebugSceneRendererOptions { FontSize = 16, FontColor = Color.Red };
game.AddEntityDebugSceneRenderer(options);

Remarks

This method adds a custom EntityDebugSceneRenderer to the game's graphics compositor, allowing the display of debug information such as entity names and positions in a 3D scene. The renderer can be customized using the options parameter, which allows the user to define font size, color, and other settings.

IMPORTANT: This may significantly reduce frame rate. Use only for development or debugging, or in scenes with very few entities.

Exceptions

InvalidOperationException

Thrown if the GraphicsCompositor is not set in the game's SceneSystem.