Warning: That file was not part of the compilation database. It may have many parsing errors.

1/****************************************************************************
2**
3** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt3D module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QT3DCORE_QTRANSFORM_H
41#define QT3DCORE_QTRANSFORM_H
42
43#include <Qt3DCore/qcomponent.h>
44#include <QtGui/qmatrix4x4.h>
45#include <QtGui/qquaternion.h>
46#include <QtGui/qvector3d.h>
47
48QT_BEGIN_NAMESPACE
49
50namespace Qt3DCore {
51
52class QTransformPrivate;
53class Q_3DCORESHARED_EXPORT QTransform : public QComponent
54{
55 Q_OBJECT
56 Q_PROPERTY(QMatrix4x4 matrix READ matrix WRITE setMatrix NOTIFY matrixChanged)
57 Q_PROPERTY(float scale READ scale WRITE setScale NOTIFY scaleChanged)
58 Q_PROPERTY(QVector3D scale3D READ scale3D WRITE setScale3D NOTIFY scale3DChanged)
59 Q_PROPERTY(QQuaternion rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
60 Q_PROPERTY(QVector3D translation READ translation WRITE setTranslation NOTIFY translationChanged)
61 Q_PROPERTY(float rotationX READ rotationX WRITE setRotationX NOTIFY rotationXChanged)
62 Q_PROPERTY(float rotationY READ rotationY WRITE setRotationY NOTIFY rotationYChanged)
63 Q_PROPERTY(float rotationZ READ rotationZ WRITE setRotationZ NOTIFY rotationZChanged)
64 Q_PROPERTY(QMatrix4x4 worldMatrix READ worldMatrix NOTIFY worldMatrixChanged REVISION 14)
65
66public:
67 explicit QTransform(QNode *parent = nullptr);
68 ~QTransform();
69
70 float scale() const;
71 QVector3D scale3D() const;
72 QQuaternion rotation() const;
73 QVector3D translation() const;
74
75 Q_INVOKABLE static QQuaternion fromAxisAndAngle(const QVector3D &axis, float angle);
76 Q_INVOKABLE static QQuaternion fromAxisAndAngle(float x, float y, float z, float angle);
77
78 Q_INVOKABLE static QQuaternion fromAxesAndAngles(const QVector3D &axis1, float angle1,
79 const QVector3D &axis2, float angle2);
80 Q_INVOKABLE static QQuaternion fromAxesAndAngles(const QVector3D &axis1, float angle1,
81 const QVector3D &axis2, float angle2,
82 const QVector3D &axis3, float angle3);
83 Q_INVOKABLE static QQuaternion fromAxes(const QVector3D &xAxis, const QVector3D &yAxis, const QVector3D &zAxis);
84
85 Q_INVOKABLE static QQuaternion fromEulerAngles(const QVector3D &eulerAngles);
86 Q_INVOKABLE static QQuaternion fromEulerAngles(float pitch, float yaw, float roll);
87
88 Q_INVOKABLE static QMatrix4x4 rotateAround(const QVector3D &point, float angle, const QVector3D &axis);
89 Q_INVOKABLE static QMatrix4x4 rotateFromAxes(const QVector3D &xAxis, const QVector3D &yAxis, const QVector3D &zAxis);
90
91 QMatrix4x4 matrix() const;
92 QMatrix4x4 worldMatrix() const;
93
94 float rotationX() const;
95 float rotationY() const;
96 float rotationZ() const;
97
98public Q_SLOTS:
99 void setScale(float scale);
100 void setScale3D(const QVector3D &scale);
101 void setRotation(const QQuaternion &rotation);
102 void setTranslation(const QVector3D &translation);
103 void setMatrix(const QMatrix4x4 &matrix);
104
105 void setRotationX(float rotationX);
106 void setRotationY(float rotationY);
107 void setRotationZ(float rotationZ);
108
109Q_SIGNALS:
110 void scaleChanged(float scale);
111 void scale3DChanged(const QVector3D &scale);
112 void rotationChanged(const QQuaternion &rotation);
113 void translationChanged(const QVector3D &translation);
114 void matrixChanged();
115 void rotationXChanged(float rotationX);
116 void rotationYChanged(float rotationY);
117 void rotationZChanged(float rotationZ);
118 void worldMatrixChanged(const QMatrix4x4 &worldMatrix);
119
120protected:
121 explicit QTransform(QTransformPrivate &dd, QNode *parent = nullptr);
122 // TODO Unused remove in Qt6
123 void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override;
124
125private:
126 Q_DECLARE_PRIVATE(QTransform)
127 QNodeCreatedChangeBasePtr createNodeCreationChange() const override;
128};
129
130} // namespace Qt3DCore
131
132QT_END_NAMESPACE
133
134#endif // QT3DCORE_QTRANSFORM_H
135

Warning: That file was not part of the compilation database. It may have many parsing errors.

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

source code of qt3d/src/core/transforms/qtransform.h