forked from lokesh-sharma/GameEngine
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPhysicsEngine.h
More file actions
30 lines (28 loc) · 910 Bytes
/
PhysicsEngine.h
File metadata and controls
30 lines (28 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef PHYSICSENGINE_H
#define PHYSICSENGINE_H
#include<vector>
#include<map>
#include"PhysicsObject.h"
#include"btBulletDynamicsCommon.h"
#include"LinearMath/btTransform.h"
#include"LinearMath/btVector3.h"
class PhysicsEngine
{
public:
PhysicsEngine() ;
void addObject(PhysicsObject*object , std::string id );
void simulate(float delta);
void handleCollisions();
btBroadphaseInterface* getBroadPhase() { return broadPhase ; }
btDynamicsWorld* getDynamicWorld() { return world ;}
PhysicsObject* getObject(std::string name) { return m_objects[name] ;}
int getNumObjects() const { return m_objects.size() ;}
private:
btDynamicsWorld* world;
btDispatcher* dispatcher;
btBroadphaseInterface* broadPhase;
btConstraintSolver* solver;
btCollisionConfiguration* collisionConfig;
std::map<std::string , PhysicsObject*> m_objects;
};
#endif // PHYSICSENGINE_H