MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / DrawLines

Method DrawLines

Source/Engine/Debug/DebugDraw.cpp:1157–1195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1155}
1156
1157void DebugDraw::DrawLines(const Span<Float3>& lines, const Matrix& transform, const Color& color, float duration, bool depthTest)
1158{
1159 if (lines.Length() == 0)
1160 return;
1161 if (lines.Length() % 2 != 0)
1162 {
1163 DebugLog::ThrowException("Cannot draw debug lines with uneven amount of items in array");
1164 return;
1165 }
1166
1167 // Draw lines
1168 PROFILE_MEM(EngineDebug);
1169 const Float3* p = lines.Get();
1170 auto& debugDrawData = depthTest ? Context->DebugDrawDepthTest : Context->DebugDrawDefault;
1171 const Matrix transformF = transform * Matrix::Translation(-Context->Origin);
1172 if (duration > 0)
1173 {
1174 DebugLine l = { Float3::Zero, Float3::Zero, Color32(color), duration };
1175 debugDrawData.DefaultLines.EnsureCapacity(debugDrawData.DefaultLines.Count() + lines.Length());
1176 for (int32 i = 0; i < lines.Length(); i += 2)
1177 {
1178 Float3::Transform(*p++, transformF, l.Start);
1179 Float3::Transform(*p++, transformF, l.End);
1180 debugDrawData.DefaultLines.Add(l);
1181 }
1182 }
1183 else
1184 {
1185 Vertex l = { Float3::Zero, Color32(color) };
1186 debugDrawData.OneFrameLines.EnsureCapacity(debugDrawData.OneFrameLines.Count() + lines.Length() * 2);
1187 for (int32 i = 0; i < lines.Length(); i += 2)
1188 {
1189 Float3::Transform(*p++, transformF, l.Position);
1190 debugDrawData.OneFrameLines.Add(l);
1191 Float3::Transform(*p++, transformF, l.Position);
1192 debugDrawData.OneFrameLines.Add(l);
1193 }
1194 }
1195}
1196
1197void DebugDraw::DrawLines(GPUBuffer* lines, const Matrix& transform, float duration, bool depthTest)
1198{

Callers

nothing calls this directly

Calls 10

DrawLinesFunction · 0.85
AddOneMethod · 0.80
TransformClass · 0.70
Color32Class · 0.50
LengthMethod · 0.45
GetMethod · 0.45
EnsureCapacityMethod · 0.45
CountMethod · 0.45
AddMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected