-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGenericObject.cpp
More file actions
39 lines (33 loc) · 818 Bytes
/
GenericObject.cpp
File metadata and controls
39 lines (33 loc) · 818 Bytes
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
#include "GenericObject.h"
GenericObject::GenericObject()
{
updateOldPos();
}
GenericObject::~GenericObject()
{
}
void GenericObject::updateOldPos() {
oldx = x; oldy = y;
oldangle = angle;
};
double GenericObject::distMoved(){
return (abs(x - oldx) + abs(y - oldy)) / 4;
}
glm::mat4 GenericObject::rotation()
{
glm::mat4 trans;
trans = glm::rotate(trans, (float)angle, glm::vec3(0.0, 0.0, 1.0));
return trans;
}
glm::mat4 GenericObject::translateOld()//t = motion blur: 0 = old frame, 1 = this frame
{
glm::mat4 trans;
trans = glm::translate(trans, glm::vec3((float)(oldx), (float)(oldy), 0.0));
return trans;
}
glm::mat4 GenericObject::translate()//t = motion blur: 0 = old frame, 1 = this frame
{
glm::mat4 trans;
trans = glm::translate(trans, glm::vec3((float)x, (float)y, 0.0));
return trans;
}