-
Notifications
You must be signed in to change notification settings - Fork 0
/
fisiqs.hpp
61 lines (44 loc) · 1.33 KB
/
fisiqs.hpp
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef FISI_GUARD
#define FISI_GUARD
#include<iostream>
#include <btBulletDynamicsCommon.h>
#include <glm/glm.hpp>
namespace fisiqs {
glm::mat4 btScalar2glmMat4asdasd(btScalar* matrix);
class FisiWorld;
class FisiBody {
private:
bool isDisabled = false;
public:
btRigidBody* body;
FisiWorld* world;
FisiBody();
FisiBody(btRigidBody *rb, FisiWorld *world);
void setPosition(btVector3 position);
glm::mat4 getOpenGLMatrix();
glm::vec3 getWorldPosition();
glm::vec3 getRotation();
void disableBody();
void enableBody();
~FisiBody();
};
class FisiWorld {
private:
btDefaultCollisionConfiguration* m_collisionConfiguration;
btCollisionDispatcher* m_dispatcher;
btBroadphaseInterface* m_broadphase;
btConstraintSolver* m_solver;
btDiscreteDynamicsWorld* m_dynamicsWorld;
btScalar aux_transform[16];
btTransform aux_trans;
public:
FisiWorld(btVector3 gravity);
btDiscreteDynamicsWorld* getWorld() { return m_dynamicsWorld; }
void update(float dt);
FisiBody* createFisiBody(float mass, const btVector3& startPosition, btCollisionShape* shape, btVector3 localInertia = btVector3(0,0,0));
btBoxShape* createBoxShape(const btVector3& halfExtents);
btSphereShape* createSphereShape(const btScalar radius);
glm::mat4 getBodyModel(btRigidBody *body);
};
}
#endif