From 3775df23a4ae0cbe3a43d42b4c019a3ea1852c8c Mon Sep 17 00:00:00 2001 From: Diren D Bharwani Date: Thu, 24 Nov 2022 14:43:41 +0800 Subject: [PATCH] Debug draw is disabled on publish builds. --- .../src/Application/SBApplication.cpp | 19 ++++++++++++------- .../src/Physics/System/SHPhysicsSystem.cpp | 8 ++++++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/SHADE_Application/src/Application/SBApplication.cpp b/SHADE_Application/src/Application/SBApplication.cpp index 06c42d2d..5aa1eb00 100644 --- a/SHADE_Application/src/Application/SBApplication.cpp +++ b/SHADE_Application/src/Application/SBApplication.cpp @@ -74,7 +74,9 @@ namespace Sandbox SHSystemManager::CreateSystem(); SHSystemManager::CreateSystem(); SHSystemManager::CreateSystem(); +#ifndef _PUBLISH SHSystemManager::CreateSystem(); +#endif SHSystemManager::CreateSystem(); SHSystemManager::CreateSystem(); @@ -114,7 +116,9 @@ namespace Sandbox SHSystemManager::RegisterRoutine(); SHSystemManager::RegisterRoutine(); +#ifndef _PUBLISH SHSystemManager::RegisterRoutine(); +#endif SHSystemManager::RegisterRoutine(); SHSystemManager::RegisterRoutine(); @@ -189,6 +193,13 @@ namespace Sandbox SHSystemManager::RunRoutines(false, SHFrameRateController::GetRawDeltaTime()); #endif // TODO: Move into an Editor menu + static bool drawContacts = false; + if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::F9)) + { + drawContacts = !drawContacts; + SHSystemManager::GetSystem()->SetDebugDrawFlag(SHPhysicsDebugDrawSystem::DebugDrawFlags::CONTACT_POINTS, drawContacts); + SHSystemManager::GetSystem()->SetDebugDrawFlag(SHPhysicsDebugDrawSystem::DebugDrawFlags::CONTACT_NORMALS, drawContacts); + } static bool drawColliders = false; if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::F10)) { @@ -201,13 +212,7 @@ namespace Sandbox drawRays = !drawRays; SHSystemManager::GetSystem()->SetDebugDrawFlag(SHPhysicsDebugDrawSystem::DebugDrawFlags::RAYCASTS, drawRays); } - static bool drawContacts = false; - if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::F9)) - { - drawContacts = !drawContacts; - SHSystemManager::GetSystem()->SetDebugDrawFlag(SHPhysicsDebugDrawSystem::DebugDrawFlags::CONTACT_POINTS, drawContacts); - SHSystemManager::GetSystem()->SetDebugDrawFlag(SHPhysicsDebugDrawSystem::DebugDrawFlags::CONTACT_NORMALS, drawContacts); - } + } // Finish all graphics jobs first graphicsSystem->AwaitGraphicsExecution(); diff --git a/SHADE_Engine/src/Physics/System/SHPhysicsSystem.cpp b/SHADE_Engine/src/Physics/System/SHPhysicsSystem.cpp index dd2cc091..79757867 100644 --- a/SHADE_Engine/src/Physics/System/SHPhysicsSystem.cpp +++ b/SHADE_Engine/src/Physics/System/SHPhysicsSystem.cpp @@ -173,7 +173,11 @@ namespace SHADE } worldState.CreateWorld(factory); +#ifdef _PUBLISH + worldState.world->setIsDebugRenderingEnabled(false); +#else worldState.world->setIsDebugRenderingEnabled(true); +#endif // Link Collision Listener & Raycaster collisionListener.BindToWorld(worldState.world); @@ -438,7 +442,11 @@ namespace SHADE return onPlayEvent->handle; worldState.CreateWorld(factory); +#ifdef _PUBLISH + worldState.world->setIsDebugRenderingEnabled(false); +#else worldState.world->setIsDebugRenderingEnabled(true); +#endif // Link Collision Listener & Raycaster collisionListener.BindToWorld(worldState.world);