40 #ifndef _physicsphysicsmanager_cpp
41 #define _physicsphysicsmanager_cpp
43 #include "Physics/physicsmanager.h"
44 #include "Physics/collision.h"
46 #include "Physics/ghostproxy.h"
47 #include "Physics/rigidproxy.h"
48 #include "Physics/softproxy.h"
50 #include "Physics/conetwistconstraint.h"
51 #include "Physics/gearconstraint.h"
52 #include "Physics/generic6dofconstraint.h"
53 #include "Physics/generic6dofspringconstraint.h"
54 #include "Physics/hingeconstraint.h"
55 #include "Physics/hinge2constraint.h"
56 #include "Physics/point2pointconstraint.h"
57 #include "Physics/sliderconstraint.h"
58 #include "Physics/universalconstraint.h"
60 #include "Graphics/graphicsmanager.h"
63 #include "actormanager.h"
64 #include "areaeffectmanager.h"
67 #include "stringtool.h"
68 #include "linegroup.h"
70 #include "worldtrigger.h"
71 #include "worldobject.h"
72 #include "crossplatform.h"
77 #include "Physics/collisiondispatcher.h.cpp"
82 #include <btBulletDynamicsCommon.h>
83 #include <BulletSoftBody/btSoftRigidDynamicsWorld.h>
84 #include <BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.h>
85 #include <BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h>
86 #include <BulletCollision/CollisionDispatch/btGhostObject.h>
89 #define __PHYSICS_COMMON_H__ 1
92 #include <BulletMultiThreaded/Win32ThreadSupport.h>
94 #include <BulletMultiThreaded/PosixThreadSupport.h>
97 #include <BulletMultiThreaded/btParallelConstraintSolver.h>
98 #include <BulletMultiThreaded/SpuGatheringCollisionDispatcher.h>
99 #include <BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.h>
153 virtual void drawLine(
const btVector3& from,
const btVector3& to,
const btVector3& color);
162 virtual void drawContactPoint(
const btVector3& PointOnB,
const btVector3& normalOnB,btScalar distance,
int lifeTime,
const btVector3& color);
168 virtual void draw3dText(
const btVector3& location,
const char* textString);
196 DebugDrawing(Physics::DDM_NoDebug),
197 ParentWorld(ParentWorld)
202 if( this->WireFrame != NULL )
203 delete this->WireFrame;
208 if( this->WireFrame == NULL ) {
210 if( this->DebugDrawing != Physics::DDM_NoDebug ) {
234 this->DebugDrawing = debugMode;
235 if( this->WireFrame != NULL ) {
236 if( this->DebugDrawing != Physics::DDM_NoDebug ) {
245 {
return this->DebugDrawing; }
248 { this->ErrorLogger =
Logger; }
251 { (*this->ErrorLogger) << warningString << std::endl; }
262 SimulationWorkUnit::SimulationWorkUnit(
const SimulationWorkUnit& Other)
265 SimulationWorkUnit& SimulationWorkUnit::operator=(
const SimulationWorkUnit& Other)
269 TargetManager(Target) { }
286 SimulationMonopolyWorkUnit& SimulationMonopolyWorkUnit::operator=(
const SimulationMonopolyWorkUnit& Other)
290 TargetManager(Target) { }
317 TargetManager(Target) { }
341 TargetManager(Target) { }
376 SimulationPaused(false),
379 BulletSolverThreads(NULL),
380 BulletDispatcherThreads(NULL),
381 BulletBroadphase(NULL),
382 BulletCollisionConfiguration(NULL),
383 BulletDispatcher(NULL),
385 BulletDynamicsWorld(NULL),
388 SimulationWork(NULL),
389 WorldTriggerUpdateWork(NULL),
404 SimulationPaused(false),
407 BulletSolverThreads(NULL),
408 BulletDispatcherThreads(NULL),
409 BulletBroadphase(NULL),
410 BulletCollisionConfiguration(NULL),
411 BulletDispatcher(NULL),
413 BulletDynamicsWorld(NULL),
416 SimulationWork(NULL),
417 WorldTriggerUpdateWork(NULL),
430 SimulationPaused(false),
433 BulletSolverThreads(NULL),
434 BulletDispatcherThreads(NULL),
435 BulletBroadphase(NULL),
436 BulletCollisionConfiguration(NULL),
437 BulletDispatcher(NULL),
439 BulletDynamicsWorld(NULL),
442 SimulationWork(NULL),
443 WorldTriggerUpdateWork(NULL),
450 if(!WorldSettings.
Empty()) {
451 CurrAttrib = WorldSettings.
GetAttribute(
"LimitlessWorld");
452 if(!CurrAttrib.
Empty()) {
455 CurrAttrib = WorldSettings.
GetAttribute(
"WorldUpperBounds");
456 if(!CurrAttrib.
Empty())
458 CurrAttrib = WorldSettings.
GetAttribute(
"WorldLowerBounds");
459 if(!CurrAttrib.
Empty())
462 if(!CurrAttrib.
Empty())
465 CurrAttrib = WorldSettings.
GetAttribute(
"SoftRigidWorld");
466 if(!CurrAttrib.
Empty()) {
469 CurrAttrib = WorldSettings.
GetAttribute(
"MultiThreaded");
470 if(!CurrAttrib.
Empty()) {
478 if(!StepModifier.
Empty()) {
480 if(!CurrAttrib.
Empty()) {
486 if(!DebugRender.
Empty()) {
488 CurrAttrib = WorldSettings.
GetAttribute(
"RenderingMode");
489 if(!CurrAttrib.
Empty())
490 RenderMode = CurrAttrib.
AsInt();
492 if(0 != RenderMode) {
547 Win32ThreadSupport::Win32ThreadConstructionInfo BulletThreadInfo(
"DispatcherThreads",
548 processCollisionTask,
549 createCollisionLocalStoreMemory,
553 PosixThreadSupport::ThreadConstructionInfo BulletThreadInfo(
"DispatcherThreads",
554 processCollisionTask,
555 createCollisionLocalStoreMemory,
581 this->
BulletSolver =
new btSequentialImpulseConstraintSolver();
671 for( std::vector<WorldTrigger*>::iterator Trig =
Triggers.begin() ; Trig !=
Triggers.end() ; Trig++ )
673 if((*Trig)->ConditionsAreMet())
674 (*Trig)->ApplyTrigger();
683 (*ColIt).second->Update();
688 if(AlgoQueue->empty())
696 btCollisionAlgorithm* NewAlgo = AlgoQueue->front();
697 while( NewAlgo != NULL )
711 btBroadphasePairArray& PairArray =
BulletBroadphase->getOverlappingPairCache()->getOverlappingPairArray();
712 for(
Integer X = 0 ; X < PairArray.size() ; ++X )
714 if( NewAlgo == PairArray[X].m_algorithm ) {
715 btCollisionObject* COA = (btCollisionObject*)PairArray[X].m_pProxy0->m_clientObject;
716 ProxA = static_cast<CollidableProxy*>( COA->getUserPointer() );
717 btCollisionObject* COB = (btCollisionObject*)PairArray[X].m_pProxy1->m_clientObject;
718 ProxB = static_cast<CollidableProxy*>( COB->getUserPointer() );
736 if( NewAlgo == (*ColIt).second->InternalAlgo )
748 AlgoQueue->pop_front();
749 if(AlgoQueue->size() > 0) NewAlgo = AlgoQueue->front();
805 this->
Proxies.push_back(NewProxy);
812 this->
Proxies.push_back(NewProxy);
823 this->
Proxies.push_back(NewProxy);
830 this->
Proxies.push_back(NewProxy);
837 this->
Proxies.push_back(NewProxy);
848 this->
Proxies.push_back(NewProxy);
855 this->
Proxies.push_back(NewProxy);
863 this->
Proxies.push_back(NewProxy);
871 {
return this->
Proxies.at(Index); }
875 if( Mezzanine::PT_Physics_All_Proxies & Type ) {
878 if( (*ProxIt)->GetProxyType() == Type ) {
879 if( 0 == Which )
return (*ProxIt);
891 if( (*ProxIt)->GetProxyID() == ID ) {
899 {
return this->
Proxies.size(); }
905 if( ToBeDestroyed == (*ProxIt) ) {
906 WorldObject* Parent = (*ProxIt)->GetParentObject();
922 WorldObject* Parent = (*ProxIt)->GetParentObject();
933 {
return this->
Proxies.begin(); }
936 {
return this->
Proxies.end(); }
939 {
return this->
Proxies.begin(); }
942 {
return this->
Proxies.end(); }
951 return NewConstraint;
958 return NewConstraint;
966 return NewConstraint;
973 return NewConstraint;
980 return NewConstraint;
988 return NewConstraint;
995 return NewConstraint;
1002 return NewConstraint;
1010 return NewConstraint;
1017 return NewConstraint;
1025 return NewConstraint;
1032 return NewConstraint;
1039 return NewConstraint;
1046 return NewConstraint;
1053 return NewConstraint;
1061 return NewConstraint;
1068 return NewConstraint;
1075 return NewConstraint;
1083 return NewConstraint;
1090 return NewConstraint;
1097 return NewConstraint;
1105 return NewConstraint;
1112 return NewConstraint;
1119 return NewConstraint;
1127 return NewConstraint;
1134 return NewConstraint;
1141 return NewConstraint;
1149 return NewConstraint;
1165 if( (*ConIt) == Con ) {
1166 (*ConIt)->EnableConstraint(
false);
1179 (*ConIt)->EnableConstraint(
false);
1190 { this->
Triggers.push_back(Trig); }
1196 if( Name == (*Trig)->GetName() ) {
1204 {
return this->
Triggers.at(Index); }
1213 if( Trig == (*T) ) {
1239 if(ColIt != this->
Collisions.end())
return (*ColIt).second;
1249 btBroadphasePair* btPair = this->
BulletBroadphase->getOverlappingPairCache()->findPair(
1270 if( Proxy == (*ColIt).second->ProxyA || Proxy == (*ColIt).second->ProxyB ) {
1274 delete ToBeDestroyed;
1286 delete (*ColIt).second;
1323 if( Info != NULL ) {
1339 btOverlappingPairCache* Pairs = this->
BulletBroadphase->getOverlappingPairCache();
1340 int NumPairs = Pairs->getNumOverlappingPairs();
1341 btBroadphasePairArray PairArray = Pairs->getOverlappingPairArray();
1342 for(
Integer X = 0 ; X < NumPairs ; X++ )
1344 btBroadphasePair& CurrPair = PairArray.at(X);
1345 Pairs->removeOverlappingPair(CurrPair.m_pProxy0,CurrPair.m_pProxy1,this->BulletDispatcher);
1350 for (
int i = 0 ; i < numManifolds ; i++ )
1467 int MaxSteps = ( FloatTime < this->
StepSize ) ? 1 :
int( FloatTime / this->
StepSize ) + 1;
1470 ThreadLog <<
"Attempting to step the physics simulation by " << FloatTime <<
" seconds with " << MaxSteps <<
" maximum substeps." << std::endl;
1472 PhysicsTimer.
Start();
1478 PhysicsTimer.
Stop();
1526 if( Params.empty() ) {
1530 for( NameValuePairList::const_iterator ParIt = Params.begin() ; ParIt != Params.end() ; ++ParIt )
1532 String Lower = (*ParIt).first;
1534 if(
"geographyupperbounds" == Lower )
1538 else if(
"geographylowerbounds" == Lower )
1542 else if(
"maxproxies" == Lower )
1546 else if(
"gravity" == Lower )
1550 else if(
"softrigidworld" == Lower )
1555 else if(
"limitlessworld" == Lower )
1560 else if(
"multithreaded" == Lower )
1573 {
delete ToBeDestroyed; }
virtual void AddDependency(iWorkUnit *NewDependency)
Force this WorkUnit to Start after another has completed.
virtual void AddWorkUnitMonopoly(MonopolyWorkUnit *MoreWork, const String &WorkUnitName)
Add a MonopolyWorkUnit for execution at the beginning of the frame.
This is the base class for all collision shapes.
virtual ~SimulationMonopolyWorkUnit()
Class destructor.
UIDGenerator ProxyIDGen
Generator responsible for creating unique IDs for CollidableProxy instances.
virtual void draw3dText(const btVector3 &location, const char *textString)
Currently Unused.
virtual ~DefaultPhysicsManagerFactory()
Class destructor.
virtual ~DebugDrawWorkUnit()
Class destructor.
void DestroyConstraint(Constraint *Con)
Removes a constraint from the world and destroys it.
Whole GetNumConstraints()
Gets the number of constraints currently in the world.
void DrawLine(const Vector3 &Start, const Vector3 &End, const ColourValue &Colour)
This adds Two points to the list.
virtual void AddToWorld()
Performs all the necessary task to ensure this object is connected to it's respective world and ready...
ProxyIterator BeginCollidableProxy()
Gets an iterator to the first Collidable Proxy in this manager.
WorldManager * GetManager(const Whole ManagerToGet)
This is will find the manager of a given type.
virtual ManagerBase::ManagerType GetInterfaceType() const
This returns the type of this manager.
DebugDrawWorkUnit * DebugDrawWork
The work unit that updates the debug drawer with the latest physics rendering.
A light-weight handle for manipulating attributes in DOM tree.
This is used to draw wireframse for the Physics subsystem.
std::stringstream Logger
In case we ever replace the stringstream with another class, this will allow us to swap it out...
DebugDrawWorkUnit(const DebugDrawWorkUnit &Other)
Protected copy constructor. THIS IS NOT ALLOWED.
Threading::DefaultWorkUnit * SimulationWork
The work unit that does the stepping of the simulation.
WorldTriggerUpdateWorkUnit * GetWorldTriggerUpdateWork()
Gets a pointer to the work unit that updates all WorldTriggers.
WorldTriggerContainer::iterator WorldTriggerIterator
Iterator type for WorldTrigger instances stored by this class.
bool Boole
Generally acts a single bit, true or false.
Default implementation of WorkUnit. This represents on piece of work through time.
virtual void Pause(const UInt32 PL)
Sets the pause state of this manager, or has no effect depending on the value passed in...
virtual Whole UsingThreadCount()
Gets the number of threads this work unit will attempt to use during it's monopoly.
virtual void DoWork(Threading::DefaultThreadSpecificStorage::Type &CurrentThreadStorage)
This does any required update of the Graphical Scene graph and REnders one frame. ...
Whole GetNumWorldTriggers()
Gets the number of triggers currently in the world.
Whole GetTargetFrameTimeMicroseconds() const
Retrieves the amount of milliseconds we would like each iteration of the Main Loop to be...
Vector3 GeographyLowerBounds
The lower limits of the worlds AABB.
virtual void AddWorkUnitMain(iWorkUnit *MoreWork, const String &WorkUnitName)
Add a normal Mezzanine::Threading::iWorkUnit to this For fcheduling.
WorldManager * CreateManager(World *Creator, const NameValuePairList &Params)
Creates a manager of the type represented by this factory.
PhysicsManager * TargetManager
A pointer to the manager this work unit is processing.
A manager responsible for the storage and management of all areaeffects in use.
static void InternalTickCallback(btDynamicsWorld *world, btScalar timeStep)
Internal Callback that is called each substep of the simulation.
This file contains the declaration for the manager that manages debris objects in a world...
Real TimeMultiplier
A Multiplier that adjusts how fast physics runs relative to clock time.
virtual void ProcessAllTriggers()
Calls the ConditionsAreMet() and ApplyTrigger() functions of every stored trigger.
WorldTriggerUpdateWorkUnit & operator=(const WorldTriggerUpdateWorkUnit &Other)
Protected assignment operator. THIS IS NOT ALLOWED.
ManagerType
A listing of Manager Types.
virtual void ProcessAllCollisions()
Checks the internal collision data and generates/updates collisions as necessary. ...
void SetSimulationSubstepModifier(const Whole &Modifier)
Sets the modifier to be used when stepping the physics simulation.
virtual UInt32 GetProxyID() const
Gets the unique ID of this proxy.
This is the proxy object for ghost objects with no contact response.
void SetDebugRenderingMode(const Integer DebugRenderingMode)
Enables and Disables Physics Debug Drawing.
virtual void UseThreads(const Whole &AmountToUse)
A no-op but declared for compatibility with Monopoly work unit.
void MainLoopInitialize()
Does all of the necessary configuration to prepare for a running simulation.
void AddToWorld()
Configures this LineGroup to render in the scene.
void SetTimeMultiplier(const Real &value)
Change how fast the physicsworks relatve to well time.
virtual void RemoveWorkUnitMain(iWorkUnit *LessWork)
Remove a WorkUnit from the main pool of WorkUnits (and not from the groups of Affinity or MonpolyWork...
int Integer
A datatype used to represent any integer close to.
void ResetPhysicsWorld(ManagerConstructionInfo *Info=0)
Resets all the internal physics structures in this manager.
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.
void SetWorldSoftGravity(const Vector3 &sgrav)
Sets the gravity for soft bodies.
virtual void Initialize()
Configures this manager for use prior to entering the main loop.
Vector3 Gravity
The gravity to set for the world.
CollidableProxy * GetProxyByID(const UInt32 ID) const
Gets the CollidableProxy via its ID.
Enables multi-threaded acceleration structures.
const Char8 * AsString(const Char8 *def="") const
Attempts to convert the value of the attribute to a String and returns the results.
Constraint * GetConstraint(const Whole &Index)
Gets a constraint by index.
WorldTriggerContainer Triggers
A container storing all of the worldtriggers owned by this manager.
Threading::FrameScheduler & GetScheduler()
Gets the core structure responsible for scheduling work in the Entresol main loop.
IDType GenerateID()
Generates a new ID unique to the pool made by this generator.
AreaEffectUpdateWorkUnit * GetAreaEffectUpdateWork()
Gets the work unit responsible for updating area effects stored 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.
CollisionMapIterator EndCollision()
Get a CollisionIterator to one past the last Collision.
void DrawLines()
Updates the render buffers with the needed data to draw the lines in this LineGroup.
This is the base class for all constraints supported.
GhostProxy * CreateGhostProxy()
Creates a new GhostProxy.
This is a simple class for holding 4 reals representing the colour any give object or lightsource can...
ConeTwistConstraint * CreateConeTwistConstraint(RigidProxy *ProxyA, RigidProxy *ProxyB, const Transform &TransA, const Transform &TransB)
Creates a new ConeTwistConstraint.
UniversalConstraint * CreateUniversalConstraint(RigidProxy *ProxyA, RigidProxy *ProxyB, const Vector3 &Anchor, const Vector3 &Axis1, const Vector3 &Axis2)
Creates a new UniversalConstraint.
bool Empty() const
Is this storing anything at all?
ConstraintContainer::iterator ConstraintIterator
Iterator type for Constraint instances stored by this class.
Enables support for soft bodies in the simulation.
virtual String GetImplementationTypeName() const
This Allows any manager name to be sent to a stream. Primarily used for logging.
PhysicsManager(World *Creator)
Default settings constructor.
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...
void ClearLines()
Clears all data pertaining to points in this line group.
void DoPerFrameWork(Threading::DefaultThreadSpecificStorage::Type &CurrentThreadStorage)
The work that needs to be done each frame.
HingeConstraint * CreateHingeConstraint(RigidProxy *ProxyA, RigidProxy *ProxyB, const Vector3 &PivotInA, const Vector3 &PivotInB, const Vector3 &AxisInA, const Vector3 &AxisInB)
Creates a new HingeConstraint.
ProxyContainer Proxies
A container storing all of the proxies owned by this manager.
DebugDrawWorkUnit * GetDebugDrawWork()
Gets a pointer to the work unit that updates the debug drawer.
Physics::Collision * GetCollision(CollidableProxy *A, CollidableProxy *B)
Gets a Collision by collidable pair.
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...
debug::InternalDebugDrawer * BulletDrawer
A pointer to the debug drawer for rendering the physics world.
String GetManagerImplName() const
Gets the name of the manager that is created by this factory.
Vector3 GetWorldGravity()
Gets the gravity.
virtual void AddToWorld()
Performs all the necessary task to ensure this object is connected to it's respective world and ready...
void PauseSimulation(Boole Pause)
Pauses the simulation, preventing the physics world from taking action.
PhysicsManager * TargetManager
A pointer to the manager this work unit is processing.
float Real
A Datatype used to represent a real floating point number.
void RemoveFromWorld()
Unhooks this LineGroup from the scene, stopping it from rendering.
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. ...
virtual void setDebugMode(int debugMode)
This is used to decide how much the debug render should draw.
This is the base class from which classes that are insertable into the physical world.
Enables support for very large simulations.
PhysicsManager * TargetManager
A pointer to the manager this work unit is processing.
void DestroyManager(WorldManager *ToBeDestroyed)
Destroys a Manager created by this factory.
SliderConstraint * CreateSliderConstraint(RigidProxy *ProxyA, RigidProxy *ProxyB, const Transform &TransA, const Transform &TransB)
Creates a new SliderConstraint.
void ClearPhysicsMetaData()
Clears all data relating to actors and other simulation objects from the physics world.
Boole SimulationPaused
Whether or not the physics simulation is to step each frame.
Whole AsWhole(Whole def=0) const
Attempts to convert the value of the attribute to a Whole and returns the results.
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...
InternalDebugDrawer(World *ParentWorld)
Basic Constructor.
virtual void RemoveFromWorld()=0
Unhooks this proxy from it's respective world.
void RemoveCollisionsContainingProxy(CollidableProxy *Proxy)
Removes all stored collisions that involve the specified CollidableProxy.
Whole GetCurrentTimeInMilliseconds()
Gets the Current time in Milliseconds.
virtual void DoWork(Threading::DefaultThreadSpecificStorage::Type &CurrentThreadStorage)
This does any required update of the Graphical Scene graph and REnders one frame. ...
A manager responsible for the storage and management of all Debris that exist in a world...
btVector3 GetBulletVector3() const
Gets a Bullet vector3.
Boole ReserveID(const IDType ID)
Adds a specific ID to the pool of used IDs.
This is a group of consectutive line segments to be rendered together.
virtual void Destroy()
Tear down this physics world.
A light-weight handle for manipulating nodes in DOM tree.
This is the proxy object for soft/compressable bodies.
SoftProxy * CreateSoftProxy(const Real Mass)
Creates a new SoftProxy.
This is an abstract class for creating in-game triggers.
Whole MaxProxies
The maximum number of Actors and Area Effects you expect to have in the world at one time...
int AsInt(int def=0) const
Attempts to convert the value of the attribute to an int and returns the results. ...
DebrisUpdateWorkUnit * GetDebrisUpdateWork()
Gets the work unit responsible for updating Debriss stored by this manager.
ProxyType
Used by all World proxies to describe what their derived types are.
uint32_t UInt32
An 32-bit unsigned integer.
WorldTriggerUpdateWorkUnit * WorldTriggerUpdateWork
The work unit that processes all world triggers.
This is an event class used to track collsions in the physics world.
bool Empty() const
Is this storing anything at all?
virtual void RemoveWorkUnitAffinity(iWorkUnit *LessWork)
Remove a WorkUnit from the Affinity pool of WorkUnits (and not from the Main group or MonpolyWorkUnit...
UInt32 GetNumProxies() const
Gets the number of CollidableProxy instances in this manager.
Generic6DofSpringConstraint * CreateGeneric6DofSpringConstraint(RigidProxy *ProxyA, RigidProxy *ProxyB, const Transform &TransA, const Transform &TransB)
Creates a new Generic6DofSpringConstraint.
Used to provide better reporting of collisions.
virtual void DoWork(Threading::DefaultThreadSpecificStorage::Type &CurrentThreadStorage)
This does any required update of the Graphical Scene graph and REnders one frame. ...
void Start()
Activates the Timer.
void AddWorldTrigger(WorldTrigger *Trig)
Adds a trigger to the world.
This is a convience class that will configure a 6DoF spring constraint with 2 angular and 1 linear (w...
void DestroyAllCollisions()
Destroys all collisions currently being stored and processed in the manager.
WorldTriggerUpdateWorkUnit(const WorldTriggerUpdateWorkUnit &Other)
Protected copy constructor. THIS IS NOT ALLOWED.
virtual int getDebugMode() const
This will return the current debug mode.
Entresol * TheEntresol
The actual pointer to the Entresol core class.
This is a Mezzanine::Threading::iWorkUnit for the multi-threaded processing of physics simulations...
RenderWorkUnit * GetRenderWork()
Gets the work unit responsible for performing the graphics render of all scenes.
CollisionMap::iterator CollisionMapIterator
Iterator type for sorted Collision instances.
virtual void AddWorkUnitAffinity(iWorkUnit *MoreWork, const String &WorkUnitName)
Add a normal Mezzanine::Threading::iWorkUnit to this For scheduling.
btSoftRigidDynamicsWorld * _GetPhysicsWorldPointer()
This returns a pointer to the bullet physics world. This is for internal use only.
void DestroyAllConstraints()
Destroys all constraints currently in the manager.
virtual void Construct(const ManagerConstructionInfo &Info)
This takes care of all the real work in contructing this.
Logger & GetUsableLogger()
Get the usable logger for this thread specific resource.
WorldTriggerContainer::const_iterator ConstWorldTriggerIterator
Const Iterator type for WorldTrigger instances stored by this class.
virtual ~PhysicsManager()
Class destructor.
Vector3 GetWorldSoftGravity()
Gets the soft body gravity.
RigidProxy * CreateRigidProxy(const Real Mass)
Creates a new RigidProxy.
void DestroyAllWorldTriggers()
Destroys all triggers currently in the manager.
This is a helper class for storing pairs of collidable proxies in associative containers.
virtual void drawContactPoint(const btVector3 &PointOnB, const btVector3 &normalOnB, btScalar distance, int lifeTime, const btVector3 &color)
Currently Unused.
CollidableProxy * ProxyB
The second CollidableProxy invovled in the collision.
void DestroyAllProxies()
Deletes all stored CollidableProxy instances.
std::list< NameValuePair > NameValuePairList
This is a datatype mostly used for describing settings or parameters that can't be declared in advanc...
This is a proxy from which rigid body proxys are handled.
void RemoveWorldTrigger(WorldTrigger *Trig)
Removes a trigger from the world.
This is a Mezzanine::Threading::iWorkUnit for the updating of the physics debug drawer.
virtual btCollisionObject * _GetBasePhysicsObject() const =0
Accessor for the internal physics object.
ProxyIterator EndCollidableProxy()
Gets an iterator to one passed the last Collidable Proxy in this manager.
Generic6DofConstraint * CreateGeneric6DofConstraint(RigidProxy *ProxyA, RigidProxy *ProxyB, const Transform &TransA, const Transform &TransB)
Creates a new Generic6DofConstraint.
This is the base class for all managers that belong to a single world instance.
This is a proxy from which physics objects that can collide with each other are handled.
DebugDrawWorkUnit & operator=(const DebugDrawWorkUnit &Other)
Protected assignment operator. THIS IS NOT ALLOWED.
virtual void ClearDependencies()
Drop any information about what work units this one depends on.
void RemoveCollision(Physics::Collision *Col)
Removes an existing collision from the world.
virtual Boole GetCollisionResponse() const
Will this respond to 3d collisions.
std::list< btCollisionAlgorithm * > AlgoList
Convenience datatype for a collection of Collision Algorithms.
virtual void Initialize()
Configures this manager for use prior to entering the main loop.
Used to provide better reporting of collisions in a multithreaded environment.
EntresolManager * GetManager(const Whole RetrieveType, UInt16 WhichOne=0)
This is will find the manager of a given type.
virtual void RemoveWorkUnitMonopoly(MonopolyWorkUnit *LessWork)
Remove a WorkUnit from the Monopoly pool of WorkUnits (and not from the Main or Affinity group)...
virtual void drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color)
This will prepare a line segment for being drawn.
This is simply a place for storing all the Physics Related functions.
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.
Integer GetDebugRenderingMode() const
Is Physics Debug Drawing currently enabled?
void SetWorldGravity(const Vector3 &pgrav)
Sets the gravity.
This is a constraint to be used to restrict the movement between two objects to angular rotation on a...
Threading::DefaultWorkUnit * GetSimulationWork()
Gets a pointer to the work unit that steps the simulation.
World * ParentWorld
A pointer to the world that created this manager.
CollidableProxy * ProxyA
The first CollidableProxy involved in the collision.
ManagerBase::ManagerType GetManagerType() const
Gets the type of manager that is created by this factory.
This is used to represent a point in space, or a vector through space.
ProxyContainer::iterator ProxyIterator
Iterator type for CollidableProxy instances stored by this class.
A basic timer class to assist in timed operations.
virtual void Deinitialize()
Removes this manager from any necessary configuration so it can be safely disposed of...
This is intended to store basic graphics setting for the user.
void Stop()
Deactivates the Timer.
Whole PhysicsFlags
The flags to initialize the physics system with.
Real StepSize
The amount of time (in seconds) a single simulation step should advance.
The bulk of the engine components go in this namspace.
CollidableProxy * GetProxy(const UInt32 Index) const
Gets a CollidableProxy instance by index.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
Boole SimulationIsPaused()
Gets Whether or not the simulation is currently paused.
DefaultPhysicsManagerFactory()
Class constructor.
void DestroyProxy(CollidableProxy *ToBeDestroyed)
Deletes a CollidableProxy.
This class represents a world for objects to interact within.
virtual Boole IsInWorld() const
Gets whether or not this object is inside of it's world.
Integer DebugRenderMode
The current rendering mode for the debug drawer.
virtual void SetLogger(Mezzanine::Logger *Logger)
Sets the safe logger to sent debug output to.
GearConstraint * CreateGearConstraint(RigidProxy *ProxyA, RigidProxy *ProxyB, const Vector3 &AxisA, const Vector3 &AxisB)
Creates a new GearConstraint.
btGhostPairCallback * GhostCallback
A pointer to the callback that enables ghost objects internally.
WorldTrigger * GetWorldTrigger(const String &Name)
Gets a trigger by name.
Boole ReleaseID(const IDType ID)
Frees up an ID so that it can be reused.
btSequentialImpulseConstraintSolver * BulletSolver
A pointer to the internal constraint solver.
CollisionMapIterator BeginCollision()
Get an CollisionIterator to the first Collision.
ActorUpdateWorkUnit * GetActorUpdateWork()
Gets the work unit responsible for updating actors stored by this manager.
virtual UInt32 GetConstraintID() const
Gets the unique ID of this constraint.
virtual void PrepareForUpdate()
Clears data as necessary for updating debug geometry.
static PhysicsManager * CallBackWorld
The World that will be used for the InternalTickCallback.
Whole GetNumCollisions()
Gets the number of Collisions currently in the world.
virtual void DoWork(Threading::DefaultThreadSpecificStorage::Type &CurrentThreadStorage)
This does any required update of the Graphical Scene graph and REnders one frame. ...
virtual ~InternalDebugDrawer()
Destructor.
Vector3 GeographyUpperBounds
The upper limits of the worlds AABB.
Real GetTimeMultiplier() const
How much faster or slower that reality is the physic ssystem.
btThreadSupportInterface * BulletSolverThreads
A pointer to the thread provider for the internal constraint solver.
Hinge2Constraint * CreateHinge2Constraint(RigidProxy *ProxyA, RigidProxy *ProxyB, const Vector3 &Anchor, const Vector3 &Axis1, const Vector3 &Axis2)
Creates a new Hinge2Constraint.
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).
virtual void reportErrorWarning(const char *warningString)
Used by the physics subsystem to report errors using the renderer.
Point2PointConstraint * CreatePoint2PointConstraint(RigidProxy *ProxyA, RigidProxy *ProxyB, const Vector3 &PivotA, const Vector3 &PivotB)
Creates a new Point2PointConstraint.
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.
Whole GetLastFrameTime() const
How long was the previous frame?
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.
virtual ~SimulationWorkUnit()
Class destructor.
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.
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.
virtual void _NotifyProxyDestroyed(WorldProxy *ToBeDestroyed)=0
Notifies that a proxy belonging to this WorldObject is being forcibly destroyed, and it needs to upda...
virtual void FinalizeUpdate()
Copies all the line data to render buffers so they can be seen on screen.
Node GetChild(const Char8 *Name) const
Attempt to get a child Node with a given name.
A manager responsible for the storage and management of all actors that exist in a world...
Boole Initialized
Simple Boole indicating whether or not this manager has been initialized.
virtual ~WorldTriggerUpdateWorkUnit()
Class destructor.