Addressed feedback from previous PR plus some cleanup
Signed-off-by: antonmic <56370189+antonmic@users.noreply.github.com>
This commit is contained in:
@@ -76,9 +76,12 @@ namespace AzFramework
|
|||||||
virtual void DrawSolidCone(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius, float height, bool drawShaded = true) { (void)pos; (void)dir; (void)radius; (void)height; (void)drawShaded; }
|
virtual void DrawSolidCone(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius, float height, bool drawShaded = true) { (void)pos; (void)dir; (void)radius; (void)height; (void)drawShaded; }
|
||||||
virtual void DrawWireCylinder(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height) { (void)center; (void)axis; (void)radius; (void)height; }
|
virtual void DrawWireCylinder(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height) { (void)center; (void)axis; (void)radius; (void)height; }
|
||||||
virtual void DrawSolidCylinder(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height, bool drawShaded = true) { (void)center; (void)axis; (void)radius; (void)height; (void)drawShaded; }
|
virtual void DrawSolidCylinder(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height, bool drawShaded = true) { (void)center; (void)axis; (void)radius; (void)height; (void)drawShaded; }
|
||||||
|
virtual void DrawWireCylinderNoEnds(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height) { (void)center; (void)axis; (void)radius; (void)height; }
|
||||||
|
virtual void DrawSolidCylinderNoEnds(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height, bool drawShaded = true) { (void)center; (void)axis; (void)radius; (void)height; (void)drawShaded; }
|
||||||
virtual void DrawWireCapsule(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float heightStraightSection) { (void)center; (void)axis; (void)radius; (void)heightStraightSection; }
|
virtual void DrawWireCapsule(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float heightStraightSection) { (void)center; (void)axis; (void)radius; (void)heightStraightSection; }
|
||||||
virtual void DrawWireSphere(const AZ::Vector3& pos, float radius) { (void)pos; (void)radius; }
|
virtual void DrawWireSphere(const AZ::Vector3& pos, float radius) { (void)pos; (void)radius; }
|
||||||
virtual void DrawWireSphere(const AZ::Vector3& pos, const AZ::Vector3 radius) { (void)pos; (void)radius; }
|
virtual void DrawWireSphere(const AZ::Vector3& pos, const AZ::Vector3 radius) { (void)pos; (void)radius; }
|
||||||
|
virtual void DrawWireHemisphere(const AZ::Vector3& pos, const AZ::Vector3& axis, float radius) { (void)pos; (void)axis; (void)radius; }
|
||||||
virtual void DrawWireDisk(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius) { (void)pos; (void)dir; (void)radius; }
|
virtual void DrawWireDisk(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius) { (void)pos; (void)dir; (void)radius; }
|
||||||
virtual void DrawBall(const AZ::Vector3& pos, float radius, bool drawShaded = true) { (void)pos; (void)radius; (void)drawShaded; }
|
virtual void DrawBall(const AZ::Vector3& pos, float radius, bool drawShaded = true) { (void)pos; (void)radius; (void)drawShaded; }
|
||||||
virtual void DrawDisk(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius) { (void)pos; (void)dir; (void)radius; }
|
virtual void DrawDisk(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius) { (void)pos; (void)dir; (void)radius; }
|
||||||
|
|||||||
@@ -322,9 +322,14 @@ namespace AZ
|
|||||||
return Matrix3x3::CreateFromColumns(unitOrthogonal, unitDirection, unitCross);
|
return Matrix3x3::CreateFromColumns(unitOrthogonal, unitDirection, unitCross);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AuxGeomDrawQueue::DrawSphere(const AZ::Vector3& center, const AZ::Vector3& direction, float radius, const AZ::Color& color, DrawStyle style, DepthTest depthTest, DepthWrite depthWrite, FaceCullMode faceCull, int32_t viewProjOverrideIndex)
|
||||||
|
{
|
||||||
|
DrawSphereCommon(center, direction, radius, color, style, depthTest, depthWrite, faceCull, viewProjOverrideIndex, false);
|
||||||
|
}
|
||||||
|
|
||||||
void AuxGeomDrawQueue::DrawSphere(const AZ::Vector3& center, float radius, const AZ::Color& color, DrawStyle style, DepthTest depthTest, DepthWrite depthWrite, FaceCullMode faceCull, int32_t viewProjOverrideIndex)
|
void AuxGeomDrawQueue::DrawSphere(const AZ::Vector3& center, float radius, const AZ::Color& color, DrawStyle style, DepthTest depthTest, DepthWrite depthWrite, FaceCullMode faceCull, int32_t viewProjOverrideIndex)
|
||||||
{
|
{
|
||||||
DrawSphereCommon(center, AZ::Vector3::CreateAxisY(), radius, color, style, depthTest, depthWrite, faceCull, viewProjOverrideIndex, false);
|
DrawSphereCommon(center, AZ::Vector3::CreateAxisZ(), radius, color, style, depthTest, depthWrite, faceCull, viewProjOverrideIndex, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuxGeomDrawQueue::DrawHemisphere(const AZ::Vector3& center, const AZ::Vector3& direction, float radius, const AZ::Color& color, DrawStyle style, DepthTest depthTest, DepthWrite depthWrite, FaceCullMode faceCull, int32_t viewProjOverrideIndex)
|
void AuxGeomDrawQueue::DrawHemisphere(const AZ::Vector3& center, const AZ::Vector3& direction, float radius, const AZ::Color& color, DrawStyle style, DepthTest depthTest, DepthWrite depthWrite, FaceCullMode faceCull, int32_t viewProjOverrideIndex)
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ namespace AZ
|
|||||||
// Fixed shape draws
|
// Fixed shape draws
|
||||||
void DrawQuad(float width, float height, const AZ::Matrix3x4& transform, const AZ::Color& color, DrawStyle style, DepthTest depthTest, DepthWrite depthWrite, FaceCullMode faceCull, int32_t viewProjOverrideIndex) override;
|
void DrawQuad(float width, float height, const AZ::Matrix3x4& transform, const AZ::Color& color, DrawStyle style, DepthTest depthTest, DepthWrite depthWrite, FaceCullMode faceCull, int32_t viewProjOverrideIndex) override;
|
||||||
void DrawSphere(const AZ::Vector3& center, float radius, const AZ::Color& color, DrawStyle style, DepthTest depthTest, DepthWrite depthWrite, FaceCullMode faceCull, int32_t viewProjOverrideIndex) override;
|
void DrawSphere(const AZ::Vector3& center, float radius, const AZ::Color& color, DrawStyle style, DepthTest depthTest, DepthWrite depthWrite, FaceCullMode faceCull, int32_t viewProjOverrideIndex) override;
|
||||||
|
void DrawSphere(const AZ::Vector3& center, const AZ::Vector3& direction, float radius, const AZ::Color& color, DrawStyle style, DepthTest depthTest, DepthWrite depthWrite, FaceCullMode faceCull, int32_t viewProjOverrideIndex) override;
|
||||||
void DrawHemisphere(const AZ::Vector3& center, const AZ::Vector3& direction, float radius, const AZ::Color& color, DrawStyle style, DepthTest depthTest, DepthWrite depthWrite, FaceCullMode faceCull, int32_t viewProjOverrideIndex) override;
|
void DrawHemisphere(const AZ::Vector3& center, const AZ::Vector3& direction, float radius, const AZ::Color& color, DrawStyle style, DepthTest depthTest, DepthWrite depthWrite, FaceCullMode faceCull, int32_t viewProjOverrideIndex) override;
|
||||||
void DrawDisk(const AZ::Vector3& center, const AZ::Vector3& direction, float radius, const AZ::Color& color, DrawStyle style, DepthTest depthTest, DepthWrite depthWrite, FaceCullMode faceCull, int32_t viewProjOverrideIndex) override;
|
void DrawDisk(const AZ::Vector3& center, const AZ::Vector3& direction, float radius, const AZ::Color& color, DrawStyle style, DepthTest depthTest, DepthWrite depthWrite, FaceCullMode faceCull, int32_t viewProjOverrideIndex) override;
|
||||||
void DrawCone(const AZ::Vector3& center, const AZ::Vector3& direction, float radius, float height, const AZ::Color& color, DrawStyle style, DepthTest depthTest, DepthWrite depthWrite, FaceCullMode faceCull, int32_t viewProjOverrideIndex) override;
|
void DrawCone(const AZ::Vector3& center, const AZ::Vector3& direction, float radius, float height, const AZ::Color& color, DrawStyle style, DepthTest depthTest, DepthWrite depthWrite, FaceCullMode faceCull, int32_t viewProjOverrideIndex) override;
|
||||||
|
|||||||
@@ -147,8 +147,21 @@ namespace AZ
|
|||||||
//! @param viewProjOverrideIndex Which view projection override entry to use, -1 if unused
|
//! @param viewProjOverrideIndex Which view projection override entry to use, -1 if unused
|
||||||
virtual void DrawSphere( const AZ::Vector3& center, float radius, const AZ::Color& color, DrawStyle style = DrawStyle::Shaded, DepthTest depthTest = DepthTest::On, DepthWrite depthWrite = DepthWrite::On, FaceCullMode faceCull = FaceCullMode::Back, int32_t viewProjOverrideIndex = -1) = 0;
|
virtual void DrawSphere( const AZ::Vector3& center, float radius, const AZ::Color& color, DrawStyle style = DrawStyle::Shaded, DepthTest depthTest = DepthTest::On, DepthWrite depthWrite = DepthWrite::On, FaceCullMode faceCull = FaceCullMode::Back, int32_t viewProjOverrideIndex = -1) = 0;
|
||||||
|
|
||||||
|
//! Draw a sphere.
|
||||||
|
//! @param center The center of the sphere.
|
||||||
|
//! @param direction The direction vector. The Pole of the hemisphere will point along this vector.
|
||||||
|
//! @param radius The radius.
|
||||||
|
//! @param color The color to draw the sphere.
|
||||||
|
//! @param style The draw style (point, wireframe, solid, shaded etc).
|
||||||
|
//! @param depthTest If depth testing should be enabled
|
||||||
|
//! @param depthWrite If depth writing should be enabled
|
||||||
|
//! @param faceCull Which (if any) facing triangles should be culled
|
||||||
|
//! @param viewProjOverrideIndex Which view projection override entry to use, -1 if unused
|
||||||
|
virtual void DrawSphere(const AZ::Vector3& center, const AZ::Vector3& direction, float radius, const AZ::Color& color, DrawStyle style = DrawStyle::Shaded, DepthTest depthTest = DepthTest::On, DepthWrite depthWrite = DepthWrite::On, FaceCullMode faceCull = FaceCullMode::Back, int32_t viewProjOverrideIndex = -1) = 0;
|
||||||
|
|
||||||
//! Draw a hemisphere.
|
//! Draw a hemisphere.
|
||||||
//! @param center The center of the sphere.
|
//! @param center The center of the sphere.
|
||||||
|
//! @param direction The direction vector. The Pole of the hemisphere will point along this vector.
|
||||||
//! @param radius The radius.
|
//! @param radius The radius.
|
||||||
//! @param color The color to draw the sphere.
|
//! @param color The color to draw the sphere.
|
||||||
//! @param style The draw style (point, wireframe, solid, shaded etc).
|
//! @param style The draw style (point, wireframe, solid, shaded etc).
|
||||||
|
|||||||
+74
-39
@@ -1016,6 +1016,55 @@ namespace AZ::AtomBridge
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AtomDebugDisplayViewportInterface::DrawWireCylinderNoEnds(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height)
|
||||||
|
{
|
||||||
|
if (m_auxGeomPtr)
|
||||||
|
{
|
||||||
|
const float scale = GetCurrentTransform().RetrieveScale().GetMaxElement();
|
||||||
|
const AZ::Vector3 worldCenter = ToWorldSpacePosition(center);
|
||||||
|
const AZ::Vector3 worldAxis = ToWorldSpaceVector(axis);
|
||||||
|
m_auxGeomPtr->DrawCylinderNoEnds(
|
||||||
|
worldCenter,
|
||||||
|
worldAxis,
|
||||||
|
scale * radius,
|
||||||
|
scale * 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::DrawSolidCylinderNoEnds(
|
||||||
|
const AZ::Vector3& center,
|
||||||
|
const AZ::Vector3& axis,
|
||||||
|
float radius,
|
||||||
|
float height,
|
||||||
|
bool drawShaded)
|
||||||
|
{
|
||||||
|
if (m_auxGeomPtr)
|
||||||
|
{
|
||||||
|
const float scale = GetCurrentTransform().RetrieveScale().GetMaxElement();
|
||||||
|
const AZ::Vector3 worldCenter = ToWorldSpacePosition(center);
|
||||||
|
const AZ::Vector3 worldAxis = ToWorldSpaceVector(axis);
|
||||||
|
m_auxGeomPtr->DrawCylinderNoEnds(
|
||||||
|
worldCenter,
|
||||||
|
worldAxis,
|
||||||
|
scale * radius,
|
||||||
|
scale * height,
|
||||||
|
m_rendState.m_color,
|
||||||
|
drawShaded ? AZ::RPI::AuxGeomDraw::DrawStyle::Shaded : AZ::RPI::AuxGeomDraw::DrawStyle::Solid,
|
||||||
|
m_rendState.m_depthTest,
|
||||||
|
m_rendState.m_depthWrite,
|
||||||
|
m_rendState.m_faceCullMode,
|
||||||
|
m_rendState.m_viewProjOverrideIndex
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AtomDebugDisplayViewportInterface::DrawWireCapsule(
|
void AtomDebugDisplayViewportInterface::DrawWireCapsule(
|
||||||
const AZ::Vector3& center,
|
const AZ::Vector3& center,
|
||||||
const AZ::Vector3& axis,
|
const AZ::Vector3& axis,
|
||||||
@@ -1030,52 +1079,19 @@ namespace AZ::AtomBridge
|
|||||||
const AZ::Vector3 worldCenter = ToWorldSpacePosition(center);
|
const AZ::Vector3 worldCenter = ToWorldSpacePosition(center);
|
||||||
const AZ::Vector3 worldAxis = ToWorldSpaceVector(axis);
|
const AZ::Vector3 worldAxis = ToWorldSpaceVector(axis);
|
||||||
|
|
||||||
// Draw cylinder part (or just a circle around the middle)
|
// Draw cylinder part (if cylinder height is too small, ignore cylinder and just draw both hemispheres)
|
||||||
if (heightStraightSection > FLT_EPSILON)
|
if (heightStraightSection > FLT_EPSILON)
|
||||||
{
|
{
|
||||||
m_auxGeomPtr->DrawCylinderNoEnds(
|
DrawWireCylinderNoEnds(worldCenter, worldAxis, scale * radius, scale * heightStraightSection);
|
||||||
worldCenter,
|
|
||||||
worldAxis,
|
|
||||||
scale * radius,
|
|
||||||
scale * heightStraightSection,
|
|
||||||
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
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AZ::Vector3 ortho1Normalized, ortho2Normalized;
|
|
||||||
CalcBasisVectors(axisNormalized, ortho1Normalized, ortho2Normalized);
|
|
||||||
AZ::Vector3 centerToTopCircleCenter = axisNormalized * heightStraightSection * 0.5f;
|
AZ::Vector3 centerToTopCircleCenter = axisNormalized * heightStraightSection * 0.5f;
|
||||||
AZ::Vector3 topCenter = center + centerToTopCircleCenter;
|
|
||||||
AZ::Vector3 bottomCenter = center - centerToTopCircleCenter;
|
|
||||||
|
|
||||||
m_auxGeomPtr->DrawHemisphere(
|
// Top hemisphere
|
||||||
topCenter,
|
DrawWireHemisphere(center + centerToTopCircleCenter, worldAxis, scale * radius);
|
||||||
worldAxis,
|
|
||||||
scale * radius,
|
|
||||||
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
|
|
||||||
);
|
|
||||||
|
|
||||||
m_auxGeomPtr->DrawHemisphere(
|
// Bottom hemisphere
|
||||||
bottomCenter,
|
DrawWireHemisphere(center - centerToTopCircleCenter, -worldAxis, scale * radius);
|
||||||
-worldAxis,
|
|
||||||
scale * radius,
|
|
||||||
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
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1122,6 +1138,25 @@ namespace AZ::AtomBridge
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AtomDebugDisplayViewportInterface::DrawWireHemisphere(const AZ::Vector3& pos, const AZ::Vector3& axis, float radius)
|
||||||
|
{
|
||||||
|
if (m_auxGeomPtr)
|
||||||
|
{
|
||||||
|
const float scale = GetCurrentTransform().RetrieveScale().GetMaxElement();
|
||||||
|
m_auxGeomPtr->DrawHemisphere(
|
||||||
|
ToWorldSpacePosition(pos),
|
||||||
|
axis,
|
||||||
|
scale * radius,
|
||||||
|
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::DrawWireDisk(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius)
|
void AtomDebugDisplayViewportInterface::DrawWireDisk(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius)
|
||||||
{
|
{
|
||||||
if (m_auxGeomPtr)
|
if (m_auxGeomPtr)
|
||||||
|
|||||||
@@ -168,9 +168,12 @@ namespace AZ::AtomBridge
|
|||||||
void DrawSolidCone(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius, float height, bool drawShaded) override;
|
void DrawSolidCone(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius, float height, bool drawShaded) override;
|
||||||
void DrawWireCylinder(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height) override;
|
void DrawWireCylinder(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height) override;
|
||||||
void DrawSolidCylinder(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height, bool drawShaded) override;
|
void DrawSolidCylinder(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height, bool drawShaded) override;
|
||||||
|
void DrawWireCylinderNoEnds(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height) override;
|
||||||
|
void DrawSolidCylinderNoEnds(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height, bool drawShaded) override;
|
||||||
void DrawWireCapsule(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float heightStraightSection) override;
|
void DrawWireCapsule(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float heightStraightSection) override;
|
||||||
void DrawWireSphere(const AZ::Vector3& pos, float radius) override;
|
void DrawWireSphere(const AZ::Vector3& pos, float radius) override;
|
||||||
void DrawWireSphere(const AZ::Vector3& pos, const AZ::Vector3 radius) override;
|
void DrawWireSphere(const AZ::Vector3& pos, const AZ::Vector3 radius) override;
|
||||||
|
void DrawWireHemisphere(const AZ::Vector3& pos, const AZ::Vector3& axis, float radius) override;
|
||||||
void DrawWireDisk(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius) override;
|
void DrawWireDisk(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius) override;
|
||||||
void DrawBall(const AZ::Vector3& pos, float radius, bool drawShaded) override;
|
void DrawBall(const AZ::Vector3& pos, float radius, bool drawShaded) override;
|
||||||
void DrawDisk(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius) override;
|
void DrawDisk(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user