Table of Contents

Class GraphicsCompositorExtensions

Namespace
Stride.CommunityToolkit.Rendering.Compositing
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

AddCleanUIStage(GraphicsCompositor)

Adds a UI render stage and white/clean text effect to the given GraphicsCompositor. This alters the GraphicsCompositor's PostProcessingEffects, RenderStage, and RenderFeature.

public static GraphicsCompositor AddCleanUIStage(this GraphicsCompositor graphicsCompositor)

Parameters

graphicsCompositor GraphicsCompositor

The GraphicsCompositor to modify.

Returns

GraphicsCompositor

Returns the modified GraphicsCompositor instance, allowing for method chaining.

Examples

game.AddGraphicsCompositor().AddCleanUIStage();

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 void AddImmediateDebugRenderFeature(this GraphicsCompositor graphicsCompositor)

Parameters

graphicsCompositor GraphicsCompositor

The GraphicsCompositor to modify.

Exceptions

NullReferenceException

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

AddSceneRenderer(GraphicsCompositor, SceneRendererBase)

Adds a new scene renderer to the given GraphicsCompositor's game. If the game is already a collection of scene renderers, the new scene renderer is added to that collection. Otherwise, a new scene renderer collection is created to house both the existing game and the new scene renderer.

public static GraphicsCompositor AddSceneRenderer(this GraphicsCompositor graphicsCompositor, SceneRendererBase sceneRenderer)

Parameters

graphicsCompositor GraphicsCompositor

The GraphicsCompositor to which the scene renderer will be added.

sceneRenderer SceneRendererBase

The new SceneRendererBase instance that will be added to the GraphicsCompositor's game.

Returns

GraphicsCompositor

Returns the modified GraphicsCompositor instance, allowing for method chaining.

Remarks

This method will either add the scene renderer to an existing SceneRendererCollection or create a new one to house both the existing game and the new scene renderer. In either case, the GraphicsCompositor's game will end up with the new scene renderer added.

TryGetRenderStage(GraphicsCompositor, string, out RenderStage?)

Attempts to retrieve a render stage from the specified GraphicsCompositor based on the provided effect name.

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. This parameter is passed uninitialized.

Returns

bool

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