Fix DebugDraw DrawTriangles crash
This commit is contained in:
@@ -869,9 +869,9 @@ void DebugDraw::DrawTriangles(const Span<Vector3>& vertices, const Color& color,
|
||||
list = duration > 0 ? &DebugDrawDepthTest.DefaultTriangles : &DebugDrawDepthTest.OneFrameTriangles;
|
||||
else
|
||||
list = duration > 0 ? &DebugDrawDefault.DefaultTriangles : &DebugDrawDefault.OneFrameTriangles;
|
||||
list->EnsureCapacity(list->Count() + vertices.Length());
|
||||
list->EnsureCapacity(list->Count() + vertices.Length() / 3);
|
||||
|
||||
for (int32 i = 0; i < vertices.Length() * 3;)
|
||||
for (int32 i = 0; i < vertices.Length();)
|
||||
{
|
||||
t.V0 = vertices[i++];
|
||||
t.V1 = vertices[i++];
|
||||
@@ -881,6 +881,11 @@ void DebugDraw::DrawTriangles(const Span<Vector3>& vertices, const Color& color,
|
||||
}
|
||||
}
|
||||
|
||||
void DebugDraw::DrawTriangles(const Array<Vector3>& vertices, const Color& color, float duration, bool depthTest)
|
||||
{
|
||||
DrawTriangles(Span<Vector3>(vertices.Get(), vertices.Count()), color, duration, depthTest);
|
||||
}
|
||||
|
||||
void DebugDraw::DrawTriangles(const Span<Vector3>& vertices, const Span<int32>& indices, const Color& color, float duration, bool depthTest)
|
||||
{
|
||||
ASSERT(indices.Length() % 3 == 0);
|
||||
@@ -894,9 +899,9 @@ void DebugDraw::DrawTriangles(const Span<Vector3>& vertices, const Span<int32>&
|
||||
list = duration > 0 ? &DebugDrawDepthTest.DefaultTriangles : &DebugDrawDepthTest.OneFrameTriangles;
|
||||
else
|
||||
list = duration > 0 ? &DebugDrawDefault.DefaultTriangles : &DebugDrawDefault.OneFrameTriangles;
|
||||
list->EnsureCapacity(list->Count() + indices.Length());
|
||||
list->EnsureCapacity(list->Count() + indices.Length() / 3);
|
||||
|
||||
for (int32 i = 0; i < indices.Length() * 3;)
|
||||
for (int32 i = 0; i < indices.Length();)
|
||||
{
|
||||
t.V0 = vertices[indices[i++]];
|
||||
t.V1 = vertices[indices[i++]];
|
||||
@@ -906,6 +911,11 @@ void DebugDraw::DrawTriangles(const Span<Vector3>& vertices, const Span<int32>&
|
||||
}
|
||||
}
|
||||
|
||||
void DebugDraw::DrawTriangles(const Array<Vector3>& vertices, const Array<int32, HeapAllocation>& indices, const Color& color, float duration, bool depthTest)
|
||||
{
|
||||
DrawTriangles(Span<Vector3>(vertices.Get(), vertices.Count()), Span<int32>(indices.Get(), indices.Count()), color, duration, depthTest);
|
||||
}
|
||||
|
||||
void DebugDraw::DrawWireTube(const Vector3& position, const Quaternion& orientation, float radius, float length, const Color& color, float duration, bool depthTest)
|
||||
{
|
||||
// Check if has no length (just sphere)
|
||||
|
||||
Reference in New Issue
Block a user