Skip to content

Instantly share code, notes, and snippets.

@sherief
Created April 13, 2022 00:35
Show Gist options
  • Select an option

  • Save sherief/cc74bd4f26130af3b396b9c7bfa61527 to your computer and use it in GitHub Desktop.

Select an option

Save sherief/cc74bd4f26130af3b396b9c7bfa61527 to your computer and use it in GitHub Desktop.
Jolt patch
From ca8c0459fee3e8c87791360eb87c370026a94fb6 Mon Sep 17 00:00:00 2001
From: Sherief Farouk <[email protected]>
Date: Tue, 12 Apr 2022 17:32:48 -0700
Subject: [PATCH] Added explicit PhysicsSystem::Teardown().
---
Jolt/Physics/PhysicsSystem.cpp | 10 ++++++++--
Jolt/Physics/PhysicsSystem.h | 1 +
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/Jolt/Physics/PhysicsSystem.cpp b/Jolt/Physics/PhysicsSystem.cpp
index 7cca608..c18f0cf 100644
--- a/Jolt/Physics/PhysicsSystem.cpp
+++ b/Jolt/Physics/PhysicsSystem.cpp
@@ -55,8 +55,14 @@ static const Color cColorStepListeners = Color::sGetDistinctColor(20);
PhysicsSystem::~PhysicsSystem()
{
- // Remove broadphase
- delete mBroadPhase;
+ Teardown();
+}
+
+void PhysicsSystem::Teardown()
+{
+ // Remove broadphase
+ delete mBroadPhase;
+ mBroadPhase = 0;
}
void PhysicsSystem::Init(uint inMaxBodies, uint inNumBodyMutexes, uint inMaxBodyPairs, uint inMaxContactConstraints, const BroadPhaseLayerInterface &inBroadPhaseLayerInterface, ObjectVsBroadPhaseLayerFilter inObjectVsBroadPhaseLayerFilter, ObjectLayerPairFilter inObjectLayerPairFilter)
diff --git a/Jolt/Physics/PhysicsSystem.h b/Jolt/Physics/PhysicsSystem.h
index a2e7545..f9355a7 100644
--- a/Jolt/Physics/PhysicsSystem.h
+++ b/Jolt/Physics/PhysicsSystem.h
@@ -27,6 +27,7 @@ public:
/// Constructor / Destructor
PhysicsSystem() : mContactManager(mPhysicsSettings) { }
~PhysicsSystem();
+ void Teardown();
/// Initialize the system.
/// @param inMaxBodies Maximum number of bodies to support.
--
2.25.0.windows.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment