DebugDraw gem fixes for Atom (#885)

* Work in progress on adapting the DebugDraw gem to use AzFramework::DebugDisplayRequests API

* Cleanup fixes for DebugDisplayRequestBus & DebugDraw gem.

Remove SandboxIntegration implementation of the DebugDisplayRequestBus
Add DrawWireCylinder & DrawWireCone to the DebugDisplayRequestBus interface
Remove SetFillMode & DrawTexture functions from the DebugDisplayRequestBus interface
Fixup uses of the SetFillMode api, replace with new Draw[Wire|Solid]X functions.
Fixes to the DebugDraw gem to get it compiling with new warnings settings.

* Changes to get the DebugDraw gem working with Atom/RHI/Code/Include/Atom/RHI

Add GetWidth, GetHeight, GetDepth utility accessors to RHI::Viewport
Start cleaning out unnecessary Cry includes from DebugDraw gem
Fixes for AtomFont FFont.cpp 3d screen aligned text drawing.
Clean out no longer supported code for 3d text to render multiple strings for the same entity location

* Cleanup some unused or commented code

* Update with PR feedback from Nick Van Sickle
This commit is contained in:
rgba16f
2021-05-24 16:49:00 -05:00
committed by GitHub
parent 503848632c
commit d4bad61f9a
14 changed files with 180 additions and 907 deletions
@@ -576,6 +576,29 @@ namespace AZ::AtomBridge
}
}
void AtomDebugDisplayViewportInterface::DrawWireOBB(
const AZ::Vector3& center,
const AZ::Vector3& axisX,
const AZ::Vector3& axisY,
const AZ::Vector3& axisZ,
const AZ::Vector3& halfExtents)
{
if (m_auxGeomPtr)
{
AZ::Quaternion rotation = AZ::Quaternion::CreateFromMatrix3x3(AZ::Matrix3x3::CreateFromColumns(axisX, axisY, axisZ));
AZ::Obb obb = AZ::Obb::CreateFromPositionRotationAndHalfLengths(center, rotation, halfExtents);
m_auxGeomPtr->DrawObb(
obb,
AZ::Vector3::CreateZero(),
m_rendState.m_color,
AZ::RPI::AuxGeomDraw::DrawStyle::Line,
m_rendState.m_depthTest,
m_rendState.m_depthWrite,
m_rendState.m_faceCullMode,
m_rendState.m_viewProjOverrideIndex);
}
}
void AtomDebugDisplayViewportInterface::DrawSolidOBB(
const AZ::Vector3& center,
const AZ::Vector3& axisX,
@@ -906,7 +929,28 @@ namespace AZ::AtomBridge
}
}
void AtomDebugDisplayViewportInterface::DrawCone(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius, float height, bool drawShaded)
void AtomDebugDisplayViewportInterface::DrawWireCone(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius, float height)
{
if (m_auxGeomPtr)
{
const AZ::Vector3 worldPos = ToWorldSpacePosition(pos);
const AZ::Vector3 worldDir = ToWorldSpaceVector(dir);
m_auxGeomPtr->DrawCone(
worldPos,
worldDir,
radius,
height,
m_rendState.m_color,
AZ::RPI::AuxGeomDraw::DrawStyle::Line,
m_rendState.m_depthTest,
m_rendState.m_depthWrite,
m_rendState.m_faceCullMode,
m_rendState.m_viewProjOverrideIndex
);
}
}
void AtomDebugDisplayViewportInterface::DrawSolidCone(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius, float height, bool drawShaded)
{
if (m_auxGeomPtr)
{
@@ -1336,8 +1380,6 @@ namespace AZ::AtomBridge
{
AZ_Assert(false, "Unexpected use of legacy api, please file a feature request with the rendering team to get this implemented!");
}
// unhandledled on Atom - virtual void DrawTextureLabel(ITexture* texture, const AZ::Vector3& pos, float sizeX, float sizeY, int texIconFlags) override;
// void AtomDebugDisplayViewportInterface::DrawTextureLabel(int textureId, const AZ::Vector3& pos, float sizeX, float sizeY, int texIconFlags) override;
void AtomDebugDisplayViewportInterface::SetLineWidth(float width)
{