Merge remote-tracking branch 'origin/master' into 1.9

This commit is contained in:
Wojtek Figat
2024-08-16 14:52:57 +02:00
47 changed files with 345 additions and 96 deletions

View File

@@ -27,6 +27,8 @@
#include "Engine/Render2D/FontAsset.h"
#if USE_EDITOR
#include "Editor/Editor.h"
#include "Engine/Level/Actors/Light.h"
#include "Engine/Physics/Colliders/Collider.h"
#endif
// Debug draw service configuration
@@ -950,9 +952,26 @@ void DebugDraw::DrawActorsTree(Actor* actor)
actor->TreeExecute(function);
}
#if USE_EDITOR
void DebugDraw::DrawColliderDebugPhysics(Collider* collider, RenderView& view)
{
if (!collider)
return;
collider->DrawPhysicsDebug(view);
}
void DebugDraw::DrawLightDebug(Light* light, RenderView& view)
{
if (!light)
return;
light->DrawLightsDebug(view);
}
#endif
void DebugDraw::DrawAxisFromDirection(const Vector3& origin, const Vector3& direction, float size, float duration, bool depthTest)
{
ASSERT(direction.IsNormalized());
CHECK_DEBUG(direction.IsNormalized());
const auto rot = Quaternion::FromDirection(direction);
const Vector3 up = (rot * Vector3::Up);
const Vector3 forward = (rot * Vector3::Forward);
@@ -978,7 +997,7 @@ void DebugDraw::DrawRay(const Vector3& origin, const Vector3& direction, const C
void DebugDraw::DrawRay(const Vector3& origin, const Vector3& direction, const Color& color, float length, float duration, bool depthTest)
{
ASSERT(direction.IsNormalized());
CHECK_DEBUG(direction.IsNormalized());
if (isnan(length) || isinf(length))
return;
DrawLine(origin, origin + (direction * length), color, duration, depthTest);

View File

@@ -8,6 +8,9 @@
#include "Engine/Core/Math/Color.h"
#include "Engine/Core/Types/Span.h"
struct RenderView;
class Collider;
class Light;
struct RenderContext;
class GPUTextureView;
class GPUContext;
@@ -70,9 +73,23 @@ API_CLASS(Static) class FLAXENGINE_API DebugDraw
/// <summary>
/// Draws the debug shapes for the given actor and the actor's children
/// </summary>
/// /// <param name="actor">The actor to start drawing at.</param>
/// <param name="actor">The actor to start drawing at.</param>
API_FUNCTION() static void DrawActorsTree(Actor* actor);
#if USE_EDITOR
/// <summary>
/// Draws the physics debug shapes for the given collider. Editor Only
/// </summary>
/// <param name="collider">The collider to draw.</param>
/// <param name="view">The render view to draw in.</param>
API_FUNCTION() static void DrawColliderDebugPhysics(Collider* collider, RenderView& view);
/// <summary>
/// Draws the light debug shapes for the given light. Editor Only
/// </summary>
/// <param name="light">The light debug to draw.</param>
/// <param name="view">The render view to draw in.</param>
API_FUNCTION() static void DrawLightDebug(Light* light, RenderView& view);
#endif
/// <summary>
/// Draws the lines axis from direction.
/// </summary>