-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathglitem.h
92 lines (78 loc) · 3.13 KB
/
glitem.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
90
91
92
/****************************************************************************
**
** Copyright (C) 2014 Alexander Rössler
** License: LGPL version 2.1
**
** This file is part of QtQuickVcp.
**
** All rights reserved. This program and the accompanying materials
** are made available under the terms of the GNU Lesser General Public License
** (LGPL) version 2.1 which accompanies this distribution, and is available at
** http://www.gnu.org/licenses/lgpl-2.1.html
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
** Contributors:
** Alexander Rössler @ The Cool Tool GmbH <mail DOT aroessler AT gmail DOT com>
**
****************************************************************************/
#ifndef GLITEM_H
#define GLITEM_H
#include <QObject>
#include "glview.h"
namespace qtquickvcp {
class GLView;
class GLItem : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(QVector3D position READ position WRITE setPosition NOTIFY positionChanged)
Q_PROPERTY(QVector3D scale READ scale WRITE setScale NOTIFY scaleChanged)
Q_PROPERTY(QQuaternion rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
Q_PROPERTY(float rotationAngle READ rotationAngle WRITE setRotationAngle NOTIFY rotationAngleChanged)
Q_PROPERTY(QVector3D rotationAxis READ rotationAxis WRITE setRotationAxis NOTIFY rotationAxisChanged)
Q_PROPERTY(QVector3D rotationVector READ rotationVector WRITE setRotationVector NOTIFY rotationVectorChanged)
public:
explicit GLItem(QQuickItem *parent = 0);
virtual void paint(GLView *glView) = 0; // must be implemented
QVector3D position() const;
QVector3D scale() const;
QQuaternion rotation() const;
float rotationAngle() const;
QVector3D rotationAxis() const;
QVector3D rotationVector() const;
signals:
void needsUpdate();
void modelIdChanged(quint32 arg);
void positionChanged(const QVector3D &arg);
void scaleChanged(const QVector3D &arg);
void rotationChanged(const QQuaternion &arg);
void rotationAngleChanged(float arg);
void rotationAxisChanged(const QVector3D &arg);
void rotationVectorChanged(const QVector3D &rotationVector);
public slots:
void requestPaint();
virtual void selectDrawable(void *pointer) = 0; // must be implemented
void setPosition(float x, float y, float z);
void setPosition(const QVector3D &arg);
void setScale(float x, float y, float z);
void setScale(const QVector3D &arg);
void setRotation(float angle, float x, float y, float z);
void setRotation(float angle, const QVector3D &axis);
void setRotation(const QQuaternion &arg);
void setRotationAngle(float arg);
void setRotationAxis(const QVector3D &arg);
void setRotationVector(const QVector3D &rotationVector);
private:
QVector3D m_position;
QVector3D m_scale;
QQuaternion m_rotation;
float m_rotationAngle;
QVector3D m_rotationAxis;
QVector3D m_rotationVector;
};
// class GLItem
} // namespace qtquickvcp
#endif // GLITEM_H