1// Copyright (C) 2023 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 QtGraphs 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 "q3dcamera.h"
18#include "q3dobject_p.h"
19#include <QtGui/QMatrix4x4>
20
21QT_BEGIN_NAMESPACE
22
23class Q3DCamera;
24
25class Q3DCameraPrivate : public Q3DObjectPrivate
26{
27 Q_DECLARE_PUBLIC(Q3DCamera)
28
29public:
30 Q3DCameraPrivate(Q3DCamera *q);
31 ~Q3DCameraPrivate();
32
33 void sync(Q3DCamera &other);
34
35 void setXRotation(float rotation);
36 void setYRotation(float rotation);
37 void setMinXRotation(float rotation);
38 float minXRotation() const;
39 void setMinYRotation(float rotation);
40 float minYRotation() const;
41 void setMaxXRotation(float rotation);
42 float maxXRotation() const;
43 void setMaxYRotation(float rotation);
44 float maxYRotation() const;
45
46 void updateViewMatrix(float zoomAdjustment);
47
48 QMatrix4x4 viewMatrix() const;
49 void setViewMatrix(const QMatrix4x4 &viewMatrix);
50
51 bool isViewMatrixAutoUpdateEnabled() const;
52 void setViewMatrixAutoUpdateEnabled(bool isEnabled);
53
54 void setBaseOrientation(const QVector3D &defaultPosition,
55 const QVector3D &defaultTarget,
56 const QVector3D &defaultUp);
57
58 QVector3D calculatePositionRelativeToCamera(const QVector3D &relativePosition,
59 float fixedRotation,
60 float distanceModifier) const;
61
62public:
63 QVector3D m_actualTarget;
64 QVector3D m_up;
65
66 QMatrix4x4 m_viewMatrix;
67 bool m_isViewMatrixUpdateActive;
68
69 float m_xRotation;
70 float m_yRotation;
71 float m_minXRotation;
72 float m_minYRotation;
73 float m_maxXRotation;
74 float m_maxYRotation;
75 float m_zoomLevel;
76 float m_minZoomLevel;
77 float m_maxZoomLevel;
78 bool m_wrapXRotation;
79 bool m_wrapYRotation;
80 Q3DCamera::CameraPreset m_activePreset;
81 QVector3D m_requestedTarget;
82};
83
84QT_END_NAMESPACE
85
86#endif
87

source code of qtgraphs/src/graphs/engine/q3dcamera_p.h