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

Method DrawCircle

Source/Engine/Debug/DebugDraw.cpp:1483–1521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1481}
1482
1483void DebugDraw::DrawCircle(const Vector3& position, const Float3& normal, float radius, const Color& color, float duration, bool depthTest)
1484{
1485 // Create matrix transform for unit circle points
1486 Matrix world, scale, matrix;
1487 Float3 right, up;
1488 if (Float3::Dot(normal, Float3::Up) > 0.99f)
1489 right = Float3::Right;
1490 else if (Float3::Dot(normal, Float3::Down) > 0.99f)
1491 right = Float3::Left;
1492 else
1493 Float3::Cross(normal, Float3::Up, right);
1494 Float3::Cross(right, normal, up);
1495 Matrix::Scaling(radius, scale);
1496 const Float3 positionF = position - Context->Origin;
1497 Matrix::CreateWorld(positionF, normal, up, world);
1498 Matrix::Multiply(scale, world, matrix);
1499
1500 // Draw lines of the unit circle after linear transform
1501 PROFILE_MEM(EngineDebug);
1502 Float3 prev = Float3::Transform(CircleCache[0], matrix);
1503 auto& debugDrawData = depthTest ? Context->DebugDrawDepthTest : Context->DebugDrawDefault;
1504 for (int32 i = 1; i < DEBUG_DRAW_CIRCLE_VERTICES;)
1505 {
1506 Float3 cur = Float3::Transform(CircleCache[i++], matrix);
1507 if (duration > 0)
1508 {
1509 DebugLine l = { prev, cur, Color32(color), duration };
1510 debugDrawData.DefaultLines.Add(l);
1511 }
1512 else
1513 {
1514 Vertex l = { prev, Color32(color) };
1515 debugDrawData.OneFrameLines.Add(l);
1516 l.Position = cur;
1517 debugDrawData.OneFrameLines.Add(l);
1518 }
1519 prev = cur;
1520 }
1521}
1522
1523void DebugDraw::DrawWireTriangle(const Vector3& v0, const Vector3& v1, const Vector3& v2, const Color& color, float duration, bool depthTest)
1524{

Callers

nothing calls this directly

Calls 6

DotFunction · 0.85
ScalingFunction · 0.85
TransformClass · 0.70
MultiplyFunction · 0.50
Color32Class · 0.50
AddMethod · 0.45

Tested by

no test coverage detected