1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Data Visualization module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL$
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 General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 or (at your option) any later version
20** approved by the KDE Free Qt Foundation. The licenses are as published by
21** the Free Software Foundation and appearing in the file LICENSE.GPL3
22** included in the packaging of this file. Please review the following
23** information to ensure the GNU General Public License requirements will
24** be met: https://www.gnu.org/licenses/gpl-3.0.html.
25**
26** $QT_END_LICENSE$
27**
28****************************************************************************/
29
30//
31// W A R N I N G
32// -------------
33//
34// This file is not part of the QtDataVisualization API. It exists purely as an
35// implementation detail. This header file may change from version to
36// version without notice, or even be removed.
37//
38// We mean it.
39
40#ifndef Q3DCAMERA_P_H
41#define Q3DCAMERA_P_H
42
43#include "datavisualizationglobal_p.h"
44#include "q3dcamera.h"
45#include <QtGui/QMatrix4x4>
46
47QT_BEGIN_NAMESPACE_DATAVISUALIZATION
48
49class Q3DCamera;
50
51class Q3DCameraPrivate : public QObject
52{
53 Q_OBJECT
54public:
55 Q3DCameraPrivate(Q3DCamera *q);
56 ~Q3DCameraPrivate();
57
58 void sync(Q3DCamera &other);
59
60 void setXRotation(float rotation);
61 void setYRotation(float rotation);
62 void setMinXRotation(float rotation);
63 float minXRotation() const;
64 void setMinYRotation(float rotation);
65 float minYRotation() const;
66 void setMaxXRotation(float rotation);
67 float maxXRotation() const;
68 void setMaxYRotation(float rotation);
69 float maxYRotation() const;
70
71 void updateViewMatrix(float zoomAdjustment);
72
73 QMatrix4x4 viewMatrix() const;
74 void setViewMatrix(const QMatrix4x4 &viewMatrix);
75
76 bool isViewMatrixAutoUpdateEnabled() const;
77 void setViewMatrixAutoUpdateEnabled(bool isEnabled);
78
79 void setBaseOrientation(const QVector3D &defaultPosition,
80 const QVector3D &defaultTarget,
81 const QVector3D &defaultUp);
82
83 QVector3D calculatePositionRelativeToCamera(const QVector3D &relativePosition,
84 float fixedRotation,
85 float distanceModifier) const;
86
87Q_SIGNALS:
88 void minXRotationChanged(float rotation);
89 void minYRotationChanged(float rotation);
90 void maxXRotationChanged(float rotation);
91 void maxYRotationChanged(float rotation);
92 void viewMatrixChanged(QMatrix4x4 viewMatrix);
93 void viewMatrixAutoUpdateChanged(bool enabled);
94
95public:
96 Q3DCamera *q_ptr;
97
98 QVector3D m_actualTarget;
99 QVector3D m_up;
100
101 QMatrix4x4 m_viewMatrix;
102 bool m_isViewMatrixUpdateActive;
103
104 float m_xRotation;
105 float m_yRotation;
106 float m_minXRotation;
107 float m_minYRotation;
108 float m_maxXRotation;
109 float m_maxYRotation;
110 float m_zoomLevel;
111 float m_minZoomLevel;
112 float m_maxZoomLevel;
113 bool m_wrapXRotation;
114 bool m_wrapYRotation;
115 Q3DCamera::CameraPreset m_activePreset;
116 QVector3D m_requestedTarget;
117
118 friend class Bars3DRenderer;
119 friend class Surface3DRenderer;
120 friend class Scatter3DRenderer;
121 friend class SelectionPointer;
122 friend class Q3DInputHandler;
123 friend class QTouch3DInputHandler;
124};
125
126QT_END_NAMESPACE_DATAVISUALIZATION
127
128#endif
129

source code of qtdatavis3d/src/datavisualization/engine/q3dcamera_p.h