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 Q3DSCENE_P_H
15#define Q3DSCENE_P_H
16
17#include <private/graphsglobal_p.h>
18#include <QtGraphs/q3dscene.h>
19
20QT_BEGIN_NAMESPACE
21
22class Q3DCamera;
23class Q3DLight;
24
25struct Q3DSceneChangeBitField {
26 bool viewportChanged : 1;
27 bool primarySubViewportChanged : 1;
28 bool secondarySubViewportChanged : 1;
29 bool subViewportOrderChanged : 1;
30 bool cameraChanged : 1;
31 bool lightChanged : 1;
32 bool slicingActivatedChanged : 1;
33 bool devicePixelRatioChanged : 1;
34 bool selectionQueryPositionChanged : 1;
35 bool graphPositionQueryPositionChanged : 1;
36 bool windowSizeChanged : 1;
37
38 Q3DSceneChangeBitField()
39 : viewportChanged(true),
40 primarySubViewportChanged(true),
41 secondarySubViewportChanged(true),
42 subViewportOrderChanged(true),
43 cameraChanged(true),
44 lightChanged(true),
45 slicingActivatedChanged(true),
46 devicePixelRatioChanged(true),
47 selectionQueryPositionChanged(false),
48 graphPositionQueryPositionChanged(false),
49 windowSizeChanged(true)
50 {
51 }
52};
53
54class Q_GRAPHS_EXPORT Q3DScenePrivate : public QObject
55{
56 Q_OBJECT
57 Q_DECLARE_PUBLIC(Q3DScene)
58
59public:
60 Q3DScenePrivate(Q3DScene *q);
61 ~Q3DScenePrivate();
62
63 void sync(Q3DScenePrivate &other);
64
65 void setViewport(const QRect &viewport);
66 void setViewportSize(int width, int height);
67 void setWindowSize(const QSize &size);
68 QSize windowSize() const;
69 void calculateSubViewports();
70 void updateGLViewport();
71 void updateGLSubViewports();
72
73 QRect glViewport();
74 QRect glPrimarySubViewport();
75 QRect glSecondarySubViewport();
76
77 void setLightPositionRelativeToCamera(const QVector3D &relativePosition,
78 float fixedRotation = 0.0f,
79 float distanceModifier = 0.0f);
80
81 void markDirty();
82
83 bool isInArea(const QRect &area, int x, int y) const;
84
85Q_SIGNALS:
86 void needRender();
87
88protected:
89 Q3DScene *q_ptr;
90
91public:
92 Q3DSceneChangeBitField m_changeTracker;
93
94 QRect m_viewport;
95 QRect m_primarySubViewport;
96 QRect m_secondarySubViewport;
97 bool m_isSecondarySubviewOnTop;
98 float m_devicePixelRatio;
99 Q3DCamera *m_camera;
100 Q3DLight *m_light;
101 bool m_isUnderSideCameraEnabled;
102 bool m_isSlicingActive;
103 QPoint m_selectionQueryPosition;
104 QPoint m_graphPositionQueryPosition;
105 QSize m_windowSize;
106 QRect m_glViewport;
107 QRect m_glPrimarySubViewport;
108 QRect m_glSecondarySubViewport;
109 bool m_sceneDirty;
110 QRect m_defaultSmallViewport;
111 QRect m_defaultLargeViewport;
112};
113
114QT_END_NAMESPACE
115
116#endif
117

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