-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpers.cpp
76 lines (66 loc) · 2.28 KB
/
helpers.cpp
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
#include "helpers.hpp"
#include <iostream>
using namespace std;
void printMatrix(glm::mat4 M)
{
cout.precision(2);
cout << "[" << setw(8) << M[0].x << setw(8) << M[0].y << setw(8)
<< M[0].z << setw(8) << M[0].w << "]" << endl;
cout << "[" << setw(8) << M[1].x << setw(8) << M[1].y << setw(8)
<< M[1].z << setw(8) << M[1].w << "]" << endl;
cout << "[" << setw(8) << M[2].x << setw(8) << M[2].y << setw(8)
<< M[2].z << setw(8) << M[2].w << "]" << endl;
cout << "[" << setw(8) << M[3].x << setw(8) << M[3].y << setw(8)
<< M[3].z << setw(8) << M[3].w << "]" << endl;
cout << endl;
}
void printMatrix(glm::mat3 M)
{
cout.precision(2);
cout << "[" << setw(8) << M[0].x << setw(8) << M[0].y << setw(8)
<< M[0].z << "]" << endl;
cout << "[" << setw(8) << M[1].x << setw(8) << M[1].y << setw(8)
<< M[1].z << "]" << endl;
cout << "[" << setw(8) << M[2].x << setw(8) << M[2].y << setw(8)
<< M[2].z << "]" << endl;
cout << endl;
}
void printMatrix(glm::mat2 M)
{
cout.precision(2);
cout << "[" << setw(8) << M[0].x << setw(8) << M[0].y << "]" << endl;
cout << "[" << setw(8) << M[1].x << setw(8) << M[1].y << "]" << endl;
cout << endl;
}
glm::mat3 dual(glm::vec3 v)
{
return glm::mat3(
0, v.z, -v.y,
-v.z, 0, v.x,
v.y, -v.x, 0);
}
void help()
{
cout << "\nWelcome to Otus Visualisation Centre.\n\n";
cout << setw(24) << "CONTROLS" << "\n";
cout << "General:" << endl;
cout << setw(8) << "ESC" << " - Exit program" << "\n\n";
cout << "Navigation:" << endl;
cout << setw(8) << "c" << " - Toggle camera mode" << endl;
cout << setw(8) << "w" << " - Move forward"
<< " (FPS)" << endl;
cout << setw(8) << "a" << " - Move left"
<< " (FPS)" << endl;
cout << setw(8) << "s" << " - Move back"
<< " (FPS)" << endl;
cout << setw(8) << "d" << " - Move right"
<< " (FPS)" << endl;
cout << setw(8) << "e" << " - Move up"
<< " (FPS)" << endl;
cout << setw(8) << "q" << " - Move down"
<< " (FPS)" << endl;
cout << setw(8) << "+" << " - Increase speed"
<< " (FPS)" << endl;
cout << setw(8) << "-" << " - Decrease speed"
<< " (FPS)" << endl;
}