Class Gorgon2DCompositor
A compositor system used to chain multiple effects together.
Implements
Inherited Members
Namespace: Gorgon.Renderers
Assembly: Gorgon.Renderers.Gorgon2D.dll
Syntax
public class Gorgon2DCompositor : IDisposable, IGorgonGraphicsObject, IReadOnlyList<IGorgon2DCompositorPass>, IReadOnlyCollection<IGorgon2DCompositorPass>, IEnumerable<IGorgon2DCompositorPass>, IEnumerable
Remarks
This processor will take a scene and composite it using a series of effects (or plain rendering without effects). The results of these effects will be passed on to the next effect and rendered until all effects are processed. The final image is then output to a render target specified by the user.
Constructors
| Edit this page View SourceGorgon2DCompositor(Gorgon2D)
Initializes a new instance of the Gorgon2DCompositor class.
Declaration
public Gorgon2DCompositor(Gorgon2D renderer)
Parameters
Type | Name | Description |
---|---|---|
Gorgon2D | renderer | The renderer to use when rendering the effects. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
Properties
| Edit this page View SourceCount
Property to return the number of passes.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
Graphics
Property to return the graphics interface that built this object.
Declaration
public GorgonGraphics Graphics { get; }
Property Value
Type | Description |
---|---|
GorgonGraphics |
this[int]
Property to return the passes registered within the compositor by index.
Declaration
public IGorgon2DCompositorPass this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
int | index |
Property Value
Type | Description |
---|---|
IGorgon2DCompositorPass |
this[string]
Property to return the passes registered within the compositor by name.
Declaration
public IGorgon2DCompositorPass this[string name] { get; }
Parameters
Type | Name | Description |
---|---|---|
string | name |
Property Value
Type | Description |
---|---|
IGorgon2DCompositorPass |
Renderer
Property to return the renderer to use when rendering the scene.
Declaration
public Gorgon2D Renderer { get; }
Property Value
Type | Description |
---|---|
Gorgon2D |
Methods
| Edit this page View SourceClear()
Function to clear the effects from the compositor.
Declaration
public Gorgon2DCompositor Clear()
Returns
Type | Description |
---|---|
Gorgon2DCompositor | The fluent interface for the effects processor. |
DisablePass(int)
Function to disable a pass by index.
Declaration
public Gorgon2DCompositor DisablePass(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the pass to disable or disable. |
Returns
Type | Description |
---|---|
Gorgon2DCompositor | The fluent interface for the effects processor. |
DisablePass(string)
Function to disable a pass by name.
Declaration
public Gorgon2DCompositor DisablePass(string passName)
Parameters
Type | Name | Description |
---|---|---|
string | passName | The name of the pass to disable or disable. |
Returns
Type | Description |
---|---|
Gorgon2DCompositor | The fluent interface for the effects processor. |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
EffectPass(string, IGorgon2DCompositorEffect, GorgonColor?)
Function to add an effect, and an optional rendering action to the compositor queue.
Declaration
public Gorgon2DCompositor EffectPass(string name, IGorgon2DCompositorEffect effect, GorgonColor? clearColor = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | A name for the pass. |
IGorgon2DCompositorEffect | effect | The effect to add as a pass. |
GorgonColor? | clearColor | [Optional] The color used to clear the pass target with prior to rendering. |
Returns
Type | Description |
---|---|
Gorgon2DCompositor | The fluent interface for the effects processor. |
Remarks
If the clearColor
parameter is null, then the pass target will not be cleared.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
EnablePass(int)
Function to enable a pass by index.
Declaration
public Gorgon2DCompositor EnablePass(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the pass to enable or disable. |
Returns
Type | Description |
---|---|
Gorgon2DCompositor | The fluent interface for the effects processor. |
EnablePass(string)
Function to enable a pass by name.
Declaration
public Gorgon2DCompositor EnablePass(string passName)
Parameters
Type | Name | Description |
---|---|---|
string | passName | The name of the pass to enable or disable. |
Returns
Type | Description |
---|---|
Gorgon2DCompositor | The fluent interface for the effects processor. |
FinalClearColor(GorgonColor?)
Function to assign the color to use when clearing the final render target when rendering completes.
Declaration
public Gorgon2DCompositor FinalClearColor(GorgonColor? value)
Parameters
Type | Name | Description |
---|---|---|
GorgonColor? | value | The color to use when clearing. |
Returns
Type | Description |
---|---|
Gorgon2DCompositor | The fluent interface for the effects processor. |
Remarks
When this value is non-null, the very last rendering of the scene will clear the render target supplied by the user in the Render(GorgonTexture2DView, GorgonRenderTargetView) method to the value
specified. If the value is null, then the render target will not be cleared at all.
The default value is BlackTransparent.
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<IGorgon2DCompositorPass> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<IGorgon2DCompositorPass> | An enumerator that can be used to iterate through the collection. |
InitialClearColor(GorgonColor?)
Function to assign the color to use when clearing the initial render target when rendering begins.
Declaration
public Gorgon2DCompositor InitialClearColor(GorgonColor? value)
Parameters
Type | Name | Description |
---|---|---|
GorgonColor? | value | The color to use when clearing. |
Returns
Type | Description |
---|---|
Gorgon2DCompositor | The fluent interface for the effects processor. |
Remarks
When this value is non-null, the very first rendering of the scene will have its render target initialized to this color. If the value is null, then the render target will not be cleared at all.
The default value is BlackTransparent.
MovePass(int, int)
Function to move the pass at the specified index to a new location in the list.
Declaration
public Gorgon2DCompositor MovePass(int passIndex, int newPassIndex)
Parameters
Type | Name | Description |
---|---|---|
int | passIndex | The index of the pass to move. |
int | newPassIndex | The new index for the pass. |
Returns
Type | Description |
---|---|
Gorgon2DCompositor | The fluent interface for the effects processor. |
MovePass(string, int)
Function to move the pass with the specified name to a new location in the list.
Declaration
public Gorgon2DCompositor MovePass(string name, int newPassIndex)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the pass to move. |
int | newPassIndex | The new index for the pass. |
Returns
Type | Description |
---|---|
Gorgon2DCompositor | The fluent interface for the effects processor. |
RemovePass(int)
Function to remove the first matching pass in the effect chain.
Declaration
public Gorgon2DCompositor RemovePass(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the pass to remove. |
Returns
Type | Description |
---|---|
Gorgon2DCompositor | The fluent interface for the effects processor. |
RemovePass(string)
Function to remove the first matching pass in the effect chain.
Declaration
public Gorgon2DCompositor RemovePass(string effectName)
Parameters
Type | Name | Description |
---|---|---|
string | effectName | The name of the pass to remove. |
Returns
Type | Description |
---|---|
Gorgon2DCompositor | The fluent interface for the effects processor. |
Render(GorgonTexture2DView, GorgonRenderTargetView)
Function to render the scene for the compositor effects.
Declaration
public Gorgon2DCompositor Render(GorgonTexture2DView source, GorgonRenderTargetView output)
Parameters
Type | Name | Description |
---|---|---|
GorgonTexture2DView | source | The texture used to begin the post processing. |
GorgonRenderTargetView | output | The final output render target for the compositor. |
Returns
Type | Description |
---|---|
Gorgon2DCompositor | The fluent interface for the effects processor. |
RenderingPass(string, Action<Gorgon2D, GorgonTexture2DView, GorgonRenderTargetView>, Gorgon2DBatchState, GorgonCameraCommon)
Function to add a pass that will render without applying any effect.
Declaration
public Gorgon2DCompositor RenderingPass(string name, Action<Gorgon2D, GorgonTexture2DView, GorgonRenderTargetView> renderMethod, Gorgon2DBatchState batchState = null, GorgonCameraCommon camera = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | A name for the pass. |
Action<Gorgon2D, GorgonTexture2DView, GorgonRenderTargetView> | renderMethod | The callback method used to render the pass. |
Gorgon2DBatchState | batchState | [Optional] The batch rendering state to apply. |
GorgonCameraCommon | camera | [Optional] The camera to use when rendering the pass. |
Returns
Type | Description |
---|---|
Gorgon2DCompositor | The fluent interface for the effects processor. |
Remarks
This allows an application to render a scene without applying any kind of effect. The renderMethod
is a method that will take the following parameters:
- A renderer instance that can be used to draw.
- The last texture that was processed by a previous effect.
- The current render target.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |