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

Method DrawWireBox

Source/Engine/Debug/DebugDraw.cpp:1312–1345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1310}
1311
1312void DebugDraw::DrawWireBox(const BoundingBox& box, const Color& color, float duration, bool depthTest)
1313{
1314 // Get corners
1315 Vector3 corners[8];
1316 box.GetCorners(corners);
1317 for (Vector3& c : corners)
1318 c -= Context->Origin;
1319
1320 // Draw lines
1321 PROFILE_MEM(EngineDebug);
1322 auto& debugDrawData = depthTest ? Context->DebugDrawDepthTest : Context->DebugDrawDefault;
1323 if (duration > 0)
1324 {
1325 DebugLine l = { Float3::Zero, Float3::Zero, Color32(color), duration };
1326 for (uint32 i = 0; i < ARRAY_COUNT(BoxLineIndicesCache);)
1327 {
1328 l.Start = corners[BoxLineIndicesCache[i++]];
1329 l.End = corners[BoxLineIndicesCache[i++]];
1330 debugDrawData.DefaultLines.Add(l);
1331 }
1332 }
1333 else
1334 {
1335 // TODO: draw lines as strips to reuse vertices with a single draw call
1336 Vertex l = { Float3::Zero, Color32(color) };
1337 for (uint32 i = 0; i < ARRAY_COUNT(BoxLineIndicesCache);)
1338 {
1339 l.Position = corners[BoxLineIndicesCache[i++]];
1340 debugDrawData.OneFrameLines.Add(l);
1341 l.Position = corners[BoxLineIndicesCache[i++]];
1342 debugDrawData.OneFrameLines.Add(l);
1343 }
1344 }
1345}
1346
1347void DebugDraw::DrawWireFrustum(const BoundingFrustum& frustum, const Color& color, float duration, bool depthTest)
1348{

Callers 4

OnDebugDrawMethod · 0.45
OnDebugDrawMethod · 0.45
OnDebugDrawMethod · 0.45
OnDebugDrawMethod · 0.45

Calls 3

Color32Class · 0.50
GetCornersMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected