1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the QtDataVisualization API. It exists purely as an
9// implementation detail. This header file may change from version to
10// version without notice, or even be removed.
11//
12// We mean it.
13
14#ifndef Q3DCAMERA_P_H
15#define Q3DCAMERA_P_H
16
17#include "datavisualizationglobal_p.h"
18#include "q3dcamera.h"
19#include <QtGui/QMatrix4x4>
20
21QT_BEGIN_NAMESPACE
22
23class Q3DCamera;
24
25class Q3DCameraPrivate : public QObject
26{
27 Q_OBJECT
28public:
29 Q3DCameraPrivate(Q3DCamera *q);
30 ~Q3DCameraPrivate();
31
32 void sync(Q3DCamera &other);
33
34 void setXRotation(float rotation);
35 void setYRotation(float rotation);
36 void setMinXRotation(float rotation);
37 float minXRotation() const;
38 void setMinYRotation(float rotation);
39 float minYRotation() const;
40 void setMaxXRotation(float rotation);
41 float maxXRotation() const;
42 void setMaxYRotation(float rotation);
43 float maxYRotation() const;
44
45 void updateViewMatrix(float zoomAdjustment);
46
47 QMatrix4x4 viewMatrix() const;
48 void setViewMatrix(const QMatrix4x4 &viewMatrix);
49
50 bool isViewMatrixAutoUpdateEnabled() const;
51 void setViewMatrixAutoUpdateEnabled(bool isEnabled);
52
53 void setBaseOrientation(const QVector3D &defaultPosition,
54 const QVector3D &defaultTarget,
55 const QVector3D &defaultUp);
56
57 QVector3D calculatePositionRelativeToCamera(const QVector3D &relativePosition,
58 float fixedRotation,
59 float distanceModifier) const;
60
61Q_SIGNALS:
62 void minXRotationChanged(float rotation);
63 void minYRotationChanged(float rotation);
64 void maxXRotationChanged(float rotation);
65 void maxYRotationChanged(float rotation);
66 void viewMatrixChanged(const QMatrix4x4 &viewMatrix);
67 void viewMatrixAutoUpdateChanged(bool enabled);
68
69public:
70 Q3DCamera *q_ptr;
71
72 QVector3D m_actualTarget;
73 QVector3D m_up;
74
75 QMatrix4x4 m_viewMatrix;
76 bool m_isViewMatrixUpdateActive;
77
78 float m_xRotation;
79 float m_yRotation;
80 float m_minXRotation;
81 float m_minYRotation;
82 float m_maxXRotation;
83 float m_maxYRotation;
84 float m_zoomLevel;
85 float m_minZoomLevel;
86 float m_maxZoomLevel;
87 bool m_wrapXRotation;
88 bool m_wrapYRotation;
89 Q3DCamera::CameraPreset m_activePreset;
90 QVector3D m_requestedTarget;
91
92 friend class Bars3DRenderer;
93 friend class Surface3DRenderer;
94 friend class Scatter3DRenderer;
95 friend class SelectionPointer;
96 friend class Q3DInputHandler;
97 friend class QTouch3DInputHandler;
98};
99
100QT_END_NAMESPACE
101
102#endif
103

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