-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathBodyEmitter.h
More file actions
67 lines (48 loc) · 1.49 KB
/
BodyEmitter.h
File metadata and controls
67 lines (48 loc) · 1.49 KB
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
62
63
64
65
66
67
#ifndef BODY_EMITTER_H
#define BODY_EMITTER_H
#include "Framework.h"
#include "ParticleEngine.h"
#include "Body.h"
#include "Model.h"
#include <list>
#include "btBulletDynamicsCommon.h"
#include "Level.h"
class BodyEmitter {
public:
BodyEmitter(btDiscreteDynamicsWorld *world);
~BodyEmitter();
void loadModels();
void emitBodies(float tstep, ParticleEngine* pEngine, Level* level);
void drawBodies(RenderPass pass);
void emit(BodyType type, ParticleEngine* pEngine);
void clear();
void boostSpeed();
void resetSpeed();
void setBoostMode(bool boost);
void setEmitSpeed(float speed);
private:
float emitSpeed;
struct ContactCallback : public btCollisionWorld::ContactResultCallback {
BodyEmitter *bodyEmitter;
ContactCallback(BodyEmitter *bodyEmitter);
btScalar addSingleResult(btManifoldPoint &cp,
const btCollisionObject *colObj0, int partId0, int index0,
const btCollisionObject *colObj1, int partId1, int index1);
};
friend struct ContactCallback;
ContactCallback *contactCallback;
btVector3 getAngularVelocityForType(BodyType type);
btVector3 getPositionForType(BodyType type);
btVector3 getLinearVelocityForType(BodyType type);
btScalar getMassForType(BodyType type);
void setSpeed(float speed);
btDiscreteDynamicsWorld *world;
std::list<Body*> bodies;
float accum;
Model models[NUM_BODY_TYPES];
Assimp::Importer importers[NUM_BODY_TYPES];
btCollisionObject *wall;
btCollisionShape *wallShape;
bool boostMode;
};
#endif