-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEntity.cpp
More file actions
94 lines (76 loc) · 1.57 KB
/
Copy pathEntity.cpp
File metadata and controls
94 lines (76 loc) · 1.57 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include "Entity.h"
using namespace cml;
using namespace geometry;
namespace game_objects
{
GLint CEntity::IDCount = 0;
CEntity::CEntity(): position(vector3f(0.0f,0.0f,0.0f)),
rotation(vector3f(0.0f,0.0f,0.0f)),
active(false)
{
ID = IDCount++;
}
CEntity::CEntity(CEntity &entity)
{
this->position=entity.position;
this->rotation=entity.rotation;
this->active=entity.active;
//this->ID=ID;
ID = IDCount++;
}
CEntity::~CEntity()
{
}
GLvoid CEntity::setPosition(vector3f position)
{
this->position=position;
}
GLvoid CEntity::setRotation(vector3f rotation)
{
this->rotation=rotation;
}
GLvoid CEntity::setActive(bool active)
{
this->active=active;
}
vector3f CEntity::getPosition()
{
return position;
}
GLfloat *CEntity::getPositionP()
{
return &position[0];
}
vector3f CEntity::getRotation()
{
return rotation;
}
bool CEntity::isActive()
{
return active;
}
sBoundingBox *CEntity::getBoundingBox()
{
return &boundingBox;
}
GLvoid CEntity::moveTo()
{
glTranslatef(position[0],position[1],position[2]);
}
GLvoid CEntity::moveBack()
{
glTranslatef(-position[0],-position[1],-position[2]);
}
GLvoid CEntity::rotateTo()
{
glRotatef(rotation[0],1.0f,0.0f,0.0f);
glRotatef(rotation[1],0.0f,1.0f,0.0f);
glRotatef(rotation[2],0.0f,0.0f,1.0f);
}
GLvoid CEntity::rotateBack()
{
glRotatef(-rotation[0],1.0f,0.0f,0.0f);
glRotatef(-rotation[1],0.0f,1.0f,0.0f);
glRotatef(-rotation[2],0.0f,0.0f,1.0f);
}
};