This commit is contained in:
W2.Wizard
2021-02-06 11:29:48 +01:00
parent d27edbf5a9
commit 8a567f0849

View File

@@ -629,7 +629,11 @@ void DebugDraw::DrawLine(const Vector3& start, const Vector3& end, const Color&
void DebugDraw::DrawLines(const Span<Vector3>& lines, const Matrix& transform, const Color& color, float duration, bool depthTest)
{
ASSERT(lines.Length() % 2 == 0);
if (lines.Length() % 2 == 0)
{
LOG(Error, "Cannot draw debug lines with uneven amount of items in array");
return;
}
// Create draw call entry
DebugLine l = { Vector3::Zero, Vector3::Zero, Color32(color), duration };
@@ -637,10 +641,12 @@ void DebugDraw::DrawLines(const Span<Vector3>& lines, const Matrix& transform, c
// Add lines
const Vector3* p = lines.Get();
Array<DebugLine>* list;
if (depthTest)
if (depthTest)
list = duration > 0 ? &DebugDrawDepthTest.DefaultLines : &DebugDrawDepthTest.OneFrameLines;
else
else
list = duration > 0 ? &DebugDrawDefault.DefaultLines : &DebugDrawDefault.OneFrameLines;
list->EnsureCapacity(list->Count() + lines.Length());
for (int32 i = 0; i < lines.Length(); i += 2)
{