Fix debug drawing wheeled vehicle in prefab viewport

#3591
This commit is contained in:
Wojtek Figat
2025-08-29 21:03:44 +02:00
parent 5222f1d35c
commit 9fafb47abb
22 changed files with 102 additions and 100 deletions

View File

@@ -9,6 +9,7 @@
#include "Engine/Threading/JobSystem.h"
#include "Engine/Threading/Threading.h"
#include "Engine/Profiler/ProfilerCPU.h"
#include "Engine/Physics/Actors/IPhysicsDebug.h"
ISceneRenderingListener::~ISceneRenderingListener()
{
@@ -91,10 +92,10 @@ void SceneRendering::Draw(RenderContextBatch& renderContextBatch, DrawCategory c
if (EnumHasAnyFlags(view.Flags, ViewFlags::PhysicsDebug) || view.Mode == ViewMode::PhysicsColliders)
{
PROFILE_CPU_NAMED("PhysicsDebug");
const PhysicsDebugCallback* physicsDebugData = PhysicsDebug.Get();
const auto* physicsDebugData = PhysicsDebug.Get();
for (int32 i = 0; i < PhysicsDebug.Count(); i++)
{
physicsDebugData[i](view);
physicsDebugData[i]->DrawPhysicsDebug(view);
}
}

View File

@@ -11,6 +11,7 @@
class SceneRenderTask;
class SceneRendering;
class IPhysicsDebug;
struct PostProcessSettings;
struct RenderContext;
struct RenderContextBatch;
@@ -74,7 +75,6 @@ public:
class FLAXENGINE_API SceneRendering
{
#if USE_EDITOR
typedef Function<void(RenderView&)> PhysicsDebugCallback;
typedef Function<void(RenderView&)> LightsDebugCallback;
friend class ViewportIconsRendererService;
#endif
@@ -105,7 +105,7 @@ public:
private:
#if USE_EDITOR
Array<PhysicsDebugCallback> PhysicsDebug;
Array<IPhysicsDebug*> PhysicsDebug;
Array<LightsDebugCallback> LightsDebug;
Array<Actor*> ViewportIcons;
#endif
@@ -149,20 +149,14 @@ public:
}
#if USE_EDITOR
template<class T, void(T::*Method)(RenderView&)>
FORCE_INLINE void AddPhysicsDebug(T* obj)
FORCE_INLINE void AddPhysicsDebug(IPhysicsDebug* obj)
{
PhysicsDebugCallback f;
f.Bind<T, Method>(obj);
PhysicsDebug.Add(f);
PhysicsDebug.Add(obj);
}
template<class T, void(T::*Method)(RenderView&)>
void RemovePhysicsDebug(T* obj)
FORCE_INLINE void RemovePhysicsDebug(IPhysicsDebug* obj)
{
PhysicsDebugCallback f;
f.Bind<T, Method>(obj);
PhysicsDebug.Remove(f);
PhysicsDebug.Remove(obj);
}
template<class T, void(T::*Method)(RenderView&)>