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 Q3DSCENE_P_H
15#define Q3DSCENE_P_H
16
17#include <private/datavisualizationglobal_p.h>
18#include <QtDataVisualization/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_DATAVISUALIZATION_EXPORT Q3DScenePrivate : public QObject
55{
56 Q_OBJECT
57public:
58 Q3DScenePrivate(Q3DScene *q);
59 ~Q3DScenePrivate();
60
61 void sync(Q3DScenePrivate &other);
62
63 void setViewport(const QRect &viewport);
64 void setViewportSize(int width, int height);
65 void setWindowSize(const QSize &size);
66 QSize windowSize() const;
67 void calculateSubViewports();
68 void updateGLViewport();
69 void updateGLSubViewports();
70
71 QRect glViewport();
72 QRect glPrimarySubViewport();
73 QRect glSecondarySubViewport();
74
75 void setLightPositionRelativeToCamera(const QVector3D &relativePosition,
76 float fixedRotation = 0.0f,
77 float distanceModifier = 0.0f);
78
79 void markDirty();
80
81 bool isInArea(const QRect &area, int x, int y) const;
82
83Q_SIGNALS:
84 void needRender();
85
86public:
87 Q3DScene *q_ptr;
88 Q3DSceneChangeBitField m_changeTracker;
89
90 QRect m_viewport;
91 QRect m_primarySubViewport;
92 QRect m_secondarySubViewport;
93 bool m_isSecondarySubviewOnTop;
94 float m_devicePixelRatio;
95 Q3DCamera *m_camera;
96 Q3DLight *m_light;
97 bool m_isUnderSideCameraEnabled;
98 bool m_isSlicingActive;
99 QPoint m_selectionQueryPosition;
100 QPoint m_graphPositionQueryPosition;
101 QSize m_windowSize;
102 QRect m_glViewport;
103 QRect m_glPrimarySubViewport;
104 QRect m_glSecondarySubViewport;
105 bool m_sceneDirty;
106 QRect m_defaultSmallViewport;
107 QRect m_defaultLargeViewport;
108};
109
110QT_END_NAMESPACE
111
112#endif
113

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