-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqtutils.cpp
More file actions
38 lines (31 loc) · 981 Bytes
/
qtutils.cpp
File metadata and controls
38 lines (31 loc) · 981 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
#include "qtutils.h"
QFont QTUTILS::getFont()
{
QFont ret;
// switch(font){
// case bold:
// default:
// ret.setWeight(QFont::Bold);
// break;
// }
return ret;
}
QMatrix4x4 QTUTILS::buildTransformationMatrix(float p_scale, float p_x_translation, float p_y_translation,float p_z_translation, int p_x_rotation,
int p_y_rotation, int p_z_rotation)
{
QMatrix4x4 ret;
// Scale
ret.scale(p_scale, p_scale, p_scale);
// Rotate
ret.rotate(p_x_rotation, 1,0);
ret.rotate(p_y_rotation, 0,1);
ret.rotate(p_z_rotation, 0,0,1);
// Translate
ret.translate(p_x_translation, p_y_translation, p_z_translation);
return ret;
}
std::string QTUTILS::toString(QVector4D& p_matrix)
{
return (std::string("[") + std::to_string(p_matrix.x()) + "," + std::to_string(p_matrix.y()) + "," +
std::to_string(p_matrix.z()) + "," + std::to_string(p_matrix.w()) + "]");
}