-
Notifications
You must be signed in to change notification settings - Fork 0
/
ctMatrix4.h
89 lines (75 loc) · 1.95 KB
/
ctMatrix4.h
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
#ifndef CTMATRIX4_H
#define CTMATRIX4_H
#include <QVector3D>
#include <QMatrix4x4>
#include <QDebug>
class ctMatrix4
{
private:
QMatrix4x4 m_matrix;
public:
ctMatrix4();
explicit ctMatrix4(QMatrix4x4);
void Translate(QVector3D);
void TranslateTo(QVector3D);
void Scale(QVector3D);
void RotateX(float);
void RotateY(float);
void RotateZ(float);
void Multiply(const QMatrix4x4&);
void Multiply(const ctMatrix4&);
QMatrix4x4 GetMatrix() const;
void SetMatrix(const QMatrix4x4&);
ctMatrix4 operator *(ctMatrix4 & t_mat)
{
ctMatrix4 tmp(*this);
tmp.Multiply(t_mat);
return tmp;
}
ctMatrix4 operator *= (ctMatrix4 & t_mat)
{
this->Multiply(t_mat);
return *this;
}
ctMatrix4 operator -= (ctMatrix4 & t_mat)
{
m_matrix -= t_mat.GetMatrix();
return *this;
}
//ctMatrix4& operator = (ctMatrix4 & t_mat);//const;
// ctMatrix4& operator = ( const ctMatrix4 & t_mat)
// {
// //m_matrix = const_cast<QMatrix4x4*>(&m_matrix);
// m_matrix.setToIdentity();
// m_matrix *= t_mat.GetMatrix();
// return *this;
// }
ctMatrix4 operator=( const ctMatrix4 & t_mat)
{
m_matrix.setToIdentity();
m_matrix *= t_mat.GetMatrix();
return *this;
}
// ctMatrix4& operator = (ctMatrix4 t_mat)
// {
// m_matrix.setToIdentity();
// m_matrix *= t_mat.GetMatrix();
// return *this;
// }
// ctMatrix4& operator = (const ctMatrix4&& t_mat) // move assignment
// {
// m_matrix.setToIdentity();
// m_matrix *= t_mat.GetMatrix();
// return *this;
// }
ctMatrix4 Transpose();
ctMatrix4 Transposed();
ctMatrix4 Inverted();//(bool);
ctMatrix4 ToIdentity();
// ctMatrix4 operator= (ctMatrix4 & t_mat)
// {
// SetMatrix(t_mat.GetMatrix());
// return *this;
// }
};
#endif // CTMATRIX4_H