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
graphicsCompositorGraphicsCompositorThe GraphicsCompositor to modify.
Returns
- GraphicsCompositor
Returns the modified GraphicsCompositor instance, allowing for method chaining.
Examples
game.AddGraphicsCompositor().AddCleanUIStage();
AddParticleStagesAndFeatures(GraphicsCompositor)
Adds particle rendering stages and features to the specified graphics compositor.
public static void AddParticleStagesAndFeatures(this GraphicsCompositor graphicsCompositor)
Parameters
graphicsCompositorGraphicsCompositorThe graphics compositor to which the particle stages and features will be added.
Remarks
This method configures the graphics compositor to support particle rendering by adding a ParticleEmitterRenderFeature. It requires the presence of both "Opaque" and "Transparent" render stages in the compositor. The method will throw a NullReferenceException if either stage is missing.
Exceptions
- NullReferenceException
Thrown if the "Opaque" or "Transparent" render stage is not found in the graphics compositor.
AddRootRenderFeature(GraphicsCompositor, RootRenderFeature)
Adds a root render feature to the specified graphics compositor.
public static void AddRootRenderFeature(this GraphicsCompositor graphicsCompositor, RootRenderFeature renderFeature)
Parameters
graphicsCompositorGraphicsCompositorThe graphics compositor to which the render feature will be added. Cannot be null.
renderFeatureRootRenderFeatureThe root render feature to add. Cannot be null.
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
graphicsCompositorGraphicsCompositorThe GraphicsCompositor to which the scene renderer will be added.
sceneRendererSceneRendererBaseThe 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
graphicsCompositorGraphicsCompositorThe GraphicsCompositor containing the render stages.
effectNamestringThe name of the render stage to search for.
renderStageRenderStageWhen this method returns, contains the RenderStage if the render stage was found; otherwise,
null. This parameter is passed uninitialized.
Returns
- bool
trueif the render stage is found; otherwise,false.