Add support for CanRender in postFx to depend on specific render setup
This commit is contained in:
@@ -43,6 +43,15 @@ public:
|
|||||||
{
|
{
|
||||||
return GetEnabled();
|
return GetEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether this effect can be rendered.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="renderContext">The target render context.</param>
|
||||||
|
API_FUNCTION() virtual bool CanRender(const RenderContext& renderContext) const
|
||||||
|
{
|
||||||
|
return CanRender();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Pre-rendering event called before scene rendering begin. Can be used to perform custom rendering or customize render view/setup.
|
/// Pre-rendering event called before scene rendering begin. Can be used to perform custom rendering or customize render view/setup.
|
||||||
|
|||||||
@@ -238,13 +238,13 @@ void SceneRenderTask::OnCollectDrawCalls(RenderContextBatch& renderContextBatch,
|
|||||||
{
|
{
|
||||||
for (PostProcessEffect* fx : GlobalCustomPostFx)
|
for (PostProcessEffect* fx : GlobalCustomPostFx)
|
||||||
{
|
{
|
||||||
if (fx && fx->CanRender())
|
if (fx && fx->CanRender(renderContext))
|
||||||
postFx.Add(fx);
|
postFx.Add(fx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (PostProcessEffect* fx : CustomPostFx)
|
for (PostProcessEffect* fx : CustomPostFx)
|
||||||
{
|
{
|
||||||
if (fx && fx->CanRender())
|
if (fx && fx->CanRender(renderContext))
|
||||||
postFx.Add(fx);
|
postFx.Add(fx);
|
||||||
}
|
}
|
||||||
if (const auto* camera = Camera.Get())
|
if (const auto* camera = Camera.Get())
|
||||||
@@ -252,7 +252,7 @@ void SceneRenderTask::OnCollectDrawCalls(RenderContextBatch& renderContextBatch,
|
|||||||
for (Script* script : camera->Scripts)
|
for (Script* script : camera->Scripts)
|
||||||
{
|
{
|
||||||
auto* fx = Cast<PostProcessEffect>(script);
|
auto* fx = Cast<PostProcessEffect>(script);
|
||||||
if (fx && fx->CanRender())
|
if (fx && fx->CanRender(renderContext))
|
||||||
postFx.Add(fx);
|
postFx.Add(fx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user