Class SceneRenderTask
Render task which draws scene actors into the output buffer.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Graphics/RenderTask.h
Syntax
public class SceneRenderTask : public RenderTask
Constructors
~SceneRenderTask()
Fields
_customActorsScene
Declaration
protected class SceneRendering* _customActorsScene = nullptr
Field Value
class SceneRendering
|
ActorsSource
The actors source to use (configures what objects to render).
Declaration
public ActorsSources ActorsSource = ActorsSources::Scenes
Field Value
ActorsSources
|
AllowGlobalCustomPostFx
True if allow using global custom PostFx when rendering this task.
Declaration
public bool AllowGlobalCustomPostFx = true
Field Value
bool
|
Buffers
The scene rendering buffers. Created and managed by the task.
Declaration
public RenderBuffers* Buffers = nullptr
Field Value
RenderBuffers
|
Camera
The scene rendering camera. Can be used to override the rendering view properties based on the current camera setup.
Declaration
public ScriptingObjectReference<Camera> Camera
Field Value
ScriptingObjectReference<Camera>
|
CollectDrawCalls
The action called on view rendering to collect draw calls. It allows to extend rendering pipeline and draw custom geometry non-existing in the scene or custom actors set.
Declaration
public Delegate<RenderContext> CollectDrawCalls
Field Value
Delegate<RenderContext>
|
CustomActors
The custom set of actors to render. Used when ActorsSources::CustomActors flag is active.
Declaration
public Array<Actor* > CustomActors
Field Value
Array<Actor >
|
CustomPostFx
The custom set of postfx to render.
Declaration
public Array<PostProcessEffect* > CustomPostFx
Field Value
Array<PostProcessEffect >
|
CustomScenes
The custom set of scenes to render. Used when ActorsSources::CustomScenes flag is active.
Declaration
public Array<Scene* > CustomScenes
Field Value
Array<Scene >
|
GlobalCustomPostFx
The custom set of global postfx to render for all SceneRenderTask (applied to tasks that have AllowGlobalCustomPostFx turned on).
Declaration
public static Array<PostProcessEffect* > GlobalCustomPostFx
Field Value
Array<PostProcessEffect >
|
IsCameraCut
True if the current frame is after the camera cut. Used to clear the temporal effects history and prevent visual artifacts blended from the previous frames.
Declaration
public bool IsCameraCut = true
Field Value
bool
|
IsCustomRendering
True if the task is used for custom scene rendering and default scene drawing into output should be skipped. Enable it if you use Render event and draw scene manually.
Declaration
public bool IsCustomRendering = false
Field Value
bool
|
Output
The output texture (can be null if using rendering to window swap chain). Can be used to redirect the default scene rendering output to a texture.
Declaration
public GPUTexture* Output = nullptr
Field Value
GPUTexture
|
PostRender
The action called after scene rendering. Can be used to render additional visual elements to the output.
Declaration
public Delegate<GPUContext* , RenderContext> PostRender
Field Value
Delegate<GPUContext , RenderContext>
|
PreRender
The action called after scene rendering. Can be used to perform custom pre-rendering or to modify the render view.
Declaration
public Delegate<GPUContext* , RenderContext> PreRender
Field Value
Delegate<GPUContext , RenderContext>
|
RenderingPercentage
The scale of the rendering resolution relative to the output dimensions. If lower than 1 the scene and postprocessing will be rendered at a lower resolution and upscaled to the output backbuffer.
Declaration
public float RenderingPercentage = 1.0f
Field Value
float
|
SetupRender
The action called before any rendering to override/customize setup RenderSetup inside RenderList. Can be used to enable eg. Motion Vectors rendering.
Declaration
public Delegate<RenderContext> SetupRender
Field Value
Delegate<RenderContext>
|
UpscaleLocation
The image resolution upscale location within rendering pipeline. Unused if RenderingPercentage is 1.
Declaration
public RenderingUpscaleLocation UpscaleLocation = RenderingUpscaleLocation::AfterAntiAliasingPass
Field Value
RenderingUpscaleLocation
|
View
Methods
AddCustomActor(Actor* actor)
Adds the custom actor to the rendering.
Declaration
public void AddCustomActor(Actor* actor)
Parameters
Actor
actor
The actor. |
AddCustomPostFx(PostProcessEffect* fx)
Adds the custom postfx to the rendering.
Declaration
public void AddCustomPostFx(PostProcessEffect* fx)
Parameters
PostProcessEffect
fx
The postfx script. |
AddGlobalCustomPostFx(PostProcessEffect* fx)
Adds the custom global postfx to the rendering.
Declaration
public static void AddGlobalCustomPostFx(PostProcessEffect* fx)
Parameters
PostProcessEffect
fx
The postfx script. |
CameraCut()
Marks the next rendered frame as camera cut. Used to clear the temporal effects history and prevent visual artifacts blended from the previous frames.
Declaration
public void CameraCut()
CanDraw()
Determines whether this task can be rendered.
Declaration
public virtual bool CanDraw() const override
Returns
bool
|
Overrides
ClearCustomActors()
Removes all the custom actors from the rendering.
Declaration
public void ClearCustomActors()
CollectPostFxVolumes(RenderContext& renderContext)
Calls collecting postFx volumes for rendering.
Declaration
public virtual void CollectPostFxVolumes(RenderContext& renderContext)
Parameters
RenderContext
renderContext
The rendering context. |
GetOutputView()
Gets the rendering output view.
Declaration
public GPUTextureView* GetOutputView() const
Returns
GPUTextureView
|
GetOutputViewport()
Gets the rendering output viewport (after upsampling).
Declaration
public Viewport GetOutputViewport() const
Returns
Viewport
|
GetViewport()
Gets the rendering render task viewport (before upsampling).
Declaration
public Viewport GetViewport() const
Returns
Viewport
|
OnBegin(GPUContext* context)
Called on task rendering begin.
Declaration
public virtual void OnBegin(GPUContext* context) override
Parameters
GPUContext
context
The GPU context. |
Overrides
OnCollectDrawCalls(RenderContextBatch& renderContextBatch, byte category = 0)
Calls drawing scene objects.
Declaration
public virtual void OnCollectDrawCalls(RenderContextBatch& renderContextBatch, byte category = 0)
Parameters
RenderContextBatch
renderContextBatch
The rendering context batch. |
byte
category
The actors category to draw (see SceneRendering::DrawCategory). |
OnEnd(GPUContext* context)
Called on task rendering end.
Declaration
public virtual void OnEnd(GPUContext* context) override
Parameters
GPUContext
context
The GPU context. |
Overrides
OnIdle()
Called by graphics device to idle task that has not been selected for drawing this frame (CanDraw returned false). Can be used to recycle cached memory if task is idle for many frames in a row.
Declaration
public virtual void OnIdle() override
Overrides
OnPostRender(GPUContext* context, RenderContext& renderContext)
Called after scene rendering. Can be used to render additional visual elements to the output.
Declaration
public virtual void OnPostRender(GPUContext* context, RenderContext& renderContext)
Parameters
GPUContext
context
The GPU commands context. |
RenderContext
renderContext
The rendering context. |
OnPreRender(GPUContext* context, RenderContext& renderContext)
Called before scene rendering. Can be used to perform custom pre-rendering or to modify the render view.
Declaration
public virtual void OnPreRender(GPUContext* context, RenderContext& renderContext)
Parameters
GPUContext
context
The GPU commands context. |
RenderContext
renderContext
The rendering context. |
OnRender(GPUContext* context)
Called on task rendering.
Declaration
public virtual void OnRender(GPUContext* context) override
Parameters
GPUContext
context
The GPU context. |
Overrides
RemoveCustomActor(Actor* actor)
Removes the custom actor from the rendering.
Declaration
public void RemoveCustomActor(Actor* actor)
Parameters
Actor
actor
The actor. |
RemoveCustomPostFx(PostProcessEffect* fx)
Removes the custom postfx from the rendering.
Declaration
public void RemoveCustomPostFx(PostProcessEffect* fx)
Parameters
PostProcessEffect
fx
The postfx script. |
RemoveGlobalCustomPostFx(PostProcessEffect* fx)
Removes the custom global postfx from the rendering.
Declaration
public static void RemoveGlobalCustomPostFx(PostProcessEffect* fx)
Parameters
PostProcessEffect
fx
The postfx script. |
Resize(int32 width, int32 height)
Changes the buffers and output size. Does nothing if size won't change. Called by window or user to resize rendering buffers.
Declaration
public virtual bool Resize(int32 width, int32 height) override
Parameters
int32
width
The width. |
int32
height
The height. |
Returns
bool
True if cannot resize the buffers. |