-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAObject.cpp
More file actions
132 lines (109 loc) · 2.24 KB
/
Copy pathAObject.cpp
File metadata and controls
132 lines (109 loc) · 2.24 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#include "AObject.hpp"
AObject::AObject() :
_position(0, 0, 0),
_rotation(0, 0, 0),
_scale(1, 1, 1),
_state(UNDEFINED),
_letter('a')
{}
AObject::AObject(int Px, int Py, int Pz, int Rx, int Ry, int Rz) :
_position(Px, Py, Pz),
_rotation(Rx, Ry, Rz),
_scale(1, 1, 1),
_state(UNDEFINED),
_letter('a')
{}
bool AObject::initialize()
{
return true;
}
void AObject::update(gdl::Clock const &clock, gdl::Input &input)
{
static_cast<void>(clock);
static_cast<void>(input);
}
void AObject::update(gdl::Clock const &clock, gdl::Input &input,
std::string mode)
{
static_cast<void>(clock);
static_cast<void>(input);
static_cast<void>(mode);
}
void AObject::update(gdl::Clock const &clock, gdl::Input &input,
std::deque<AObject *> & dynamicObjects)
{
static_cast<void>(clock);
static_cast<void>(input);
static_cast<void>(dynamicObjects);
}
void AObject::draw(gdl::AShader &shader, gdl::Clock const &clock)
{
static_cast<void>(shader);
static_cast<void>(clock);
}
char AObject::getLetter() const
{
return _letter;
}
void AObject::translate(glm::vec3 const &v)
{
_position += v;
}
void AObject::rotate(glm::vec3 const& axis, float angle)
{
_rotation += axis * angle;
}
void AObject::scale(glm::vec3 const& scale)
{
_scale *= scale;
}
glm::mat4 AObject::getTransformation()
{
glm::mat4 transform(1);
transform = glm::translate(transform, _position);
transform = glm::rotate(transform, _rotation.x, glm::vec3(1, 0, 0));
transform = glm::rotate(transform, _rotation.y, glm::vec3(0, 1, 0));
transform = glm::rotate(transform, _rotation.z, glm::vec3(0, 0, 1));
transform = glm::scale(transform, _scale);
return transform;
}
float AObject::getPosX() const
{
return (_position.x);
}
float AObject::getPosY() const
{
return (_position.y);
}
float AObject::getPosZ() const
{
return (_position.z);
}
int AObject::getNbValue() const
{
return -1;
}
void AObject::setPosX(float x)
{
_position.x = x;
}
void AObject::setPosY(float y)
{
_position.y = y;
}
void AObject::setPosZ(float z)
{
_position.z = z;
}
void AObject::setState(eState other)
{
_state = other;
}
AObject::eState AObject::getState() const
{
return _state;
}
void AObject::setSetting(bool setting)
{
_setting = setting;
}