Renderer/DebugDrawer: Add DrawBoxCorners

This commit is contained in:
SirLynix 2023-10-08 23:38:03 +02:00
parent 98fe974fc8
commit 50c90fd725
2 changed files with 7 additions and 3 deletions

View File

@ -41,6 +41,7 @@ namespace Nz
void Draw(CommandBufferBuilder& builder);
inline void DrawBox(const Boxf& box, const Color& color);
inline void DrawBoxCorners(const EnumArray<BoxCorner, Vector3f>& boxCorners, const Color& color);
inline void DrawFrustum(const Frustumf& frustum, const Color& color);
inline void DrawLine(const Vector3f& start, const Vector3f& end, const Color& color);
inline void DrawLine(const Vector3f& start, const Vector3f& end, const Color& startColor, const Color& endColor);

View File

@ -26,10 +26,8 @@ namespace Nz
DrawLine({ max.x, min.y, min.z }, { max.x, min.y, max.z }, color);
}
inline void DebugDrawer::DrawFrustum(const Frustumf& frustum, const Color& color)
inline void DebugDrawer::DrawBoxCorners(const EnumArray<BoxCorner, Vector3f>& corners, const Color& color)
{
EnumArray<BoxCorner, Vector3f> corners = frustum.ComputeCorners();
DrawLine(corners[BoxCorner::NearLeftBottom], corners[BoxCorner::NearRightBottom], color);
DrawLine(corners[BoxCorner::NearLeftBottom], corners[BoxCorner::NearLeftTop], color);
DrawLine(corners[BoxCorner::NearLeftBottom], corners[BoxCorner::FarLeftBottom], color);
@ -44,6 +42,11 @@ namespace Nz
DrawLine(corners[BoxCorner::NearRightBottom], corners[BoxCorner::FarRightBottom], color);
}
inline void DebugDrawer::DrawFrustum(const Frustumf& frustum, const Color& color)
{
DrawBoxCorners(frustum.ComputeCorners(), color);
}
inline void DebugDrawer::DrawLine(const Vector3f& start, const Vector3f& end, const Color& color)
{
return DrawLine(start, end, color, color);