-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathBody.cpp
More file actions
55 lines (43 loc) · 1 KB
/
Body.cpp
File metadata and controls
55 lines (43 loc) · 1 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
#include "Body.h"
Body::Body(Model *model, btRigidBody::btRigidBodyConstructionInfo &btInfo, BodyType ty)
: btRigidBody(btInfo), type(ty) {
this->model = model;
}
Body::~Body() {
delete this->getMotionState();
}
void Body::draw(RenderPass pass) {
btTransform transform;
this->getMotionState()->getWorldTransform(transform);
model->setTransformation(transform);
model->render(pass);
}
void Body::printType(){
switch (type) {
//case MARS: printf("MARS\n"); break;
case ASTEROID: printf("ASTEROID\n"); break;
case EROS: printf("EROS\n"); break;
case GOLEVKA: printf("GOLEVKA\n"); break;
case JUNO: printf("JUNO\n"); break;
case GATE: printf("GATE\n"); break;
case SPACEBAT: printf("SPACEBAT\n"); break;
default: break;
}
}
BodyType Body::getType(){
return type;
}
bool Body::isHealthType(){
switch (type){
case PEPSI:
return true;
default:
return false;
}
}
bool Body::isCollisionType(){
return !isHealthType() && !isEndType();
}
bool Body::isEndType(){
return type == END;
}