From a5fffc0c9ea6b5a430aafe89396d3700502e1601 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 4 Feb 2025 23:44:31 +0100 Subject: [PATCH] Fix `DebugDraw.DrawWireArc` with Large Worlds enabled #3049 --- Source/Engine/Debug/DebugDraw.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Debug/DebugDraw.cpp b/Source/Engine/Debug/DebugDraw.cpp index d19737dbb..09cf71d9e 100644 --- a/Source/Engine/Debug/DebugDraw.cpp +++ b/Source/Engine/Debug/DebugDraw.cpp @@ -2069,16 +2069,23 @@ void DebugDraw::DrawWireArc(const Vector3& position, const Quaternion& orientati prevPos = Float3(Math::Cos(TWO_PI - angleStep) * radius, Math::Sin(TWO_PI - angleStep) * radius, 0); Float3::Transform(prevPos, world, prevPos); } + const Color32 color32(color); + auto& debugDrawData = depthTest ? Context->DebugDrawDepthTest : Context->DebugDrawDefault; +#define ADD_LINE(a, b) if (duration > 0) debugDrawData.DefaultLines.Add({ a, b, color32, duration }); else { debugDrawData.OneFrameLines.Add({ a, color32 }); debugDrawData.OneFrameLines.Add({ b, color32 }); } for (int32 i = 0; i <= resolution; i++) { Float3 pos(Math::Cos(currentAngle) * radius, Math::Sin(currentAngle) * radius, 0); Float3::Transform(pos, world, pos); - DrawLine(prevPos, pos, color, duration, depthTest); + ADD_LINE(prevPos, pos); currentAngle += angleStep; prevPos = pos; } if (angle < TWO_PI) - DrawLine(prevPos, world.GetTranslation(), color, duration, depthTest); + { + Float3 pos(world.GetTranslation()); + ADD_LINE(prevPos, pos); + } +#undef ADD_LINE } void DebugDraw::DrawWireArrow(const Vector3& position, const Quaternion& orientation, float scale, float capScale, const Color& color, float duration, bool depthTest)