@@ -696,12 +696,15 @@ void* DebugDraw::AllocateContext()
|
||||
|
||||
void DebugDraw::FreeContext(void* context)
|
||||
{
|
||||
ASSERT(context);
|
||||
Memory::DestructItem((DebugDrawContext*)context);
|
||||
Allocator::Free(context);
|
||||
}
|
||||
|
||||
void DebugDraw::UpdateContext(void* context, float deltaTime)
|
||||
{
|
||||
if (!context)
|
||||
context = &GlobalContext;
|
||||
((DebugDrawContext*)context)->DebugDrawDefault.Update(deltaTime);
|
||||
((DebugDrawContext*)context)->DebugDrawDepthTest.Update(deltaTime);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,18 @@
|
||||
#include "Engine/Scripting/ManagedCLR/MDomain.h"
|
||||
#include "Engine/Engine/Engine.h"
|
||||
#include "Engine/Platform/Platform.h"
|
||||
#if USE_EDITOR
|
||||
#if !COMPILE_WITH_DEBUG_DRAW
|
||||
#define COMPILE_WITH_DEBUG_DRAW 1
|
||||
#define COMPILE_WITH_DEBUG_DRAW_HACK
|
||||
#endif
|
||||
#include "Engine/Debug/DebugDraw.h"
|
||||
#ifdef COMPILE_WITH_DEBUG_DRAW_HACK
|
||||
#undef COMPILE_WITH_DEBUG_DRAW_HACK
|
||||
#undef COMPILE_WITH_DEBUG_DRAW
|
||||
#define COMPILE_WITH_DEBUG_DRAW 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Async DoDragDrop helper (used for rendering frames during main thread stall).
|
||||
@@ -23,6 +35,10 @@ public:
|
||||
Scripting::GetScriptsDomain()->Dispatch();
|
||||
while (Platform::AtomicRead(&ExitFlag) == 0)
|
||||
{
|
||||
#if USE_EDITOR
|
||||
// Flush any single-frame shapes to prevent memory leaking (eg. via terrain collision debug during scene drawing with PhysicsColliders or PhysicsDebug flag)
|
||||
DebugDraw::UpdateContext(nullptr, 0.0f);
|
||||
#endif
|
||||
Engine::OnDraw();
|
||||
Platform::Sleep(20);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user