-
Notifications
You must be signed in to change notification settings - Fork 7
/
controller.h
73 lines (52 loc) · 1.77 KB
/
controller.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
#ifndef CONTROLLER_H
#define CONTROLLER_H
#include <QObject>
#include <QMatrix4x4>
#include <Qt3DCore/qtransform.h>
#include <QTransform>
#include <Qt3DCore/qentity.h>
#include <Qt3DRender/QMesh>
#include <Qt3DExtras/QPhongMaterial>
#include <QPropertyAnimation>
#include <iostream>
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
class QTransform;
}
class Controller : public QObject {
Q_OBJECT
Q_PROPERTY(Qt3DCore::QTransform* target READ target WRITE setTarget NOTIFY targetChanged)
Q_PROPERTY(float angle READ angle WRITE setAngle NOTIFY angleChanged)
public:
Controller();
Controller(QObject *parent = nullptr);
void setTarget(Qt3DCore::QTransform *target);
Qt3DCore::QTransform *target() const;
void setAngle(float angle);
float angle() const;
void setAxis(QVector3D naxis);
void setPoint(QVector3D npoint);
QVector3D getAxis();
QVector3D getPoint();
float _Angle[3] = {0, 0, 0};
float prevAngle[3] = {0, 0, 0};
QVector3D _Axis[3] = {QVector3D(0, 1, 0), QVector3D(0, 0, 1), QVector3D(0, 0, 1)};
QVector3D prevAxis[3] = {QVector3D(0, 1, 0), QVector3D(0, 0, 1), QVector3D(0, 0, 1)};
QVector3D _Point[3] = {QVector3D(0, 0, 0), QVector3D(0, 0, 0), QVector3D(0, 0, 0)};
QVector3D prevPoint[3] = {QVector3D(0, 0, 0), QVector3D(0, 0, 0), QVector3D(0, 0, 0)};
int n;
signals:
void targetChanged();
void angleChanged();
protected:
void updateMatrix();
private:
Qt3DCore::QTransform *m_target;
QMatrix4x4 m_matrix;
float m_angle;
// Parámetros del sistema de referencia para la rotación
QVector3D axis;
QVector3D point;
};
QT_END_NAMESPACE
#endif // CONTROLLER_H