-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEntity.cpp
More file actions
108 lines (80 loc) · 2.18 KB
/
Copy pathEntity.cpp
File metadata and controls
108 lines (80 loc) · 2.18 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
#include "Entity.h"
using namespace _Entity;
Entity::Entity(vec3 position):Entity(position, vec3(position.x, position.y, position.z + 1), true) {
}
Entity::Entity(vec3 position, vec3 target):Entity(position, target, false) {
}
Entity::Entity(vec3 position, vec3 target, bool isStatic) {
if (position == target) {
// TODO: Check this works for central objects
printMsg("Position and Target are the same; Adjusting vectors...");
target = vec3(position.x, position.y, position.z + 1);
}
this->position = position;
this->isStatic = isStatic;
setTarget(target);
// Order of glm::cross parameters matters!
right = normalize(cross(direction, worldUp));
}
void Entity::translation(vec3 translation) {
position = position + translation;
}
void Entity::translation(float x, float y, float z) {
}
void Entity::rotation(float degrees, vec3 axis) {
matrix = rotate(matrix, radians(degrees), axis);
// update();
}
void Entity::doRotation(float degrees, vec3 axis, int duration) {
}
void Entity::animate(vec3* animations, float* durations) {
}
void Entity::setPosition(vec3 position) {
this->position = position;
}
void Entity::setTarget(vec3 target) {
this->target = target;
direction = normalize(target - position);
}
void _Entity::Entity::setDeltaTime(float deltaTime) {
this->deltaTime = deltaTime;
}
vec3 Entity::getPosition() {
return position;
}
mat4 Entity::getMatrix() {
return matrix;
}
void Entity::update() {
matrix = lookAt(position, position - direction, worldUp);
}
void Entity::update(GLfloat interval) {
this->interval = interval;
update();
}
void Entity::draw() {
// Intentionally Blank
}
void Entity::processInput(std::string key) {
// Intentionally Blank
}
void Entity::processMouseInput(int button) {
// Intentionally Blank
}
void Entity::processMouse(float x, float y) {
if (firstMouse) {
mouseX = x;
mouseY = y;
firstMouse = false;
}
offsetX = (x - mouseX) * mouseSensitivity;
offsetY = (mouseY - y) * mouseSensitivity;
mouseX = x;
mouseY = y;
}
void Entity::printVector( vec3 vector) {
std::cout << "Pos:(" << vector.x << "," << vector.y << "," << vector.z << ")" << std::endl;
}
void Entity::printMsg( std::string msg ) {
std::cout << msg << std::endl;
}