Remove legacy renderer dependencies in LyShine and move LyShine headers to gem (#6049)

* Remove CryRenderer dependencies

Signed-off-by: abrmich <abrmich@amazon.com>

* Fix non-unity compile error

Signed-off-by: abrmich <abrmich@amazon.com>

* Remove ITexture.h reference

Signed-off-by: abrmich <abrmich@amazon.com>

* Simple file moves from CryCommon to LyShine Gem

Signed-off-by: abrmich <abrmich@amazon.com>

* More simple file moves from CryCommon to LyShine Gem

Signed-off-by: abrmich <abrmich@amazon.com>

* Move more headers from CryCommon to LyShine Gem

Signed-off-by: abrmich <abrmich@amazon.com>

* Add LyShine gem module as a build dependency to fix compile error in some gems

Signed-off-by: abrmich <abrmich@amazon.com>
This commit is contained in:
michabr
2021-12-02 14:47:32 -08:00
committed by GitHub
parent 28f38ca009
commit 4d5aad13d1
131 changed files with 329 additions and 318 deletions
+21 -14
View File
@@ -5,9 +5,9 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <IRenderer.h> // for SVF_P3F_C4B_T2F which will be removed in a coming PR
#include <LyShine/Draw2d.h>
#include <LyShine/UiRenderFormats.h>
#include "LyShinePassDataBus.h"
#include <AzCore/Math/Matrix3x3.h>
@@ -22,15 +22,23 @@
#include <Atom/RPI.Public/RPIUtils.h>
#include <Atom/RPI.Public/ViewportContextBus.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
// LOCAL STATIC FUNCTIONS
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
// Color to u32 => 0xAARRGGBB
static AZ::u32 PackARGB8888(const AZ::Color& color)
namespace
{
return (color.GetA8() << 24) | (color.GetR8() << 16) | (color.GetG8() << 8) | color.GetB8();
////////////////////////////////////////////////////////////////////////////////////////////////////
// Color to u32 => 0xAARRGGBB
AZ::u32 PackARGB8888(const AZ::Color& color)
{
return (color.GetA8() << 24) | (color.GetR8() << 16) | (color.GetG8() << 8) | color.GetB8();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Vertex format for Dynamic Draw Context
struct Draw2dVertex
{
Vec3 xyz;
LyShine::UCol color;
Vec2 st;
};
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -739,7 +747,7 @@ void CDraw2d::DeferredQuad::Draw(AZ::RHI::Ptr<AZ::RPI::DynamicDrawContext> dynam
const float z = 1.0f; // depth test disabled, if writing Z this will write at far plane
SVF_P3F_C4B_T2F vertices[NUM_VERTS];
Draw2dVertex vertices[NUM_VERTS];
const int vertIndex[NUM_VERTS] = {
0, 1, 3, 3, 1, 2
};
@@ -804,7 +812,7 @@ void CDraw2d::DeferredLine::Draw(AZ::RHI::Ptr<AZ::RPI::DynamicDrawContext> dynam
const int32 NUM_VERTS = 2;
SVF_P3F_C4B_T2F vertices[NUM_VERTS];
Draw2dVertex vertices[NUM_VERTS];
for (int i = 0; i < NUM_VERTS; ++i)
{
@@ -857,9 +865,9 @@ void CDraw2d::DeferredRectOutline::Draw(AZ::RHI::Ptr<AZ::RPI::DynamicDrawContext
AZ::RPI::ViewportContextPtr viewportContext) const
{
// Create the 8 verts in the right vertex format for the dynamic draw context
SVF_P3F_C4B_T2F vertices[NUM_VERTS];
Draw2dVertex vertices[NUM_VERTS];
const float z = 1.0f; // depth test disabled, if writing Z this will write at far plane
uint32 packedColor = (m_color.GetA8() << 24) | (m_color.GetR8() << 16) | (m_color.GetG8() << 8) | m_color.GetB8();
uint32 packedColor = PackARGB8888(m_color);
for (int i = 0; i < NUM_VERTS; ++i)
{
vertices[i].xyz = Vec3(m_verts2d[i].GetX(), m_verts2d[i].GetY(), z);
@@ -924,7 +932,6 @@ void CDraw2d::DeferredRectOutline::Draw(AZ::RHI::Ptr<AZ::RPI::DynamicDrawContext
// Add the primitive to the dynamic draw context for drawing
dynamicDraw->SetPrimitiveType(AZ::RHI::PrimitiveTopology::TriangleList);
dynamicDraw->DrawIndexed(vertices, NUM_VERTS, indices, NUM_INDICES, AZ::RHI::IndexFormat::Uint16, drawSrg);
}
////////////////////////////////////////////////////////////////////////////////////////////////////