Reenable support for UI Elements that use Render Targets (#2352)
* Re-add support for UI Elements that use Render Targets * Move LyShine pass request from Atom's MainPipeline.pass to project's * Make all dynamic draw contexts in LyShine draw to pass directly without the need of draw list tags * Remove local RPI changes that are no longer needed * Prevent crash if LyShine gem is enabled but its custom pass hasn't been added to the main render pipeline * Revert to default UI pass if the LyShine pass has not been added to project's main render pipeline Signed-off-by: abrmich <abrmich@amazon.com>
This commit is contained in:
@@ -301,6 +301,17 @@ void UiCanvasManager::OnFontTextureUpdated([[maybe_unused]] IFFont* font)
|
||||
m_fontTextureHasChanged = true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void UiCanvasManager::GetRenderTargets(LyShine::AttachmentImagesAndDependencies& attachmentImagesAndDependencies)
|
||||
{
|
||||
for (auto canvas : m_loadedCanvases)
|
||||
{
|
||||
LyShine::AttachmentImagesAndDependencies canvasTargets;
|
||||
canvas->GetRenderTargets(canvasTargets);
|
||||
attachmentImagesAndDependencies.insert(attachmentImagesAndDependencies.end(), canvasTargets.begin(), canvasTargets.end());
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void UiCanvasManager::OnCatalogAssetChanged(const AZ::Data::AssetId& assetId)
|
||||
{
|
||||
@@ -606,13 +617,6 @@ void UiCanvasManager::RenderLoadedCanvases()
|
||||
m_fontTextureHasChanged = false;
|
||||
}
|
||||
|
||||
#ifdef LYSHINE_ATOM_TODO // render target conversion to Atom
|
||||
// clear the stencil buffer before rendering the loaded canvases - required for masking
|
||||
// NOTE: We want to use ClearTargetsImmediately instead of ClearTargetsLater since we will not be setting the render target
|
||||
ColorF viewportBackgroundColor(0, 0, 0, 0); // if clearing color we want to set alpha to zero also
|
||||
gEnv->pRenderer->ClearTargetsImmediately(FRT_CLEAR_STENCIL, viewportBackgroundColor);
|
||||
#endif
|
||||
|
||||
for (auto canvas : m_loadedCanvases)
|
||||
{
|
||||
if (!canvas->GetIsRenderToTexture())
|
||||
|
||||
Reference in New Issue
Block a user