diff --git a/Source/Engine/Debug/DebugDraw.cpp b/Source/Engine/Debug/DebugDraw.cpp
index 0e1768f63..1699626aa 100644
--- a/Source/Engine/Debug/DebugDraw.cpp
+++ b/Source/Engine/Debug/DebugDraw.cpp
@@ -1526,6 +1526,44 @@ void DebugDraw::DrawCircle(const Vector3& position, const Float3& normal, float
}
}
+void DebugDraw::DrawPoint(const Vector3& position, float radius, const Color& color, float duration, bool depthTest)
+{
+ Float3 normal = (Float3)(Context->LastViewPosition - position);
+ if (normal.Length() < ZeroTolerance)
+ normal = Float3::Up;
+ normal.Normalize();
+
+ // Create matrix transform for unit circle points
+ Matrix world, scale, matrix;
+ Float3 right, up;
+ if (Float3::Dot(normal, Float3::Up) > 0.99f)
+ right = Float3::Right;
+ else if (Float3::Dot(normal, Float3::Down) > 0.99f)
+ right = Float3::Left;
+ else
+ Float3::Cross(normal, Float3::Up, right);
+ Float3::Cross(right, normal, up);
+ Matrix::Scaling(radius, scale);
+ const Float3 positionF = position - Context->Origin;
+ Matrix::CreateWorld(positionF, normal, up, world);
+ Matrix::Multiply(scale, world, matrix);
+
+ // Build a filled disc as a triangle fan from the center over the transformed unit circle points
+ PROFILE_MEM(EngineDebug);
+ auto& debugDrawData = depthTest ? Context->DebugDrawDepthTest : Context->DebugDrawDefault;
+ auto& debugDrawList = duration > 0 ? debugDrawData.DefaultTriangles : debugDrawData.OneFrameTriangles;
+ for (int32 i = 0; i < DEBUG_DRAW_CIRCLE_VERTICES; i += 2)
+ {
+ DebugTriangle t;
+ t.Color = Color32(color);
+ t.TimeLeft = duration;
+ t.V0 = positionF;
+ t.V1 = Float3::Transform(CircleCache[i], matrix);
+ t.V2 = Float3::Transform(CircleCache[i + 1], matrix);
+ debugDrawList.Add(t);
+ }
+}
+
void DebugDraw::DrawWireTriangle(const Vector3& v0, const Vector3& v1, const Vector3& v2, const Color& color, float duration, bool depthTest)
{
DrawLine(v0, v1, color, duration, depthTest);
diff --git a/Source/Engine/Debug/DebugDraw.h b/Source/Engine/Debug/DebugDraw.h
index c4ae12283..9084ab962 100644
--- a/Source/Engine/Debug/DebugDraw.h
+++ b/Source/Engine/Debug/DebugDraw.h
@@ -267,6 +267,16 @@ API_CLASS(Static) class FLAXENGINE_API DebugDraw
/// The duration (in seconds). Use 0 to draw it only once.
/// If set to true depth test will be performed, otherwise depth will be ignored.
API_FUNCTION() static void DrawCircle(const Vector3& position, const Float3& normal, float radius, const Color& color = Color::White, float duration = 0.0f, bool depthTest = true);
+
+ ///
+ /// Draws the point facing camera.
+ ///
+ /// The center position.
+ /// The radius.
+ /// The color.
+ /// The duration (in seconds). Use 0 to draw it only once.
+ /// If set to true depth test will be performed, otherwise depth will be ignored.
+ API_FUNCTION() static void DrawPoint(const Vector3& position, float radius, const Color& color = Color::White, float duration = 0.0f, bool depthTest = true);
///
/// Draws the wireframe triangle.
@@ -780,6 +790,7 @@ API_CLASS(Static) class FLAXENGINE_API DebugDraw
#define DEBUG_DRAW_LINES(lines, transform, color, duration, depthTest) DebugDraw::DrawLines(lines, transform, color, duration, depthTest)
#define DEBUG_DRAW_BEZIER(p1, p2, p3, p4, color, duration, depthTest) DebugDraw::DrawBezier(p1, p2, p3, p4, color, duration, depthTest)
#define DEBUG_DRAW_CIRCLE(position, normal, radius, color, duration, depthTest) DebugDraw::DrawCircle(position, normal, radius, color, duration, depthTest)
+#define DEBUG_DRAW_POINT(position, radius, color, duration, depthTest) DebugDraw::DrawPoint(position, radius, color, duration, depthTest)
#define DEBUG_DRAW_TRIANGLE(v0, v1, v2, color, duration, depthTest) DebugDraw::DrawTriangle(v0, v1, v2, color, duration, depthTest)
#define DEBUG_DRAW_TRIANGLES(vertices, color, duration, depthTest) DebugDraw::DrawTriangles(vertices, color, duration, depthTest)
#define DEBUG_DRAW_TRIANGLES_EX(vertices, indices, color, duration, depthTest) DebugDraw::DrawTriangles(vertices, indices, color, duration, depthTest)