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
GraphicsCompositorThe GraphicsCompositor to modify.
Returns
- GraphicsCompositor
Returns the modified GraphicsCompositor instance, allowing for method chaining.
Examples
game.AddGraphicsCompositor().AddCleanUIStage();
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
GraphicsCompositorThe GraphicsCompositor to which the entity debug renderer will be added.
options
EntityDebugSceneRendererOptionsOptional 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.EntityDebugSceneRenderer();
You can also specify custom options:
var options = new EntityDebugRendererOptions { FontSize = 16, FontColor = Color.Red };
graphicsCompositor.EntityDebugSceneRenderer(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.
AddParticleStagesAndFeatures(GraphicsCompositor)
public static void AddParticleStagesAndFeatures(this GraphicsCompositor graphicsCompositor)
Parameters
graphicsCompositor
GraphicsCompositor
AddRootRenderFeature(GraphicsCompositor, RootRenderFeature)
public static void AddRootRenderFeature(this GraphicsCompositor graphicsCompositor, RootRenderFeature renderFeature)
Parameters
graphicsCompositor
GraphicsCompositorrenderFeature
RootRenderFeature
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
GraphicsCompositorThe GraphicsCompositor to which the scene renderer will be added.
sceneRenderer
SceneRendererBaseThe 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
GraphicsCompositorThe GraphicsCompositor containing the render stages.
effectName
stringThe name of the render stage to search for.
renderStage
RenderStageWhen 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
.