Integrating up through commit 90f050496

This commit is contained in:
alexpete
2021-04-07 14:03:29 -07:00
parent 8f2ed080a9
commit c2cbd430fe
2694 changed files with 285622 additions and 176874 deletions
@@ -37,6 +37,8 @@
#include "Sprite.h"
#include "UiLayoutHelpers.h"
#include "RenderGraph.h"
namespace
{
//! Given a sprite with a cell index, populates the UV/ST coords array for traditional (stretched) 9-sliced image types.
@@ -372,6 +374,7 @@ void UiImageComponent::Render(LyShine::IRenderGraph* renderGraph)
ImageType imageType = m_imageType;
#ifdef LYSHINE_ATOM_TODO // support default white texture
// if there is no texture we will just use a white texture and want to stretch it
const bool spriteOrTextureIsNull = sprite == nullptr || sprite->GetTexture() == nullptr;
@@ -394,6 +397,12 @@ void UiImageComponent::Render(LyShine::IRenderGraph* renderGraph)
{
imageType = ImageType::Stretched;
}
#else
if (sprite == nullptr)
{
imageType = ImageType::Stretched;
}
#endif
switch (imageType)
{
@@ -454,12 +463,33 @@ void UiImageComponent::Render(LyShine::IRenderGraph* renderGraph)
}
}
#ifdef LYSHINE_ATOM_TODO // keeping this code for future phase (masks and render targets)
ITexture* texture = (sprite) ? sprite->GetTexture() : nullptr;
bool isClampTextureMode = m_imageType == ImageType::Tiled ? false : true;
bool isTextureSRGB = IsSpriteTypeRenderTarget() && m_isRenderTargetSRGB;
bool isTexturePremultipliedAlpha = false; // we are not rendering from a render target with alpha in it
renderGraph->AddPrimitive(&m_cachedPrimitive, texture, isClampTextureMode, isTextureSRGB, isTexturePremultipliedAlpha, m_blendMode);
#else
AZ::Data::Instance<AZ::RPI::Image> image;
if (sprite)
{
CSprite* cSprite = static_cast<CSprite*>(sprite); // LYSHINE_ATOM_TODO - find a different solution from downcasting
if (cSprite)
{
image = cSprite->GetImage();
}
}
bool isClampTextureMode = m_imageType == ImageType::Tiled ? false : true;
bool isTextureSRGB = IsSpriteTypeRenderTarget() && m_isRenderTargetSRGB;
bool isTexturePremultipliedAlpha = false; // we are not rendering from a render target with alpha in it
LyShine::RenderGraph* lyRenderGraph = static_cast<LyShine::RenderGraph*>(renderGraph); // LYSHINE_ATOM_TODO - find a different solution from downcasting
if (lyRenderGraph)
{
lyRenderGraph->AddPrimitiveAtom(&m_cachedPrimitive, image, isClampTextureMode, isTextureSRGB, isTexturePremultipliedAlpha, m_blendMode);
}
#endif
}
}