Fix selected spline points to be drawn relative to the view for greater readability

#2595
This commit is contained in:
Wojtek Figat
2025-01-31 21:01:26 +01:00
parent 42fc62eb68
commit 24f3dfe264
3 changed files with 21 additions and 6 deletions

View File

@@ -741,6 +741,11 @@ void DebugDraw::SetContext(void* context)
#endif
Vector3 DebugDraw::GetViewPos()
{
return Context->LastViewPos;
}
void DebugDraw::Draw(RenderContext& renderContext, GPUTextureView* target, GPUTextureView* depthBuffer, bool enableDepthTest)
{
PROFILE_GPU_CPU("Debug Draw");

View File

@@ -39,7 +39,7 @@ API_CLASS(Static) class FLAXENGINE_API DebugDraw
#if USE_EDITOR
/// <summary>
/// Allocates the context for Debug Drawing. Can be use to redirect debug shapes collecting to a separate container (instead of global state).
/// Allocates the context for Debug Drawing. Can be used to redirect debug shapes collecting to a separate container (instead of global state).
/// </summary>
/// <returns>The context object. Release it wil FreeContext. Returns null if failed.</returns>
API_FUNCTION() static void* AllocateContext();
@@ -64,6 +64,9 @@ API_CLASS(Static) class FLAXENGINE_API DebugDraw
API_FUNCTION() static void SetContext(void* context);
#endif
// Gets the last view position when rendering the current context. Can be sued for custom culling or LODing when drawing more complex shapes.
static Vector3 GetViewPos();
/// <summary>
/// Draws the collected debug shapes to the output.
/// </summary>
@@ -717,7 +720,7 @@ API_CLASS(Static) class FLAXENGINE_API DebugDraw
API_FUNCTION() static void Clear(void* context = nullptr);
};
#define DEBUG_DRAW_AXIS_FROM_DIRECTION(origin, direction, size, duration, depthTest) DebugDraw::DrawAxisFromDirection(origin, direction, size, duration, depthTest);
#define DEBUG_DRAW_AXIS_FROM_DIRECTION(origin, direction, size, duration, depthTest) DebugDraw::DrawAxisFromDirection(origin, direction, size, duration, depthTest);
#define DEBUG_DRAW_DIRECTION(origin, direction, color, duration, depthTest) DebugDraw::DrawDirection(origin, direction, color, duration, depthTest);
#define DEBUG_DRAW_RAY(origin, direction, color, length, duration, depthTest) DebugDraw::DrawRay(origin, direction, color, length, duration, depthTest);
#define DEBUG_DRAW_RAY(ray, color, length, duration, depthTest) DebugDraw::DrawRay(ray, color, length, duration, depthTest);