| 1 | // Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QT3DRENDER_RENDER_TRANSFORM_H |
| 5 | #define QT3DRENDER_RENDER_TRANSFORM_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists for the convenience |
| 12 | // of other Qt classes. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <Qt3DRender/private/backendnode_p.h> |
| 19 | #include <QtGui/qquaternion.h> |
| 20 | #include <QtGui/qvector3d.h> |
| 21 | #include <Qt3DCore/private/matrix4x4_p.h> |
| 22 | |
| 23 | QT_BEGIN_NAMESPACE |
| 24 | |
| 25 | namespace Qt3DRender { |
| 26 | |
| 27 | namespace Render { |
| 28 | |
| 29 | class Renderer; |
| 30 | class TransformManager; |
| 31 | |
| 32 | class Q_3DRENDERSHARED_PRIVATE_EXPORT Transform : public BackendNode |
| 33 | { |
| 34 | public: |
| 35 | Transform(); |
| 36 | void cleanup(); |
| 37 | |
| 38 | Matrix4x4 transformMatrix() const; |
| 39 | bool hasViewMatrix() const { return m_hasViewMatrix; } |
| 40 | const Matrix4x4& viewMatrix() const { return m_viewMatrix; } |
| 41 | QVector3D scale() const; |
| 42 | QQuaternion rotation() const; |
| 43 | QVector3D translation() const; |
| 44 | |
| 45 | void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) final; |
| 46 | |
| 47 | private: |
| 48 | void updateMatrix(); |
| 49 | bool m_hasViewMatrix; |
| 50 | Matrix4x4 m_viewMatrix; |
| 51 | Matrix4x4 m_transformMatrix; |
| 52 | QQuaternion m_rotation; |
| 53 | QVector3D m_scale; |
| 54 | QVector3D m_translation; |
| 55 | }; |
| 56 | |
| 57 | } // namespace Render |
| 58 | |
| 59 | } // namespace Qt3DRender |
| 60 | |
| 61 | QT_END_NAMESPACE |
| 62 | |
| 63 | #endif // QT3DRENDER_RENDER_TRANSFORM_H |
| 64 | |