Spinning Topp Logo BlackTopp Studios
inc
physicsmanager.h
1 // © Copyright 2010 - 2016 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 "datatypes.h"
61 #ifndef SWIG
62  #include "uidgenerator.h"
63  #include "worldmanager.h"
64  #include "worldmanagerfactory.h"
65  #include "singleton.h"
66 
67  #include "Physics/collidablepair.h"
68  #include "Physics/constraint.h"
69  #include "Physics/managerconstructioninfo.h"
70 
71  #include "Threading/workunit.h"
72  #include "Threading/monopoly.h"
73 #endif
74 namespace Mezzanine
75 {
76  // internal forward declarations
77  class Entresol;
78  class World;
79  class WorldTrigger;
80  namespace debug {
81  class InternalDebugDrawer;
82  }
83  namespace Physics
84  {
85  class Collision;
86  class CollisionDispatcher;
87  class ParallelCollisionDispatcher;
88  class PhysicsManager;
89 
90  class CollidableProxy;
91  class CollisionShape;
92 
93  class GhostProxy;
94  class RigidProxy;
95  class SoftProxy;
96 
97  class ConeTwistConstraint;
98  class GearConstraint;
99  class Generic6DofConstraint;
100  class Generic6DofSpringConstraint;
101  class HingeConstraint;
102  class Hinge2Constraint;
103  class Point2PointConstraint;
104  class SliderConstraint;
105  class UniversalConstraint;
106 
107  ///////////////////////////////////////////////////////////////////////////////
108  /// @brief This is a Mezzanine::Threading::iWorkUnit for the single threaded processing of physics simulations.
109  /// @details
110  ///////////////////////////////////////
112  {
113  protected:
114  /// @internal
115  /// @brief A pointer to the manager this work unit is processing.
117  private:
118  /// @internal
119  /// @brief Protected copy constructor. THIS IS NOT ALLOWED.
120  /// @param Other The other work unit being copied from. WHICH WILL NEVER HAPPEN.
122  /// @internal
123  /// @brief Protected assignment operator. THIS IS NOT ALLOWED.
124  /// @param Other The other work unit being copied from. WHICH WILL NEVER HAPPEN.
125  SimulationWorkUnit& operator=(const SimulationWorkUnit& Other);
126  public:
127  /// @brief Class constructor.
128  /// @param Target The PhysicsManager this work unit will process during the frame.
130  /// @brief Class destructor.
131  virtual ~SimulationWorkUnit();
132 
133  ///////////////////////////////////////////////////////////////////////////////
134  // Utility
135 
136  /// @brief This does any required update of the Graphical Scene graph and REnders one frame
137  /// @param CurrentThreadStorage The storage class for all resources owned by this work unit during it's execution.
138  virtual void DoWork(Threading::DefaultThreadSpecificStorage::Type& CurrentThreadStorage);
139  };//SimulationWorkUnit
140 
141  ///////////////////////////////////////////////////////////////////////////////
142  /// @brief This is a Mezzanine::Threading::iWorkUnit for the multi-threaded processing of physics simulations.
143  /// @details
144  ///////////////////////////////////////
146  {
147  protected:
148  /// @internal
149  /// @brief A pointer to the manager this work unit is processing.
151  private:
152  /// @internal
153  /// @brief Private copy constructor. THIS IS NOT ALLOWED.
154  /// @param Other The other work unit being copied from. WHICH WILL NEVER HAPPEN.
156  /// @internal
157  /// @brief Protected assignment operator. THIS IS NOT ALLOWED.
158  /// @param Other The other work unit being copied from. WHICH WILL NEVER HAPPEN.
160  public:
161  /// @brief Class constructor.
162  /// @param Target The PhysicsManager this work unit will process during the frame.
164  /// @brief Class destructor.
165  virtual ~SimulationMonopolyWorkUnit();
166 
167  ///////////////////////////////////////////////////////////////////////////////
168  // Utility
169 
170  /// @brief A no-op but declared for compatibility with Monopoly work unit
171  /// @param AmountToUse The number of threads permitted for use, if this were implemented
172  virtual void UseThreads(const Whole& AmountToUse);
173  /// @brief Gets the number of threads this work unit will attempt to use during it's monopoly.
174  /// @return Returns a Whole representing the number of threads that will be attempted to be created during running of this monopoly.
175  virtual Whole UsingThreadCount();
176  /// @brief This does any required update of the Graphical Scene graph and REnders one frame
177  /// @param CurrentThreadStorage The storage class for all resources owned by this work unit during it's execution.
178  virtual void DoWork(Threading::DefaultThreadSpecificStorage::Type& CurrentThreadStorage);
179  };//SimulationMonopolyWorkUnit
180 
181  ///////////////////////////////////////////////////////////////////////////////
182  /// @brief This is a Mezzanine::Threading::iWorkUnit for the updating of WorldTriggers.
183  /// @details
184  ///////////////////////////////////////
186  {
187  protected:
188  /// @internal
189  /// @brief A pointer to the manager this work unit is processing.
191  /// @internal
192  /// @brief Protected copy constructor. THIS IS NOT ALLOWED.
193  /// @param Other The other work unit being copied from. WHICH WILL NEVER HAPPEN.
195  /// @internal
196  /// @brief Protected assignment operator. THIS IS NOT ALLOWED.
197  /// @param Other The other work unit being copied from. WHICH WILL NEVER HAPPEN.
199  public:
200  /// @brief Class constructor.
201  /// @param Target The PhysicsManager this work unit will process during the frame.
203  /// @brief Class destructor.
204  virtual ~WorldTriggerUpdateWorkUnit();
205 
206  ///////////////////////////////////////////////////////////////////////////////
207  // Utility
208 
209  /// @brief This does any required update of the Graphical Scene graph and REnders one frame
210  /// @param CurrentThreadStorage The storage class for all resources owned by this work unit during it's execution.
211  virtual void DoWork(Threading::DefaultThreadSpecificStorage::Type& CurrentThreadStorage);
212  };//WorldTriggerUpdateWorkUnit
213 
214  ///////////////////////////////////////////////////////////////////////////////
215  /// @brief This is a Mezzanine::Threading::iWorkUnit for the updating of the physics debug drawer.
216  /// @details
217  ///////////////////////////////////////
219  {
220  protected:
221  /// @internal
222  /// @brief A pointer to the manager this work unit is processing.
224  /// @internal
225  /// @brief Protected copy constructor. THIS IS NOT ALLOWED.
226  /// @param Other The other work unit being copied from. WHICH WILL NEVER HAPPEN.
227  DebugDrawWorkUnit(const DebugDrawWorkUnit& Other);
228  /// @internal
229  /// @brief Protected assignment operator. THIS IS NOT ALLOWED.
230  /// @param Other The other work unit being copied from. WHICH WILL NEVER HAPPEN.
231  DebugDrawWorkUnit& operator=(const DebugDrawWorkUnit& Other);
232  public:
233  /// @brief Class constructor.
234  /// @param Target The PhysicsManager this work unit will process during the frame.
236  /// @brief Class destructor.
237  virtual ~DebugDrawWorkUnit();
238 
239  ///////////////////////////////////////////////////////////////////////////////
240  // Utility
241 
242  /// @brief This does any required update of the Graphical Scene graph and REnders one frame
243  /// @param CurrentThreadStorage The storage class for all resources owned by this work unit during it's execution.
244  virtual void DoWork(Threading::DefaultThreadSpecificStorage::Type& CurrentThreadStorage);
245  };//DebugDrawWorkUnit
246 
247  ///////////////////////////////////////////////////////////////////////////////
248  /// @brief This is simply a place for storing all the Physics Related functions
249  /// @details This is a place for storing items related to Debug physics
250  /// drawing, Adding constraints, screwing with gravity and doing other physics
251  /// Related features.
252  ///////////////////////////////////////
254  {
255  public:
256  /// @brief Basic container type for @ref CollidableProxy storage by this class.
257  typedef std::vector< CollidableProxy* > ProxyContainer;
258  /// @brief Iterator type for @ref CollidableProxy instances stored by this class.
259  typedef ProxyContainer::iterator ProxyIterator;
260  /// @brief Const Iterator type for @ref CollidableProxy instances stored by this class.
261  typedef ProxyContainer::const_iterator ConstProxyIterator;
262  /// @brief Basic container type for @ref Constraint storage by this class.
263  typedef std::vector< Constraint* > ConstraintContainer;
264  /// @brief Iterator type for @ref Constraint instances stored by this class.
265  typedef ConstraintContainer::iterator ConstraintIterator;
266  /// @brief Const Iterator type for @ref Constraint instances stored by this class.
267  typedef ConstraintContainer::const_iterator ConstConstraintIterator;
268  /// @brief Basic container type for @ref WorldTrigger storage by this class.
269  typedef std::vector< WorldTrigger* > WorldTriggerContainer;
270  /// @brief Iterator type for @ref WorldTrigger instances stored by this class.
271  typedef WorldTriggerContainer::iterator WorldTriggerIterator;
272  /// @brief Const Iterator type for @ref WorldTrigger instances stored by this class.
273  typedef WorldTriggerContainer::const_iterator ConstWorldTriggerIterator;
274  /// @brief A std::pair to assist with collision sorting operations.
275  typedef std::pair< CollidablePair, Collision* > CollisionSortPair;
276  /// @brief Basic container type for @ref Collision storage by this class.
277  typedef std::vector< Collision* > CollisionContainer;
278  /// @brief Iterator type for @ref Collision instances stored by this class.
279  typedef CollisionContainer::iterator CollisionIterator;
280  /// @brief Const Iterator type for @ref Collision instances stored by this class.
281  typedef CollisionContainer::const_iterator ConstCollisionIterator;
282  /// @brief Container type for storing @ref Collision instances based on the pair of proxies that are colliding.
283  typedef std::map< CollidablePair, Collision* > CollisionMap;
284  /// @brief Iterator type for sorted @ref Collision instances.
285  typedef CollisionMap::iterator CollisionMapIterator;
286  /// @brief Const Iterator type for sorted @ref Collision instances.
287  typedef CollisionMap::const_iterator ConstCollisionMapIterator;
288 
289  /// @brief A String containing the name of this manager implementation.
291  /// @brief A ManagerType enum value used to describe the type of interface/functionality this manager provides.
293  protected:
294  friend class CollisionDispatcher;
295  friend class ParallelCollisionDispatcher;
296  friend class SimulationWorkUnit;
297  friend class SimulationMonopolyWorkUnit;
298  friend class WorldTriggerUpdateWorkUnit;
299  friend class DebugDrawWorkUnit;
300 
301  /// @internal
302  /// @brief A copy of the information used to initialize this manager.
304 
305  /// @internal
306  /// @brief Generator responsible for creating unique IDs for CollidableProxy instances.
308  /// @internal
309  /// @brief Generator responsible for creating unique IDs for Constraint instances.
311 
312  /// @internal
313  /// @brief A container storing all of the proxies owned by this manager.
314  ProxyContainer Proxies;
315  /// @internal
316  /// @brief A container storing all of the constraints owned by this manager.
317  ConstraintContainer Constraints;
318  /// @internal
319  /// @brief A container storing all of the worldtriggers owned by this manager.
320  WorldTriggerContainer Triggers;
321  /// @internal
322  /// @brief A container tracking all of the existing collisions in the physics world.
323  CollisionMap Collisions;
324 
325  /// @internal
326  /// @brief The amount of time (in seconds) a single simulation step should advance.
328  /// @internal
329  /// @brief A Multiplier that adjusts how fast physics runs relative to clock time.
331  /// @internal
332  /// @brief The current rendering mode for the debug drawer.
334  /// @internal
335  /// @brief A modifier that will determine how many substeps each frame the physics simulation should perform.
337  /// @internal
338  /// @brief The number of threads the internal thread providers should allocate.
340  /// @internal
341  /// @brief Whether or not the physics simulation is to step each frame.
343 
344  /// @internal
345  /// @brief A pointer to the callback that enables ghost objects internally.
346  btGhostPairCallback* GhostCallback;
347  /// @internal
348  /// @brief A pointer to the thread provider for the internal constraint solver.
349  btThreadSupportInterface* BulletSolverThreads;
350  /// @internal
351  /// @brief A pointer to the thread provider for the internal dispatcher (narrowphase).
352  btThreadSupportInterface* BulletDispatcherThreads;
353  /// @internal
354  /// @brief A pointer to the physics broadphase of the simulation.
355  btBroadphaseInterface* BulletBroadphase;
356  /// @internal
357  /// @brief A pointer to the internal collision configuration that enables certain types of objects to collide.
358  btCollisionConfiguration* BulletCollisionConfiguration;
359  /// @internal
360  /// @brief A pointer to the internal dispatcher (narrowphase).
361  btCollisionDispatcher* BulletDispatcher;
362  /// @internal
363  /// @brief A pointer to the internal constraint solver.
364  btSequentialImpulseConstraintSolver* BulletSolver;
365  /// @internal
366  /// @brief A pointer to the internal physics world.
367  btSoftRigidDynamicsWorld* BulletDynamicsWorld;
368  /// @internal
369  /// @brief A pointer to the debug drawer for rendering the physics world.
371 
372  /// @internal
373  /// @brief The work unit that does the stepping of the simulation.
375  /// @internal
376  /// @brief The work unit that processes all world triggers.
378  /// @internal
379  /// @brief The work unit that updates the debug drawer with the latest physics rendering.
381 
382  /// @brief This takes care of all the real work in contructing this
383  /// @details This method is called by all the constructors to insure consistent behavior.
384  /// @param Info The construction info class with all the settings you wish the world to have.
385  virtual void Construct(const ManagerConstructionInfo& Info);
386  /// @brief Tear down this physics world
387  virtual void Destroy();
388 
389  /// @brief Calls the ConditionsAreMet() and ApplyTrigger() functions of every stored trigger.
390  /// @details This function is automatically called every step.
391  virtual void ProcessAllTriggers();
392  /// @brief Checks the internal collision data and generates/updates collisions as necessary.
393  /// @details This function is automatically called every step.
394  virtual void ProcessAllCollisions();
395 
396  /// @brief The World that will be used for the InternalTickCallback
397  /// @warning The prevents two PhysicsManagers from running in two differen
399  /// @brief Internal Callback that is called each substep of the simulation.
400  static void InternalTickCallback(btDynamicsWorld* world, btScalar timeStep);
401  public:
402  /// @brief Default settings constructor.
403  /// @param Creator The parent world that is creating the manager.
404  PhysicsManager(World* Creator);
405  /// @brief More explicit constructor.
406  /// @param Creator The parent world that is creating the manager.
407  /// @param Info The construction info class with all the settings you wish the world to have.
408  PhysicsManager(World* Creator, const ManagerConstructionInfo& Info);
409  /// @brief XML constructor.
410  /// @param XMLNode The node of the xml document to construct from.
411  PhysicsManager(World* Creator, const XML::Node& XMLNode);
412  /// @brief Class destructor.
413  virtual ~PhysicsManager();
414 
415  ///////////////////////////////////////////////////////////////////////////////
416  // Simulation Management
417 
418  /// @brief Pauses the simulation, preventing the physics world from taking action.
419  /// @param Pause Wether or not to pause the simulation.
420  void PauseSimulation(Boole Pause);
421  /// @brief Gets Whether or not the simulation is currently paused.
422  /// @return Returns whether or not the simulation is paused.
423  Boole SimulationIsPaused();
424 
425  /// @brief How much faster or slower that reality is the physic ssystem
426  /// @return 1 indicates normal time, less indicates slower and higher indicates faster times
427  Real GetTimeMultiplier() const;
428  /// @brief Change how fast the physicsworks relatve to well time
429  /// @param value 2.0 to double simulation, .5 to half it.
430  void SetTimeMultiplier(const Real &value);
431 
432  ///////////////////////////////////////////////////////////////////////////////
433  // Gravity Management
434 
435  /// @brief Sets the gravity.
436  /// @details Sets the strength and direction of gravity within the world.
437  /// @param pgrav Vector3 representing the strength and direction of gravity.
438  void SetWorldGravity(const Vector3& pgrav);
439  /// @brief Gets the gravity.
440  /// @details Gets the currently set world gravity.
441  /// @return Returns the currently set world gravity.
442  Vector3 GetWorldGravity();
443  /// @brief Sets the gravity for soft bodies.
444  /// @details Gravity for soft bodies is stored separately from rigid bodies. So if you plan to use soft bodies in your game/simulation
445  /// you need to call this function otherwise they won't fall.
446  /// @param sgrav Vector3 representing the strength and direction of gravity.
447  void SetWorldSoftGravity(const Vector3& sgrav);
448  /// @brief Gets the soft body gravity.
449  /// @details Gets the currently set soft body world gravity.
450  /// @return Returns the currently set soft body world gravity.
451  Vector3 GetWorldSoftGravity();
452 
453  ///////////////////////////////////////////////////////////////////////////////
454  // Creating Proxies
455 
456  /// @brief Creates a new GhostProxy.
457  /// @return Returns a pointer to the created proxy.
458  GhostProxy* CreateGhostProxy();
459  /// @brief Creates a new GhostProxy.
460  /// @param Shape A pointer to the collision shape that will be applied to the new proxy.
461  /// @param AddToWorld Wether or not the new proxy should be added to the world after it has been created.
462  /// @return Returns a pointer to the created proxy.
463  GhostProxy* CreateGhostProxy(CollisionShape* Shape, const Boole AddToWorld);
464  /// @brief Creates a new GhostProxy.
465  /// @param SelfRoot An XML::Node containing the data to populate this class with.
466  /// @return Returns a pointer to the created proxy.
467  GhostProxy* CreateGhostProxy(const XML::Node& SelfRoot);
468 
469  /// @brief Creates a new RigidProxy.
470  /// @param Mass The mass of the new proxy.
471  /// @return Returns a pointer to the created proxy.
472  RigidProxy* CreateRigidProxy(const Real Mass);
473  /// @brief Creates a new RigidProxy.
474  /// @param Mass The mass of the new proxy.
475  /// @param AddToWorld Wether or not the new proxy should be added to the world after it has been created.
476  /// @param Shape A pointer to the collision shape that will be applied to the new proxy.
477  /// @return Returns a pointer to the created proxy.
478  RigidProxy* CreateRigidProxy(const Real Mass, CollisionShape* Shape, const Boole AddToWorld);
479  /// @brief Creates a new RigidProxy.
480  /// @param SelfRoot An XML::Node containing the data to populate this class with.
481  /// @return Returns a pointer to the created proxy.
482  RigidProxy* CreateRigidProxy(const XML::Node& SelfRoot);
483 
484  /// @brief Creates a new SoftProxy.
485  /// @param Mass The total mass of the new proxy.
486  /// @return Returns a pointer to the created proxy.
487  SoftProxy* CreateSoftProxy(const Real Mass);
488  /// @brief Creates a new SoftProxy.
489  /// @param SelfRoot An XML::Node containing the data to populate this class with.
490  /// @return Returns a pointer to the created proxy.
491  SoftProxy* CreateSoftProxy(const XML::Node& SelfRoot);
492 
493  ///////////////////////////////////////////////////////////////////////////////
494  // Proxy Management
495 
496  /// @brief Gets a CollidableProxy instance by index.
497  /// @param Index The index of the CollidableProxy to be retrieved.
498  /// @return Returns a pointer to the CollidableProxy at the specified index.
499  CollidableProxy* GetProxy(const UInt32 Index) const;
500  /// @brief Gets the n-th proxy of the specified type.
501  /// @note This manager only stores CollidableProxy types. As such, specifying a type of proxy that isn't derived from CollidableProxy will always return NULL.
502  /// @param Type The type of proxy to retrieve.
503  /// @param Which Which proxy of the specified type to retrieve.
504  /// @return Returns a pointer to the specified proxy, or NULL if there is no n-th proxy.
505  CollidableProxy* GetProxy(const Mezzanine::ProxyType Type, UInt32 Which) const;
506  /// @brief Gets the CollidableProxy via its ID.
507  /// @param ID The unique identifier belonging to the Proxy.
508  /// @return Returns a pointer to the CollidableProxy with the specified ID.
509  CollidableProxy* GetProxyByID(const UInt32 ID) const;
510  /// @brief Gets the number of CollidableProxy instances in this manager.
511  /// @return Returns a UInt32 representing the number of CollidableProxy instances contained in this manager.
512  UInt32 GetNumProxies() const;
513  /// @brief Deletes a CollidableProxy.
514  /// @param ToBeDestroyed A pointer to the CollidableProxy you want deleted.
515  void DestroyProxy(CollidableProxy* ToBeDestroyed);
516  /// @brief Deletes all stored CollidableProxy instances.
517  void DestroyAllProxies();
518 
519  #ifndef SWIG
520  /// @brief Gets an iterator to the first Collidable Proxy in this manager.
521  /// @return Returns an iterator to the first Collidable Proxy being stored by this manager.
522  ProxyIterator BeginCollidableProxy();
523  /// @brief Gets an iterator to one passed the last Collidable Proxy in this manager.
524  /// @return Returns an iterator to one passed the last Collidable Proxy being stored by this manager.
525  ProxyIterator EndCollidableProxy();
526  /// @brief Gets a const iterator to the first Collidable Proxy in this manager.
527  /// @return Returns a const iterator to the first Collidable Proxy being stored by this manager.
528  ConstProxyIterator BeginCollidableProxy() const;
529  /// @brief Gets a const iterator to one passed the last Collidable Proxy in this manager.
530  /// @return Returns a const iterator to one passed the last Collidable Proxy being stored by this manager.
531  ConstProxyIterator EndCollidableProxy() const;
532  #endif
533 
534  ///////////////////////////////////////////////////////////////////////////////
535  // Constraint Creation
536 
537  /// @brief Creates a new ConeTwistConstraint.
538  /// @param ProxyA The first proxy to apply this constraint to.
539  /// @param ProxyB The second proxy to apply this constraint to.
540  /// @param TransA The transform in ProxyA's local space to attach this constraint to.
541  /// @param TransB The transform in ProxyB's local space to attach this constraint to.
542  /// @return Returns a pointer to the created constraint.
543  ConeTwistConstraint* CreateConeTwistConstraint(RigidProxy* ProxyA, RigidProxy* ProxyB, const Transform& TransA, const Transform& TransB);
544  /// @brief Creates a new ConeTwistConstraint.
545  /// @param ProxyA The first proxy to apply this constraint to.
546  /// @param TransA The transform in ProxyA's local space to attach this constraint to.
547  /// @return Returns a pointer to the created constraint.
548  ConeTwistConstraint* CreateConeTwistConstraint(RigidProxy* ProxyA, const Transform& TransA);
549  /// @brief Creates a new ConeTwistConstraint.
550  /// @param SelfRoot An XML::Node containing the data to populate this class with.
551  /// @return Returns a pointer to the created constraint.
552  ConeTwistConstraint* CreateConeTwistConstraint(const XML::Node& SelfRoot);
553 
554  /// @brief Creates a new GearConstraint.
555  /// @param ProxyA The first proxy to apply this constraint to.
556  /// @param ProxyB The second proxy to apply this constraint to.
557  /// @param PivotA The axis in ProxyA's local space to apply the constraint to.
558  /// @param PivotB The axis in ProxyB's local space to apply the constraint to.
559  /// @return Returns a pointer to the created constraint.
560  GearConstraint* CreateGearConstraint(RigidProxy* ProxyA, RigidProxy* ProxyB, const Vector3& AxisA, const Vector3& AxisB);
561  /// @brief Creates a new GearConstraint.
562  /// @param ProxyA The first proxy to apply this constraint to.
563  /// @param ProxyB The second proxy to apply this constraint to.
564  /// @param PivotA The axis in ProxyA's local space to apply the constraint to.
565  /// @param PivotB The axis in ProxyB's local space to apply the constraint to.
566  /// @param Ratio The amount the rotation from ProxyA that shall be used to be applied to ProxyB.
567  /// @return Returns a pointer to the created constraint.
568  GearConstraint* CreateGearConstraint(RigidProxy* ProxyA, RigidProxy* ProxyB, const Vector3& AxisA, const Vector3& AxisB, const Real Ratio);
569  /// @brief Creates a new GearConstraint.
570  /// @param SelfRoot An XML::Node containing the data to populate this class with.
571  /// @return Returns a pointer to the created constraint.
572  GearConstraint* CreateGearConstraint(const XML::Node& SelfRoot);
573 
574  /// @brief Creates a new Generic6DofConstraint.
575  /// @param ProxyA The First proxy to be bound.
576  /// @param ProxyB The Second proxy to be bound.
577  /// @param TransA The offset and rotation from ProxyAs center of gravity to get to match an offset from ProxyB.
578  /// @param TransB The offset and rotation from ProxyBs center of gravity.
579  /// @return Returns a pointer to the created constraint.
580  Generic6DofConstraint* CreateGeneric6DofConstraint(RigidProxy* ProxyA, RigidProxy* ProxyB, const Transform& TransA, const Transform& TransB);
581  /// @brief Creates a new Generic6DofConstraint.
582  /// @param ProxyB The proxy to be bound to the world.
583  /// @param TransB The offset and rotation for the ProxyB pivot/hinge/joint.
584  /// @return Returns a pointer to the created constraint.
585  Generic6DofConstraint* CreateGeneric6DofConstraint(RigidProxy* ProxyB, const Transform& TransB);
586  /// @brief Creates a new Generic6DofConstraint.
587  /// @param SelfRoot An XML::Node containing the data to populate this class with.
588  /// @return Returns a pointer to the created constraint.
589  Generic6DofConstraint* CreateGeneric6DofConstraint(const XML::Node& SelfRoot);
590 
591  /// @brief Creates a new Generic6DofSpringConstraint.
592  /// @param ProxyA The First proxy to be bound.
593  /// @param ProxyB The Second proxy to be bound.
594  /// @param TransA The offset and rotation from ProxyAs center of gravity to get to match an offset from ProxyB.
595  /// @param TransB The offset and rotation from ProxyBs center of gravity.
596  /// @return Returns a pointer to the created constraint.
597  Generic6DofSpringConstraint* CreateGeneric6DofSpringConstraint(RigidProxy* ProxyA, RigidProxy* ProxyB, const Transform& TransA, const Transform& TransB);
598  /// @brief Creates a new Generic6DofSpringConstraint.
599  /// @param SelfRoot An XML::Node containing the data to populate this class with.
600  /// @return Returns a pointer to the created constraint.
601  Generic6DofSpringConstraint* CreateGeneric6DofSpringConstraint(const XML::Node& SelfRoot);
602 
603  /// @brief Creates a new HingeConstraint.
604  /// @param ProxyA The first proxy to apply this constraint to.
605  /// @param ProxyB The second proxy to apply this constraint to.
606  /// @param PivotA The location in ProxyA's local space to apply the constraint to.
607  /// @param PivotB The location in ProxyB's local space to apply the constraint to.
608  /// @param AxisInA The axis(for ProxyA) on which the hinge is to act. For example, a door hinge would be (0.0,1.0,0.0), aka the positive Y axis.
609  /// @param AxisInB The axis(for ProxyB) on which the hinge is to act. For example, a door hinge would be (0.0,1.0,0.0), aka the positive Y axis.
610  /// @return Returns a pointer to the created constraint.
611  HingeConstraint* CreateHingeConstraint(RigidProxy* ProxyA, RigidProxy* ProxyB, const Vector3& PivotInA, const Vector3& PivotInB, const Vector3& AxisInA, const Vector3& AxisInB);
612  /// @brief Creates a new HingeConstraint.
613  /// @param ProxyA The first proxy to apply this constraint to.
614  /// @param ProxyB The second proxy to apply this constraint to.
615  /// @param TransA The offset and rotation from ProxyAs center of gravity to get to match an offset from ProxyB.
616  /// @param TransB The offset and rotation from ProxyBs center of gravity.
617  /// @return Returns a pointer to the created constraint.
618  HingeConstraint* CreateHingeConstraint(RigidProxy* ProxyA, RigidProxy* ProxyB, const Transform& TransA, const Transform& TransB);
619  /// @brief Creates a new HingeConstraint.
620  /// @param ProxyA The proxy to apply this constraint to.
621  /// @param PivotInA The point in the objects(ProxyA) local space where the constraint is to be attached to world space.
622  /// @param AxisInA The axis(for ProxyA) on which the hinge is to act. For example, a door hinge would be (0.0,1.0,0.0), aka the positive Y axis.
623  /// @return Returns a pointer to the created constraint.
624  HingeConstraint* CreateHingeConstraint(RigidProxy* ProxyA, const Vector3& PivotInA, const Vector3& AxisInA);
625  /// @brief Creates a new HingeConstraint.
626  /// @param ProxyA The first proxy to apply this constraint to.
627  /// @param TransB The offset and rotation from ProxyAs center of gravity.
628  /// @return Returns a pointer to the created constraint.
629  HingeConstraint* CreateHingeConstraint(RigidProxy* ProxyA, const Transform& TransA);
630  /// @brief Creates a new HingeConstraint.
631  /// @param SelfRoot An XML::Node containing the data to populate this class with.
632  /// @return Returns a pointer to the created constraint.
633  HingeConstraint* CreateHingeConstraint(const XML::Node& SelfRoot);
634 
635  /// @brief Creates a new Hinge2Constraint.
636  /// @remarks All axes passed in should be in world coordinates.
637  /// @param ProxyA A pointer to the first proxy that will be constrained.
638  /// @param ProxyB A pointer to the second proxy that will be constrained.
639  /// @param Anchor The point in world cocrdinates where the "axel" and "suspension" meet.
640  /// @param Axis1 The axis on which the child object should rotate about the parent object(aka turning). Must be orthogonal to Axis2.
641  /// @param Axis2 The axis on which the child object will rotate on it's own(aka spinning).
642  /// @return Returns a pointer to the created constraint.
643  Hinge2Constraint* CreateHinge2Constraint(RigidProxy* ProxyA, RigidProxy* ProxyB, const Vector3& Anchor, const Vector3& Axis1, const Vector3& Axis2);
644  /// @brief Creates a new Hinge2Constraint.
645  /// @param ProxyA A pointer to the first proxy that will be constrained.
646  /// @param ProxyB A pointer to the second proxy that will be constrained.
647  /// @param TransA The offset and rotation from ProxyAs center of gravity to get to match an offset from ProxyB.
648  /// @param TransB The offset and rotation from ProxyBs center of gravity.
649  /// @return Returns a pointer to the created constraint.
650  Hinge2Constraint* CreateHinge2Constraint(RigidProxy* ProxyA, RigidProxy* ProxyB, const Transform& TransA, const Transform& TransB);
651  /// @brief Creates a new Hinge2Constraint.
652  /// @param SelfRoot An XML::Node containing the data to populate this class with.
653  /// @return Returns a pointer to the created constraint.
654  Hinge2Constraint* CreateHinge2Constraint(const XML::Node& SelfRoot);
655 
656  /// @brief Creates a new Point2PointConstraint.
657  /// @param ProxyA The first proxy to apply this constraint to.
658  /// @param ProxyB The second proxy to apply this constraint to.
659  /// @param PivotA The location in ProxyA's local space to apply the constraint to.
660  /// @param PivotB The location in ProxyB's local space to apply the constraint to.
661  /// @return Returns a pointer to the created constraint.
662  Point2PointConstraint* CreatePoint2PointConstraint(RigidProxy* ProxyA, RigidProxy* ProxyB, const Vector3& PivotA, const Vector3& PivotB);
663  /// @brief Creates a new Point2PointConstraint.
664  /// @param ProxyA The proxy to apply this constraint to.
665  /// @param PivotA The position relative to ProxyA's center of gravity to "Pin" to the world.
666  /// @return Returns a pointer to the created constraint.
667  Point2PointConstraint* CreatePoint2PointConstraint(RigidProxy* ProxyA, const Vector3& PivotA);
668  /// @brief Creates a new Point2PointConstraint.
669  /// @param SelfRoot An XML::Node containing the data to populate this class with.
670  /// @return Returns a pointer to the created constraint.
671  Point2PointConstraint* CreatePoint2PointConstraint(const XML::Node& SelfRoot);
672 
673  /// @brief Creates a new SliderConstraint.
674  /// @param ProxyA The First proxy to be bound.
675  /// @param ProxyB The Second proxy to be bound.
676  /// @param TransA The offset and rotation from ProxyA's center of gravity to get to match an offset from ProxyB.
677  /// @param TransB The offset and rotation from ProxyB's center of gravity.
678  /// @return Returns a pointer to the created constraint.
679  SliderConstraint* CreateSliderConstraint(RigidProxy* ProxyA, RigidProxy* ProxyB, const Transform& TransA, const Transform& TransB);
680  /// @brief Creates a new SliderConstraint.
681  /// @param ProxyA The First proxy to be bound.
682  /// @param TransA The offset and rotation from ProxyA's center of gravity.
683  /// @return Returns a pointer to the created constraint.
684  SliderConstraint* CreateSliderConstraint(RigidProxy* ProxyA, const Transform& TransA);
685  /// @brief Creates a new SliderConstraint.
686  /// @param SelfRoot An XML::Node containing the data to populate this class with.
687  /// @return Returns a pointer to the created constraint.
688  SliderConstraint* CreateSliderConstraint(const XML::Node& SelfRoot);
689 
690  /// @brief Creates a new UniversalConstraint.
691  /// @param ProxyA A pointer to the first proxy that will be constrained.
692  /// @param ProxyB A pointer to the second proxy that will be constrained.
693  /// @param Anchor The central point around both Axis1 and Axis 2 will connect and spin.
694  /// @param Axis1 An axis perpendicular to the axis you wish to have the ProxyA spin.
695  /// @param Axis2 An axis perpendicular to the axis you wish to have the ProxyB spin.
696  /// @return Returns a pointer to the created constraint.
697  UniversalConstraint* CreateUniversalConstraint(RigidProxy* ProxyA, RigidProxy* ProxyB, const Vector3& Anchor, const Vector3& Axis1, const Vector3& Axis2);
698  /// @brief Creates a new UniversalConstraint.
699  /// @param ProxyA A pointer to the first proxy that will be constrained.
700  /// @param ProxyB A pointer to the second proxy that will be constrained.
701  /// @param TransA The offset and rotation from ProxyAs center of gravity to get to match an offset from ProxyB.
702  /// @param TransB The offset and rotation from ProxyBs center of gravity.
703  /// @return Returns a pointer to the created constraint.
704  UniversalConstraint* CreateUniversalConstraint(RigidProxy* ProxyA, RigidProxy* ProxyB, const Transform& TransA, const Transform& TransB);
705  /// @brief Creates a new UniversalConstraint.
706  /// @param SelfRoot An XML::Node containing the data to populate this class with.
707  /// @return Returns a pointer to the created constraint.
708  UniversalConstraint* CreateUniversalConstraint(const XML::Node& SelfRoot);
709 
710  ///////////////////////////////////////////////////////////////////////////////
711  // Constraint Management
712 
713  /// @brief Gets a constraint by index.
714  /// @param Index The index of the constraint you want.
715  /// @return Returns a pointer to the specified constraint.
716  Constraint* GetConstraint(const Whole& Index);
717  /// @brief Gets the number of constraints currently in the world.
718  /// @return Returns a whole representing the number of constraints in the world.
719  Whole GetNumConstraints();
720  /// @brief Removes a constraint from the world and destroys it.
721  /// @param Con The constraint to be destroyed.
722  void DestroyConstraint(Constraint* Con);
723  /// @brief Destroys all constraints currently in the manager.
724  void DestroyAllConstraints();
725 
726  ///////////////////////////////////////////////////////////////////////////////
727  // Trigger Management
728 
729  /// @brief Adds a trigger to the world.
730  /// @details Adds a trigger to the world so that it can/will take effect.
731  /// @param Trig The trigger to be added.
732  void AddWorldTrigger(WorldTrigger* Trig);
733  /// @brief Gets a trigger by name.
734  /// @param Name The name of the trigger to find.
735  /// @return Returns a pointer to the named trigger, or NULL if it doesn't exist.
736  WorldTrigger* GetWorldTrigger(const String& Name);
737  /// @brief Gets a trigger by index.
738  /// @param Index The index of the trigger you want.
739  /// @return Returns a pointer to the trigger at the specified index.
740  WorldTrigger* GetWorldTrigger(const Whole& Index);
741  /// @brief Gets the number of triggers currently in the world.
742  /// @return Returns a whole representing the number of triggers in the world.
743  Whole GetNumWorldTriggers();
744  /// @brief Removes a trigger from the world.
745  /// @details Removes a trigger from the world so that it will have no effect.
746  /// @param Trig The trigger to be removed.
747  void RemoveWorldTrigger(WorldTrigger* Trig);
748  /// @brief Destroys all triggers currently in the manager.
749  void DestroyAllWorldTriggers();
750 
751  ///////////////////////////////////////////////////////////////////////////////
752  // Collision Management
753 
754  /// @brief Gets a Collision by collidable pair.
755  /// @param A The first proxy in the collision pair.
756  /// @param B The second proxy in the collision pair.
757  /// @return Returns a pointer to the Collision if a collision for the provided pair exists, NULL otherwise.
758  Physics::Collision* GetCollision(CollidableProxy* A, CollidableProxy* B);
759  /// @brief Gets a Collision by collidable pair.
760  /// @param Pair A pair of CollidableProxies.
761  /// @return Returns a pointer to the Collision if a collision for the provided pair exists, NULL otherwise.
762  Physics::Collision* GetCollision(CollidablePair* Pair);
763  /// @brief Gets the number of Collisions currently in the world.
764  /// @return Returns a whole representing the number of Collisions in the world.
765  Whole GetNumCollisions();
766  /// @brief Removes an existing collision from the world.
767  /// @remarks In general it's not a great idea to call on this manually, but there are some situations where you would.
768  /// Mostly this function exists to facilitate removal of objects from the world before the simulation ends.
769  /// In such cases you have to clean up traces of the collision.
770  /// @param Col The collision to be removed.
771  void RemoveCollision(Physics::Collision* Col);
772  /// @brief Removes all stored collisions that involve the specified CollidableProxy.
773  /// @param Proxy The Proxy which will have all of it's collisions removed.
774  void RemoveCollisionsContainingProxy(CollidableProxy* Proxy);
775  /// @brief Destroys all collisions currently being stored and processed in the manager.
776  void DestroyAllCollisions();
777 
778  /// @brief Get an CollisionIterator to the first Collision.
779  /// @return An CollisionIterator to the first Collision.
780  CollisionMapIterator BeginCollision();
781  /// @brief Get a CollisionIterator to one past the last Collision.
782  /// @return A CollisionIterator to one past the last Collision.
783  CollisionMapIterator EndCollision();
784  #if !(defined(SWIG) && defined(MEZZLUA51)) // Stop Swig from making lua bindings but allow other languages
785  /// @brief Get a ConstCollisionIterator to the first Collision.
786  /// @return A ConstCollisionIterator to the first Collision.
787  ConstCollisionMapIterator BeginCollision() const;
788  /// @brief Get a ConstCollisionIterator to one past the last Collision.
789  /// @return A ConstCollisionIterator to one past the last Collision.
790  ConstCollisionMapIterator EndCollision() const;
791  #endif
792 
793  ///////////////////////////////////////////////////////////////////////////////
794  // Debug Management
795 
796  /// @brief Enables and Disables Physics Debug Drawing
797  /// @details Enables and Disables Physics Debug Drawing using default wireframes. This will force renderings that match the physics
798  /// subsytem pixel for pixel.
799  /// @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
800  void SetDebugRenderingMode(const Integer DebugRenderingMode);
801  /// @brief Is Physics Debug Drawing currently enabled?
802  /// @details lets you check if Physics Debug Drawing is enabled or not.
803  /// @return 1 for it is on, and 0 for it is not. The may be other options later for selectively cnacking certain features
804  Integer GetDebugRenderingMode() const;
805 
806  ///////////////////////////////////////////////////////////////////////////////
807  // Utility
808 
809  /// @brief Resets all the internal physics structures in this manager.
810  /// @warning This should only be called while the world is emtpy and objects have be unloaded from it.
811  /// @param Info If you want to change the configuration of the world when restarting, you can optionally
812  /// provide a new set of parameters to build the world with.
813  void ResetPhysicsWorld(ManagerConstructionInfo* Info = 0);
814  /// @brief Clears all data relating to actors and other simulation objects from the physics world.
815  /// @details This is best used with simulation cleanup.
816  void ClearPhysicsMetaData();
817  /// @brief Sets the modifier to be used when stepping the physics simulation.
818  /// @remarks For the most part, the simulation tick is determined by your target framerate set on Mezzanine::World. However
819  /// there are some occasions when you will want to have it tick more often, in particular with sensative simulation setups
820  /// involving many constraints, or small objects, or fast moving objects, or any combination of those. In order to make your
821  /// simulation more stable you have to tick in smaller intervals, making it less likely for the engine to miss something or
822  /// become unstable. When you pass in a modifier it'll ensure it ticks faster by that amount. For example, if you pass in 2
823  /// to this as the modifier, the physics simulation will take 2 smaller steps (the time being based on the target framerate)
824  /// instead of one big one during the course of one frame.
825  /// @param Modifier The amount of substeps per frame to perform.
826  void SetSimulationSubstepModifier(const Whole& Modifier);
827 
828  /// @copydoc WorldManager::Pause(const UInt32)
829  virtual void Pause(const UInt32 PL);
830 
831  /// @brief Does all of the necessary configuration to prepare for a running simulation.
832  void MainLoopInitialize();
833  /// @copydoc WorldManager::Initialize()
834  virtual void Initialize();
835  /// @copydoc ManagerBase::Deinitialize()
836  virtual void Deinitialize();
837 
838  /// @brief The work that needs to be done each frame.
839  /// @param CurrentThreadStorage The context of the current frame for the work to do.
840  void DoPerFrameWork(Threading::DefaultThreadSpecificStorage::Type& CurrentThreadStorage);
841 
842  /// @brief Gets a pointer to the work unit that steps the simulation.
843  /// @return Returns a pointer to the DefaultWorkUnit that steps the simulation.
844  Threading::DefaultWorkUnit* GetSimulationWork();
845  /// @brief Gets a pointer to the work unit that updates all WorldTriggers.
846  /// @return Returns a pointer to the WorldTriggerUpdateWorkUnit used by this manager.
847  WorldTriggerUpdateWorkUnit* GetWorldTriggerUpdateWork();
848  /// @brief Gets a pointer to the work unit that updates the debug drawer.
849  /// @return Returns a pointer to the DebugDrawWorkUnit used by this manager.
850  DebugDrawWorkUnit* GetDebugDrawWork();
851 
852  ///////////////////////////////////////////////////////////////////////////////
853  // Type Identifier Methods
854 
855  /// @copydoc ManagerBase::GetInterfaceType()
856  virtual ManagerBase::ManagerType GetInterfaceType() const;
857  /// @copydoc ManagerBase::GetImplementationTypeName()
858  virtual String GetImplementationTypeName() const;
859 
860  ///////////////////////////////////////////////////////////////////////////////
861  // Internal Methods
862 
863  #if !(defined(SWIG) && defined(MEZZLUA51)) // Stop Swig from making lua bindings but allow other languages
864  /// @internal
865  /// @brief This returns a pointer to the bullet physics world. This is for internal use only
866  btSoftRigidDynamicsWorld* _GetPhysicsWorldPointer();
867  /// @internal
868  /// @brief This returns a pointer to the bullet physics world. This is for internal use only
869  const btSoftRigidDynamicsWorld* _GetPhysicsWorldPointer() const;
870  #endif
871  };//PhysicsManager
872 
873  ///////////////////////////////////////////////////////////////////////////////
874  /// @class DefaultPhysicsManagerFactory
875  /// @brief A factory responsible for the creation and destruction of the default physicsmanager.
876  ///////////////////////////////////////
878  {
879  public:
880  /// @brief Class constructor.
882  /// @brief Class destructor.
883  virtual ~DefaultPhysicsManagerFactory();
884 
885  /// @copydoc ManagerFactory::GetManagerImplName()
886  String GetManagerImplName() const;
887  /// @copydoc ManagerFactory::GetManagerType() const
888  ManagerBase::ManagerType GetManagerType() const;
889 
890  /// @copydoc WorldManagerFactory::CreateManager(World*, const NameValuePairList&)
891  WorldManager* CreateManager(World* Creator, const NameValuePairList& Params);
892  /// @copydoc WorldManagerFactory::CreateManager(World*, const XML::Node&)
893  WorldManager* CreateManager(World* Creator, const XML::Node& XMLNode);
894  /// @copydoc WorldManagerFactory::DestroyManager(WorldManager*)
895  void DestroyManager(WorldManager* ToBeDestroyed);
896  };//DefaultPhysicsManagerFactory
897  }//Physics
898 }//Mezzanine
899 
900 #endif
This is the base class for all collision shapes.
UIDGenerator ProxyIDGen
Generator responsible for creating unique IDs for CollidableProxy instances.
DebugDrawWorkUnit * DebugDrawWork
The work unit that updates the debug drawer with the latest physics rendering.
This is used to draw wireframse for the Physics subsystem.
Threading::DefaultWorkUnit * SimulationWork
The work unit that does the stepping of the simulation.
CollisionContainer::iterator CollisionIterator
Iterator type for Collision instances stored by this class.
WorldTriggerContainer::iterator WorldTriggerIterator
Iterator type for WorldTrigger instances stored by this class.
bool Boole
Generally acts a single bit, true or false.
Definition: datatypes.h:173
Default implementation of WorkUnit. This represents on piece of work through time.
Definition: workunit.h:160
PhysicsManager * TargetManager
A pointer to the manager this work unit is processing.
Real TimeMultiplier
A Multiplier that adjusts how fast physics runs relative to clock time.
ManagerType
A listing of Manager Types.
Definition: managerbase.h:65
This is the proxy object for ghost objects with no contact response.
Definition: ghostproxy.h:55
std::vector< WorldTrigger * > WorldTriggerContainer
Basic container type for WorldTrigger storage by this class.
All the definitions for datatypes as well as some basic conversion functions are defined here...
int Integer
A datatype used to represent any integer close to.
Definition: datatypes.h:154
This is a constraint for permitting movement on only a singular linear or angular axis...
std::pair< CollidablePair, Collision * > CollisionSortPair
A std::pair to assist with collision sorting operations.
UIDGenerator ConstraintIDGen
Generator responsible for creating unique IDs for Constraint instances.
std::map< CollidablePair, Collision * > CollisionMap
Container type for storing Collision instances based on the pair of proxies that are colliding...
WorldTriggerContainer Triggers
A container storing all of the worldtriggers owned by this manager.
ConstraintContainer Constraints
A container storing all of the constraints owned by this manager.
Create simple but specific limits on any axis of movement or rotation.
This is the base class for all constraints supported.
Definition: constraint.h:116
ConstraintContainer::iterator ConstraintIterator
Iterator type for Constraint instances stored by this class.
This is a Mezzanine::Threading::iWorkUnit for the single threaded processing of physics simulations...
This is a Mezzanine::Threading::iWorkUnit for the updating of WorldTriggers.
This is a constraint for sharing the rotation of one object along an angular axis with another...
ProxyContainer Proxies
A container storing all of the proxies owned by this manager.
Whole ThreadCount
The number of threads the internal thread providers should allocate.
btThreadSupportInterface * BulletDispatcherThreads
A pointer to the thread provider for the internal dispatcher (narrowphase).
Whole SubstepModifier
A modifier that will determine how many substeps each frame the physics simulation should perform...
A kind of workunit given exclusive runtime so it can consume time on multiple threads.
Definition: monopoly.h:62
debug::InternalDebugDrawer * BulletDrawer
A pointer to the debug drawer for rendering the physics world.
PhysicsManager * TargetManager
A pointer to the manager this work unit is processing.
float Real
A Datatype used to represent a real floating point number.
Definition: datatypes.h:141
This is a constraint that will limit the movement allowed from one body to within a cone area around ...
Tries to make a point relative to each of two actors match in 3d space, without regard to rotation...
A thread specific collection of double-buffered and algorithm specific resources. ...
PhysicsManager * TargetManager
A pointer to the manager this work unit is processing.
Boole SimulationPaused
Whether or not the physics simulation is to step each frame.
btCollisionConfiguration * BulletCollisionConfiguration
A pointer to the internal collision configuration that enables certain types of objects to collide...
static const ManagerBase::ManagerType InterfaceType
A ManagerType enum value used to describe the type of interface/functionality this manager provides...
This class will generate keep track of a pool of unique 32-bit ID's that can be used for distinct obj...
Definition: uidgenerator.h:53
A light-weight handle for manipulating nodes in DOM tree.
Definition: node.h:89
This is the proxy object for soft/compressable bodies.
Definition: softproxy.h:55
This is an abstract class for creating in-game triggers.
Definition: worldtrigger.h:53
ProxyType
Used by all World proxies to describe what their derived types are.
Definition: enumerations.h:91
uint32_t UInt32
An 32-bit unsigned integer.
Definition: datatypes.h:126
WorldTriggerUpdateWorkUnit * WorldTriggerUpdateWork
The work unit that processes all world triggers.
This is an event class used to track collsions in the physics world.
Definition: collision.h:72
ConstraintContainer::const_iterator ConstConstraintIterator
Const Iterator type for Constraint instances stored by this class.
Used to provide better reporting of collisions.
std::vector< Collision * > CollisionContainer
Basic container type for Collision storage by this class.
This is a convience class that will configure a 6DoF spring constraint with 2 angular and 1 linear (w...
A factory responsible for the creation and destruction of the default physicsmanager.
This is a Mezzanine::Threading::iWorkUnit for the multi-threaded processing of physics simulations...
CollisionMap::iterator CollisionMapIterator
Iterator type for sorted Collision instances.
WorldTriggerContainer::const_iterator ConstWorldTriggerIterator
Const Iterator type for WorldTrigger instances stored by this class.
This is a helper class for storing pairs of collidable proxies in associative containers.
std::list< NameValuePair > NameValuePairList
This is a datatype mostly used for describing settings or parameters that can't be declared in advanc...
Definition: datatypes.h:206
This is a proxy from which rigid body proxys are handled.
Definition: rigidproxy.h:102
This is a Mezzanine::Threading::iWorkUnit for the updating of the physics debug drawer.
Stores information about relative location and rotation in 3d space.
Definition: transform.h:62
This is the base class for all managers that belong to a single world instance.
Definition: worldmanager.h:55
This is a proxy from which physics objects that can collide with each other are handled.
CollisionContainer::const_iterator ConstCollisionIterator
Const Iterator type for Collision instances stored by this class.
std::vector< Constraint * > ConstraintContainer
Basic container type for Constraint storage by this class.
Used to provide better reporting of collisions in a multithreaded environment.
This is simply a place for storing all the Physics Related functions.
Contains an interface for a kind of WorkUnit that consumes time on multiple thread.
btBroadphaseInterface * BulletBroadphase
A pointer to the physics broadphase of the simulation.
This is a constraint that duplicate the angular motion of one object to another, adjusted by the prov...
btSoftRigidDynamicsWorld * BulletDynamicsWorld
A pointer to the internal physics world.
This is a constraint to be used to restrict the movement between two objects to angular rotation on a...
This is used to represent a point in space, or a vector through space.
Definition: vector3.h:77
ProxyContainer::iterator ProxyIterator
Iterator type for CollidableProxy instances stored by this class.
#define MEZZ_LIB
Some platforms require special decorations to denote what is exported/imported in a share library...
Real StepSize
The amount of time (in seconds) a single simulation step should advance.
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
Definition: datatypes.h:151
This class represents a world for objects to interact within.
Definition: world.h:74
std::vector< CollidableProxy * > ProxyContainer
Basic container type for CollidableProxy storage by this class.
Integer DebugRenderMode
The current rendering mode for the debug drawer.
btGhostPairCallback * GhostCallback
A pointer to the callback that enables ghost objects internally.
btSequentialImpulseConstraintSolver * BulletSolver
A pointer to the internal constraint solver.
This is a base class for factories that construct managers used by the World class.
static PhysicsManager * CallBackWorld
The World that will be used for the InternalTickCallback.
btThreadSupportInterface * BulletSolverThreads
A pointer to the thread provider for the internal constraint solver.
Creates a constraint as configurable as the 6Dof constraint, but has added support for spring motion...
btCollisionDispatcher * BulletDispatcher
A pointer to the internal dispatcher (narrowphase).
CollisionMap Collisions
A container tracking all of the existing collisions in the physics world.
PhysicsManager * TargetManager
A pointer to the manager this work unit is processing.
std::string String
A datatype used to a series of characters.
Definition: datatypes.h:159
ManagerConstructionInfo WorldConstructionInfo
A copy of the information used to initialize this manager.
This is a helper class storing information needed for the construction of a PhysicsManager.
static const String ImplementationName
A String containing the name of this manager implementation.
ProxyContainer::const_iterator ConstProxyIterator
Const Iterator type for CollidableProxy instances stored by this class.
CollisionMap::const_iterator ConstCollisionMapIterator
Const Iterator type for sorted Collision instances.
This file has the definition of the workunit.