Преглед на файлове

Exposing GetActiveBodiesUnsafe

Jorrit Rouwe преди 2 години
родител
ревизия
ed4e4d4d90
променени са 1 файла, в които са добавени 5 реда и са изтрити 0 реда
  1. 5 0
      Jolt/Physics/PhysicsSystem.h

+ 5 - 0
Jolt/Physics/PhysicsSystem.h

@@ -103,6 +103,7 @@ public:
 	/// Simulate the system.
 	/// The world steps for a total of inDeltaTime seconds. This is divided in inCollisionSteps iterations. Each iteration
 	/// consists of collision detection followed by inIntegrationSubSteps integration steps.
+	/// This function internally spawns jobs using inJobSystem and waits for them to complete, so no jobs will be running when this function returns.
 	EPhysicsUpdateError			Update(float inDeltaTime, int inCollisionSteps, int inIntegrationSubSteps, TempAllocator *inTempAllocator, JobSystem *inJobSystem);
 
 	/// Saving state for replay
@@ -167,6 +168,10 @@ public:
 	/// @param outBodyIDs On return, this will contain the list of BodyIDs
 	void						GetActiveBodies(BodyIDVector &outBodyIDs) const				{ return mBodyManager.GetActiveBodies(outBodyIDs); }
 
+	/// Get the list of active bodies, use GetNumActiveBodies() to find out how long the list is.
+	/// Note: Not thread safe. The active bodies list can change at any moment when other threads are doing work. Use GetActiveBodies() if you need a thread safe version.
+	const BodyID *				GetActiveBodiesUnsafe() const								{ return mBodyManager.GetActiveBodiesUnsafe(); }
+
 	/// Check if 2 bodies were in contact during the last simulation step. Since contacts are only detected between active bodies, so at least one of the bodies must be active in order for this function to work.
 	/// It queries the state at the time of the last PhysicsSystem::Update and will return true if the bodies were in contact, even if one of the bodies was moved / removed afterwards.
 	/// This function can be called from any thread when the PhysicsSystem::Update is not running. During PhysicsSystem::Update this function is only valid during contact callbacks: