Add CustomScenes feature to draw a fixed set of scenes within SceneRenderTask
This commit is contained in:
@@ -8,11 +8,12 @@
|
||||
#include "Engine/Core/Collections/Sorting.h"
|
||||
#include "Engine/Debug/DebugLog.h"
|
||||
#include "Engine/Level/Level.h"
|
||||
#include "Engine/Level/Scene/Scene.h"
|
||||
#include "Engine/Level/Actors/Camera.h"
|
||||
#include "Engine/Level/Actors/PostFxVolume.h"
|
||||
#include "Engine/Renderer/Renderer.h"
|
||||
#include "Engine/Render2D/Render2D.h"
|
||||
#include "Engine/Engine/Engine.h"
|
||||
#include "Engine/Level/Actors/PostFxVolume.h"
|
||||
#include "Engine/Profiler/Profiler.h"
|
||||
#include "Engine/Renderer/RenderList.h"
|
||||
#include "Engine/Threading/Threading.h"
|
||||
@@ -202,15 +203,21 @@ void SceneRenderTask::CollectPostFxVolumes(RenderContext& renderContext)
|
||||
{
|
||||
Level::CollectPostFxVolumes(renderContext);
|
||||
}
|
||||
if (EnumHasAllFlags(ActorsSource , ActorsSources::CustomActors))
|
||||
if (EnumHasAllFlags(ActorsSource, ActorsSources::CustomActors))
|
||||
{
|
||||
for (Actor* a : CustomActors)
|
||||
{
|
||||
auto* postFxVolume = dynamic_cast<PostFxVolume*>(a);
|
||||
if (postFxVolume && a->GetIsActive())
|
||||
{
|
||||
postFxVolume->Collect(renderContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (EnumHasAllFlags(ActorsSource, ActorsSources::CustomScenes))
|
||||
{
|
||||
for (Scene* scene : CustomScenes)
|
||||
{
|
||||
if (scene && scene->IsActiveInHierarchy())
|
||||
scene->Rendering.CollectPostFxVolumes(renderContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -282,6 +289,14 @@ void SceneRenderTask::OnCollectDrawCalls(RenderContextBatch& renderContextBatch,
|
||||
ASSERT_LOW_LAYER(_customActorsScene);
|
||||
_customActorsScene->Draw(renderContextBatch, (SceneRendering::DrawCategory)category);
|
||||
}
|
||||
if (EnumHasAllFlags(ActorsSource, ActorsSources::CustomScenes))
|
||||
{
|
||||
for (Scene* scene : CustomScenes)
|
||||
{
|
||||
if (scene && scene->IsActiveInHierarchy())
|
||||
scene->Rendering.Draw(renderContextBatch, (SceneRendering::DrawCategory)category);
|
||||
}
|
||||
}
|
||||
if (EnumHasAllFlags(ActorsSource, ActorsSources::Scenes))
|
||||
{
|
||||
Level::DrawActors(renderContextBatch, category);
|
||||
|
||||
@@ -21,6 +21,7 @@ class PostProcessEffect;
|
||||
struct RenderContext;
|
||||
class Camera;
|
||||
class Actor;
|
||||
class Scene;
|
||||
|
||||
/// <summary>
|
||||
/// Allows to perform custom rendering using graphics pipeline.
|
||||
@@ -174,6 +175,11 @@ API_ENUM(Attributes="Flags") enum class ActorsSources
|
||||
/// </summary>
|
||||
CustomActors = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The scenes from the custom collection.
|
||||
/// </summary>
|
||||
CustomScenes = 4,
|
||||
|
||||
/// <summary>
|
||||
/// The actors from the loaded scenes and custom collection.
|
||||
/// </summary>
|
||||
@@ -267,9 +273,14 @@ public:
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// The custom set of actors to render.
|
||||
/// The custom set of actors to render. Used when ActorsSources::CustomActors flag is active.
|
||||
/// </summary>
|
||||
Array<Actor*> CustomActors;
|
||||
API_FIELD() Array<Actor*> CustomActors;
|
||||
|
||||
/// <summary>
|
||||
/// The custom set of scenes to render. Used when ActorsSources::CustomScenes flag is active.
|
||||
/// </summary>
|
||||
API_FIELD() Array<Scene*> CustomScenes;
|
||||
|
||||
/// <summary>
|
||||
/// Adds the custom actor to the rendering.
|
||||
|
||||
Reference in New Issue
Block a user