MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
physicsmanager.h
1 // © Copyright 2010 - 2014 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 #ifndef _physicsphysicsmanager_h
41 #define _physicsphysicsmanager_h
42 
43 //forward Declarations so that we do not need #include "btBulletDynamicsCommon.h"
44 class btAxisSweep3;
45 class btDefaultCollisionConfiguration;
46 class btCollisionDispatcher;
47 class btSequentialImpulseConstraintSolver;
48 class btSoftRigidDynamicsWorld;
49 class btDiscreteDynamicsWorld;
50 class btDynamicsWorld;
51 class btCollisionShape;
52 class btSoftBodyRigidBodyCollisionConfiguration;
53 class btGhostPairCallback;
54 class btBroadphaseInterface;
55 class btCollisionConfiguration;
56 class btThreadSupportInterface;
57 
58 typedef float btScalar;
59 
60 #include <map>
61 #include <vector>
62 
63 #include "datatypes.h"
64 #include "worldmanager.h"
65 #include "managerfactory.h"
66 #include "singleton.h"
67 #include "Physics/collidablepair.h"
68 #include "Physics/constraint.h"
69 #include "Physics/managerconstructioninfo.h"
70 #include "Threading/workunit.h"
71 #include "Threading/monopoly.h"
72 
73 namespace Mezzanine
74 {
75  // internal forward declarations
76  class Entresol;
77  class WorldTrigger;
78  namespace debug {
79  class InternalDebugDrawer;
80  }
81  namespace Physics
82  {
83  class Collision;
84  class CollisionDispatcher;
85  class ParallelCollisionDispatcher;
86  class PhysicsManager;
87  class CollidableProxy;
88  class GhostProxy;
89  class RigidProxy;
90  class SoftProxy;
91 
92  ///////////////////////////////////////////////////////////////////////////////
93  /// @brief This is a Mezzanine::Threading::iWorkUnit for the single threaded processing of physics simulations.
94  /// @details
95  ///////////////////////////////////////
97  {
98  protected:
99  /// @internal
100  /// @brief A pointer to the manager this work unit is processing.
102  /// @internal
103  /// @brief Protected copy constructor. THIS IS NOT ALLOWED.
104  /// @param Other The other work unit being copied from. WHICH WILL NEVER HAPPEN.
106  /// @internal
107  /// @brief Protected assignment operator. THIS IS NOT ALLOWED.
108  /// @param Other The other work unit being copied from. WHICH WILL NEVER HAPPEN.
109  SimulationWorkUnit& operator=(const SimulationWorkUnit& Other);
110  public:
111  /// @brief Class constructor.
112  /// @param Target The PhysicsManager this work unit will process during the frame.
114  /// @brief Class destructor.
115  virtual ~SimulationWorkUnit();
116 
117  ///////////////////////////////////////////////////////////////////////////////
118  // Utility
119 
120  /// @brief This does any required update of the Graphical Scene graph and REnders one frame
121  /// @param CurrentThreadStorage The storage class for all resources owned by this work unit during it's execution.
122  virtual void DoWork(Threading::DefaultThreadSpecificStorage::Type& CurrentThreadStorage);
123  };//SimulationWorkUnit
124 
125  ///////////////////////////////////////////////////////////////////////////////
126  /// @brief This is a Mezzanine::Threading::iWorkUnit for the multi-threaded processing of physics simulations.
127  /// @details
128  ///////////////////////////////////////
130  {
131  protected:
132  /// @internal
133  /// @brief A pointer to the manager this work unit is processing.
135  /// @internal
136  /// @brief Protected copy constructor. THIS IS NOT ALLOWED.
137  /// @param Other The other work unit being copied from. WHICH WILL NEVER HAPPEN.
139  /// @internal
140  /// @brief Protected assignment operator. THIS IS NOT ALLOWED.
141  /// @param Other The other work unit being copied from. WHICH WILL NEVER HAPPEN.
143  public:
144  /// @brief Class constructor.
145  /// @param Target The PhysicsManager this work unit will process during the frame.
147  /// @brief Class destructor.
148  virtual ~SimulationMonopolyWorkUnit();
149 
150  ///////////////////////////////////////////////////////////////////////////////
151  // Utility
152 
153  /// @brief Sets the number of threads this work unit is allowed to use during it's monopoly.
154  /// @param AmountToUse The number of threads permitted for use.
155  virtual void UseThreads(const Whole& AmountToUse);
156  /// @brief Gets the number of threads this work unit will attempt to use during it's monopoly.
157  /// @return Returns a Whole representing the number of threads that will be attempted to be created during running of this monopoly.
158  virtual Whole UsingThreadCount();
159  /// @brief This does any required update of the Graphical Scene graph and REnders one frame
160  /// @param CurrentThreadStorage The storage class for all resources owned by this work unit during it's execution.
161  virtual void DoWork(Threading::DefaultThreadSpecificStorage::Type& CurrentThreadStorage);
162  };//SimulationMonopolyWorkUnit
163 
164  ///////////////////////////////////////////////////////////////////////////////
165  /// @brief This is a Mezzanine::Threading::iWorkUnit for the updating of WorldTriggers.
166  /// @details
167  ///////////////////////////////////////
169  {
170  protected:
171  /// @internal
172  /// @brief A pointer to the manager this work unit is processing.
174  /// @internal
175  /// @brief Protected copy constructor. THIS IS NOT ALLOWED.
176  /// @param Other The other work unit being copied from. WHICH WILL NEVER HAPPEN.
178  /// @internal
179  /// @brief Protected assignment operator. THIS IS NOT ALLOWED.
180  /// @param Other The other work unit being copied from. WHICH WILL NEVER HAPPEN.
182  public:
183  /// @brief Class constructor.
184  /// @param Target The PhysicsManager this work unit will process during the frame.
186  /// @brief Class destructor.
187  virtual ~WorldTriggerUpdateWorkUnit();
188 
189  ///////////////////////////////////////////////////////////////////////////////
190  // Utility
191 
192  /// @brief This does any required update of the Graphical Scene graph and REnders one frame
193  /// @param CurrentThreadStorage The storage class for all resources owned by this work unit during it's execution.
194  virtual void DoWork(Threading::DefaultThreadSpecificStorage::Type& CurrentThreadStorage);
195  };//WorldTriggerUpdateWorkUnit
196 
197  ///////////////////////////////////////////////////////////////////////////////
198  /// @brief This is a Mezzanine::Threading::iWorkUnit for the updating of the physics debug drawer.
199  /// @details
200  ///////////////////////////////////////
202  {
203  protected:
204  /// @internal
205  /// @brief A pointer to the manager this work unit is processing.
207  /// @internal
208  /// @brief Protected copy constructor. THIS IS NOT ALLOWED.
209  /// @param Other The other work unit being copied from. WHICH WILL NEVER HAPPEN.
210  DebugDrawWorkUnit(const DebugDrawWorkUnit& Other);
211  /// @internal
212  /// @brief Protected assignment operator. THIS IS NOT ALLOWED.
213  /// @param Other The other work unit being copied from. WHICH WILL NEVER HAPPEN.
214  DebugDrawWorkUnit& operator=(const DebugDrawWorkUnit& Other);
215  public:
216  /// @brief Class constructor.
217  /// @param Target The PhysicsManager this work unit will process during the frame.
219  /// @brief Class destructor.
220  virtual ~DebugDrawWorkUnit();
221 
222  ///////////////////////////////////////////////////////////////////////////////
223  // Utility
224 
225  /// @brief This does any required update of the Graphical Scene graph and REnders one frame
226  /// @param CurrentThreadStorage The storage class for all resources owned by this work unit during it's execution.
227  virtual void DoWork(Threading::DefaultThreadSpecificStorage::Type& CurrentThreadStorage);
228  };//DebugDrawWorkUnit
229 
230  ///////////////////////////////////////////////////////////////////////////////
231  /// @brief This is simply a place for storing all the Physics Related functions
232  /// @details This is a place for storing items related to Debug physics
233  /// drawing, Adding constraints, screwing with gravity and doing other physics
234  /// Related features.
235  ///////////////////////////////////////
237  {
238  public:
239  /// @brief Basic container type for @ref CollidableProxy storage by this class.
240  typedef std::vector< CollidableProxy* > ProxyContainer;
241  /// @brief Iterator type for @ref CollidableProxy instances stored by this class.
242  typedef ProxyContainer::iterator ProxyIterator;
243  /// @brief Const Iterator type for @ref CollidableProxy instances stored by this class.
244  typedef ProxyContainer::const_iterator ConstProxyIterator;
245  /// @brief Basic container type for @ref Constraint storage by this class.
246  typedef std::vector< Constraint* > ConstraintContainer;
247  /// @brief Iterator type for @ref Constraint instances stored by this class.
248  typedef ConstraintContainer::iterator ConstraintIterator;
249  /// @brief Const Iterator type for @ref Constraint instances stored by this class.
250  typedef ConstraintContainer::const_iterator ConstConstraintIterator;
251  /// @brief Basic container type for @ref WorldTrigger storage by this class.
252  typedef std::vector< WorldTrigger* > WorldTriggerContainer;
253  /// @brief Iterator type for @ref WorldTrigger instances stored by this class.
254  typedef WorldTriggerContainer::iterator WorldTriggerIterator;
255  /// @brief Const Iterator type for @ref WorldTrigger instances stored by this class.
256  typedef WorldTriggerContainer::const_iterator ConstWorldTriggerIterator;
257  /// @brief Basic container type for @ref Collision storage by this class.
258  typedef std::map< CollidablePair, Collision* > CollisionContainer;
259  /// @brief Iterator type for @ref Collision instances stored by this class.
260  typedef CollisionContainer::iterator CollisionIterator;
261  /// @brief Const Iterator type for @ref Collision instances stored by this class.
262  typedef CollisionContainer::const_iterator ConstCollisionIterator;
263  /// @brief A std::pair to assist with collision sorting operations.
264  typedef std::pair< CollidablePair, Collision* > CollisionSortPair;
265  protected:
266  friend class CollisionDispatcher;
267  friend class ParallelCollisionDispatcher;
268  friend class SimulationWorkUnit;
269  friend class SimulationMonopolyWorkUnit;
270  friend class WorldTriggerUpdateWorkUnit;
271  friend class DebugDrawWorkUnit;
272 
273  //Some Data Items
274  bool SimulationPaused;
275  Integer DebugRenderMode;
276  Whole SubstepModifier;
277  Whole ThreadCount;
278  Real StepSize;
279 
280  ManagerConstructionInfo WorldConstructionInfo;
281 
282  ProxyContainer Proxies;
283  ConstraintContainer Constraints;
284  WorldTriggerContainer Triggers;
285  CollisionContainer Collisions;
286 
287  // Some Items bullet requires
288  btGhostPairCallback* GhostCallback;
289  btThreadSupportInterface* BulletSolverThreads;
290  btThreadSupportInterface* BulletDispatcherThreads;
291  btBroadphaseInterface* BulletBroadphase;
292  btCollisionConfiguration* BulletCollisionConfiguration;
293  btCollisionDispatcher* BulletDispatcher;
294  btSequentialImpulseConstraintSolver* BulletSolver;
295  btSoftRigidDynamicsWorld* BulletDynamicsWorld;
296  debug::InternalDebugDrawer* BulletDrawer;
297 
298  /// @internal
299  /// @brief The work unit that does the stepping of the simulation.
301  /// @internal
302  /// @brief The work unit that processes all world triggers.
304  /// @internal
305  /// @brief The work unit that updates the debug drawer with the latest physics rendering.
307  /// @internal
308  /// @brief Can be used for thread safe logging and other thread specific resources.
310 
311  /// @brief This takes care of all the real work in contructing this
312  /// @details This method is called by all the constructors to insure consistent behavior.
313  /// @param Info The construction info class with all the settings you wish the world to have.
314  virtual void Construct(const ManagerConstructionInfo& Info);
315  /// @brief Tear down this physics world
316  virtual void Destroy();
317 
318  /// @brief Calls the ConditionsAreMet() and ApplyTrigger() functions of every stored trigger.
319  /// @details This function is automatically called every step.
320  virtual void ProcessAllTriggers();
321  /// @brief Checks the internal collision data and generates/updates collisions as necessary.
322  /// @details This function is automatically called every step.
323  virtual void ProcessAllCollisions();
324 
325  /// @brief Internal Callback that is called each substep of the simulation.
326  static void InternalTickCallback(btDynamicsWorld* world, btScalar timeStep);
327  public:
328  /// @brief Simple Constructor
329  /// @details This constructor will assign some sane default values and will create a physics
330  /// world that can be used immediately
331  PhysicsManager();
332  /// @brief Simple Constructor
333  /// @details This constructor will assign some sane default values and will create a physics
334  /// world that can be used immediately
335  /// @param Info The construction info class with all the settings you wish the world to have.
337  /// @brief XML constructor.
338  /// @param XMLNode The node of the xml document to construct from.
339  PhysicsManager(XML::Node& XMLNode);
340  /// @brief Deconstructor
341  /// @details This deletes all those crazy pointers that Bullet, the physics subsystem need.
342  virtual ~PhysicsManager();
343 
344  ///////////////////////////////////////////////////////////////////////////////
345  // Simulation Management
346 
347  /// @brief Pauses the simulation, preventing the physics world from taking action.
348  /// @param Pause Wether or not to pause the simulation.
349  void PauseSimulation(bool Pause);
350  /// @brief Gets Whether or not the simulation is currently paused.
351  /// @return Returns whether or not the simulation is paused.
352  bool SimulationIsPaused();
353 
354  ///////////////////////////////////////////////////////////////////////////////
355  // Gravity Management
356 
357  /// @brief Sets the gravity.
358  /// @details Sets the strength and direction of gravity within the world.
359  /// @param pgrav Vector3 representing the strength and direction of gravity.
360  void SetWorldGravity(const Vector3& pgrav);
361  /// @brief Gets the gravity.
362  /// @details Gets the currently set world gravity.
363  /// @return Returns the currently set world gravity.
364  Vector3 GetWorldGravity();
365  /// @brief Sets the gravity for soft bodies.
366  /// @details Gravity for soft bodies is stored separately from rigid bodies. So if you plan to use soft bodies in your game/simulation
367  /// you need to call this function otherwise they won't fall.
368  /// @param sgrav Vector3 representing the strength and direction of gravity.
369  void SetWorldSoftGravity(const Vector3& sgrav);
370  /// @brief Gets the soft body gravity.
371  /// @details Gets the currently set soft body world gravity.
372  /// @return Returns the currently set soft body world gravity.
373  Vector3 GetWorldSoftGravity();
374 
375  ///////////////////////////////////////////////////////////////////////////////
376  // Creating Proxies
377 
378  /// @brief Creates a new GhostProxy.
379  /// @return Returns a pointer to the created proxy.
380  GhostProxy* CreateGhostProxy();
381  /// @brief Creates a new GhostProxy.
382  /// @param SelfRoot An XML::Node containing the data to populate this class with.
383  /// @return Returns a pointer to the created proxy.
384  GhostProxy* CreateGhostProxy(const XML::Node& SelfRoot);
385  /// @brief Creates a new RigidProxy.
386  /// @param Mass The mass of the new proxy.
387  /// @return Returns a pointer to the created proxy.
388  RigidProxy* CreateRigidProxy(const Real Mass);
389  /// @brief Creates a new RigidProxy.
390  /// @param SelfRoot An XML::Node containing the data to populate this class with.
391  /// @return Returns a pointer to the created proxy.
392  RigidProxy* CreateRigidProxy(const XML::Node& SelfRoot);
393  /// @brief Creates a new SoftProxy.
394  /// @param Mass The total mass of the new proxy.
395  /// @return Returns a pointer to the created proxy.
396  SoftProxy* CreateSoftProxy(const Real Mass);
397  /// @brief Creates a new SoftProxy.
398  /// @param SelfRoot An XML::Node containing the data to populate this class with.
399  /// @return Returns a pointer to the created proxy.
400  SoftProxy* CreateSoftProxy(const XML::Node& SelfRoot);
401 
402  ///////////////////////////////////////////////////////////////////////////////
403  // Proxy Management
404 
405  /// @brief Gets a CollidableProxy instance by index.
406  /// @param Index The index of the CollidableProxy to be retrieved.
407  /// @return Returns a pointer to the CollidableProxy at the specified index.
408  CollidableProxy* GetProxy(const UInt32 Index) const;
409  /// @brief Gets the number of CollidableProxy instances in this manager.
410  /// @return Returns a UInt32 representing the number of CollidableProxy instances contained in this manager.
411  UInt32 GetNumProxies() const;
412  /// @brief Deletes a CollidableProxy.
413  /// @param ToBeDestroyed A pointer to the CollidableProxy you want deleted.
414  void DestroyProxy(CollidableProxy* ToBeDestroyed);
415  /// @brief Deletes all stored CollidableProxy instances.
416  void DestroyAllProxies();
417 
418  ///////////////////////////////////////////////////////////////////////////////
419  // Constraint Management
420 
421  /// @brief Adds a constraint to the world.
422  /// @details Adds the constraint to the world so that it can/will take effect.
423  /// @param Con The constraint to be added.
424  /// @param DisableCollisions Sets whether or not the linked bodies collide with each other.
425  void AddConstraint(Physics::Constraint* Con, bool DisableCollisions = false);
426  /// @brief Gets a constraint by index.
427  /// @param Index The index of the constraint you want.
428  /// @return Returns a pointer to the specified constraint.
429  Physics::Constraint* GetConstraint(const Whole& Index);
430  /// @brief Gets the number of constraints currently in the world.
431  /// @return Returns a whole representing the number of constraints in the world.
432  Whole GetNumConstraints();
433  /// @brief Removes a constraint from the world.
434  /// @details Removes a constraint from the world so that it will have no effect.
435  /// @param Con The constraint to be removed.
436  void RemoveConstraint(Physics::Constraint* Con);
437  /// @brief Destroys all constraints currently in the manager.
438  /// @details In practice it is cleaner to remove constraints from the world before removing any constrained actors.
439  void DestroyAllConstraints();
440 
441  ///////////////////////////////////////////////////////////////////////////////
442  // Trigger Management
443 
444  /// @brief Adds a trigger to the world.
445  /// @details Adds a trigger to the world so that it can/will take effect.
446  /// @param Trig The trigger to be added.
447  void AddWorldTrigger(WorldTrigger* Trig);
448  /// @brief Gets a trigger by name.
449  /// @param Name The name of the trigger to find.
450  /// @return Returns a pointer to the named trigger, or NULL if it doesn't exist.
451  WorldTrigger* GetWorldTrigger(const String& Name);
452  /// @brief Gets a trigger by index.
453  /// @param Index The index of the trigger you want.
454  /// @return Returns a pointer to the trigger at the specified index.
455  WorldTrigger* GetWorldTrigger(const Whole& Index);
456  /// @brief Gets the number of triggers currently in the world.
457  /// @return Returns a whole representing the number of triggers in the world.
458  Whole GetNumWorldTriggers();
459  /// @brief Removes a trigger from the world.
460  /// @details Removes a trigger from the world so that it will have no effect.
461  /// @param Trig The trigger to be removed.
462  void RemoveWorldTrigger(WorldTrigger* Trig);
463  /// @brief Destroys all triggers currently in the manager.
464  void DestroyAllWorldTriggers();
465 
466  ///////////////////////////////////////////////////////////////////////////////
467  // Collision Management
468 
469  /// @brief Gets a Collision by collidable pair.
470  /// @param Pair A pair of CollidableProxies.
471  /// @return Returns a pointer to the Collision if a collision for the provided pair exists, NULL otherwise.
472  Physics::Collision* GetCollision(CollidablePair* Pair);
473  /// @brief Gets the number of Collisions currently in the world.
474  /// @return Returns a whole representing the number of Collisions in the world.
475  Whole GetNumCollisions();
476  /// @brief Removes an existing collision from the world.
477  /// @remarks In general it's not a great idea to call on this manually, but there are some situations where you would.
478  /// Mostly this function exists to facilitate removal of objects from the world before the simulation ends.
479  /// In such cases you have to clean up traces of the collision.
480  /// @param Col The collision to be removed.
481  void RemoveCollision(Physics::Collision* Col);
482  /// @brief Removes all stored collisions that involve the specified CollidableProxy.
483  /// @param Proxy The Proxy which will have all of it's collisions removed.
484  void RemoveCollisionsContainingProxy(CollidableProxy* Proxy);
485  /// @brief Destroys all collisions currently being stored and processed in the manager.
486  void DestroyAllCollisions();
487 
488  /// @brief Get an CollisionIterator to the first Collision.
489  /// @return An CollisionIterator to the first Collision.
490  CollisionIterator BeginCollision();
491  /// @brief Get a CollisionIterator to one past the last Collision.
492  /// @return A CollisionIterator to one past the last Collision.
493  CollisionIterator EndCollision();
494  /// @brief Get a ConstCollisionIterator to the first Collision.
495  /// @return A ConstCollisionIterator to the first Collision.
496  ConstCollisionIterator BeginCollision() const;
497  /// @brief Get a ConstCollisionIterator to one past the last Collision.
498  /// @return A ConstCollisionIterator to one past the last Collision.
499  ConstCollisionIterator EndCollision() const;
500 
501  ///////////////////////////////////////////////////////////////////////////////
502  // Debug Management
503 
504  /// @brief Enables and Disables Physics Debug Drawing
505  /// @details Enables and Disables Physics Debug Drawing using default wireframes. This will force renderings that match the physics
506  /// subsytem pixel for pixel.
507  /// @param DebugRenderingMode 1 to turn it on, 0 to turn it off. There may be other options in the future, to enable fine tuned control
508  void SetDebugRenderingMode(const Integer DebugRenderingMode);
509  /// @brief Is Physics Debug Drawing currently enabled?
510  /// @details lets you check if Physics Debug Drawing is enabled or not.
511  /// @return 1 for it is on, and 0 for it is not. The may be other options later for selectively cnacking certain features
512  Integer GetDebugRenderingMode() const;
513 
514  ///////////////////////////////////////////////////////////////////////////////
515  // Utility
516 
517  /// @brief Resets all the internal physics structures in this manager.
518  /// @warning This should only be called while the world is emtpy and objects have be unloaded from it.
519  /// @param Info If you want to change the configuration of the world when restarting, you can optionally
520  /// provide a new set of parameters to build the world with.
521  void ResetPhysicsWorld(ManagerConstructionInfo* Info = 0);
522  /// @brief Clears all data relating to actors and other simulation objects from the physics world.
523  /// @details This is best used with simulation cleanup.
524  void ClearPhysicsMetaData();
525  /// @brief Sets the modifier to be used when stepping the physics simulation.
526  /// @remarks For the most part, the simulation tick is determined by your target framerate set on Mezzanine::World. However
527  /// there are some occasions when you will want to have it tick more often, in particular with sensative simulation setups
528  /// involving many constraints, or small objects, or fast moving objects, or any combination of those. In order to make your
529  /// simulation more stable you have to tick in smaller intervals, making it less likely for the engine to miss something or
530  /// become unstable. When you pass in a modifier it'll ensure it ticks faster by that amount. For example, if you pass in 2
531  /// to this as the modifier, the physics simulation will take 2 smaller steps (the time being based on the target framerate)
532  /// instead of one big one during the course of one frame.
533  /// @param Modifier The amount of substeps per frame to perform.
534  void SetSimulationSubstepModifier(const Whole& Modifier);
535 
536  /// @copydoc WorldManager::Pause(const UInt32)
537  virtual void Pause(const UInt32 PL);
538 
539  /// @brief Does all of the necessary configuration to prepare for a running simulation.
540  void MainLoopInitialize();
541  /// @copydoc WorldManager::Initialize()
542  virtual void Initialize();
543  /// @copydoc ManagerBase::Deinitialize()
544  virtual void Deinitialize();
545 
546  /// @brief Gets a pointer to the work unit that steps the simulation.
547  /// @return Returns a pointer to the DefaultWorkUnit that steps the simulation.
548  Threading::DefaultWorkUnit* GetSimulationWork();
549  /// @brief Gets a pointer to the work unit that updates all WorldTriggers.
550  /// @return Returns a pointer to the WorldTriggerUpdateWorkUnit used by this manager.
551  WorldTriggerUpdateWorkUnit* GetWorldTriggerUpdateWork();
552  /// @brief Gets a pointer to the work unit that updates the debug drawer.
553  /// @return Returns a pointer to the DebugDrawWorkUnit used by this manager.
554  DebugDrawWorkUnit* GetDebugDrawWork();
555 
556  ///////////////////////////////////////////////////////////////////////////////
557  // Type Identifier Methods
558 
559  /// @copydoc ManagerBase::GetInterfaceType()
560  virtual ManagerType GetInterfaceType() const;
561  /// @copydoc ManagerBase::GetImplementationTypeName()
562  virtual String GetImplementationTypeName() const;
563 
564  ///////////////////////////////////////////////////////////////////////////////
565  // Internal Methods
566 
567  /// @internal
568  /// @brief This returns a pointer to the bullet physics world. This is for internal use only
569  btSoftRigidDynamicsWorld* _GetPhysicsWorldPointer();
570  /// @internal
571  /// @brief This returns a pointer to the bullet physics world. This is for internal use only
572  const btSoftRigidDynamicsWorld* _GetPhysicsWorldPointer() const;
573  };//PhysicsManager
574 
575  ///////////////////////////////////////////////////////////////////////////////
576  /// @class DefaultPhysicsManagerFactory
577  /// @headerfile physicsmanager.h
578  /// @brief A factory responsible for the creation and destruction of the default physicsmanager.
579  ///////////////////////////////////////
581  {
582  public:
583  /// @brief Class constructor.
585  /// @brief Class destructor.
586  virtual ~DefaultPhysicsManagerFactory();
587 
588  /// @copydoc ManagerFactory::GetManagerTypeName()
589  String GetManagerTypeName() const;
590  /// @copydoc ManagerFactory::CreateManager(NameValuePairList&)
591  ManagerBase* CreateManager(NameValuePairList& Params);
592 
593  /// @copydoc ManagerFactory::CreateManager(XML::Node&)
594  ManagerBase* CreateManager(XML::Node& XMLNode);
595 
596  /// @copydoc ManagerFactory::DestroyManager(ManagerBase*)
597  void DestroyManager(ManagerBase* ToBeDestroyed);
598  };//DefaultPhysicsManagerFactory
599  }//Physics
600 }//Mezzanine
601 
602 #endif