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

Method DrawWireFrustum

Source/Engine/Debug/DebugDraw.cpp:1347–1380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1345}
1346
1347void DebugDraw::DrawWireFrustum(const BoundingFrustum& frustum, const Color& color, float duration, bool depthTest)
1348{
1349 // Get corners
1350 Vector3 corners[8];
1351 frustum.GetCorners(corners);
1352 for (Vector3& c : corners)
1353 c -= Context->Origin;
1354
1355 // Draw lines
1356 PROFILE_MEM(EngineDebug);
1357 auto& debugDrawData = depthTest ? Context->DebugDrawDepthTest : Context->DebugDrawDefault;
1358 if (duration > 0)
1359 {
1360 DebugLine l = { Float3::Zero, Float3::Zero, Color32(color), duration };
1361 for (uint32 i = 0; i < ARRAY_COUNT(BoxLineIndicesCache);)
1362 {
1363 l.Start = corners[BoxLineIndicesCache[i++]];
1364 l.End = corners[BoxLineIndicesCache[i++]];
1365 debugDrawData.DefaultLines.Add(l);
1366 }
1367 }
1368 else
1369 {
1370 // TODO: draw lines as strips to reuse vertices with a single draw call
1371 Vertex l = { Float3::Zero, Color32(color) };
1372 for (uint32 i = 0; i < ARRAY_COUNT(BoxLineIndicesCache);)
1373 {
1374 l.Position = corners[BoxLineIndicesCache[i++]];
1375 debugDrawData.OneFrameLines.Add(l);
1376 l.Position = corners[BoxLineIndicesCache[i++]];
1377 debugDrawData.OneFrameLines.Add(l);
1378 }
1379 }
1380}
1381
1382void DebugDraw::DrawWireBox(const OrientedBoundingBox& box, const Color& color, float duration, bool depthTest)
1383{

Callers

nothing calls this directly

Calls 3

Color32Class · 0.50
GetCornersMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected