| 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 Q3DSCENE_P_H | 
| 41 | #define Q3DSCENE_P_H | 
| 42 |  | 
| 43 | #include "datavisualizationglobal_p.h" | 
| 44 | #include "q3dscene.h" | 
| 45 |  | 
| 46 | QT_BEGIN_NAMESPACE_DATAVISUALIZATION | 
| 47 |  | 
| 48 | class Q3DCamera; | 
| 49 | class Q3DLight; | 
| 50 |  | 
| 51 | struct Q3DSceneChangeBitField { | 
| 52 |     bool viewportChanged               : 1; | 
| 53 |     bool primarySubViewportChanged     : 1; | 
| 54 |     bool secondarySubViewportChanged   : 1; | 
| 55 |     bool subViewportOrderChanged       : 1; | 
| 56 |     bool cameraChanged                 : 1; | 
| 57 |     bool lightChanged                  : 1; | 
| 58 |     bool slicingActivatedChanged       : 1; | 
| 59 |     bool devicePixelRatioChanged       : 1; | 
| 60 |     bool selectionQueryPositionChanged : 1; | 
| 61 |     bool graphPositionQueryPositionChanged      : 1; | 
| 62 |     bool windowSizeChanged             : 1; | 
| 63 |  | 
| 64 |     Q3DSceneChangeBitField() | 
| 65 |         : viewportChanged(true), | 
| 66 |           primarySubViewportChanged(true), | 
| 67 |           secondarySubViewportChanged(true), | 
| 68 |           subViewportOrderChanged(true), | 
| 69 |           cameraChanged(true), | 
| 70 |           lightChanged(true), | 
| 71 |           slicingActivatedChanged(true), | 
| 72 |           devicePixelRatioChanged(true), | 
| 73 |           selectionQueryPositionChanged(false), | 
| 74 |           graphPositionQueryPositionChanged(false), | 
| 75 |           windowSizeChanged(true) | 
| 76 |     { | 
| 77 |     } | 
| 78 | }; | 
| 79 |  | 
| 80 | class QT_DATAVISUALIZATION_EXPORT Q3DScenePrivate : public QObject | 
| 81 | { | 
| 82 |     Q_OBJECT | 
| 83 | public: | 
| 84 |     Q3DScenePrivate(Q3DScene *q); | 
| 85 |     ~Q3DScenePrivate(); | 
| 86 |  | 
| 87 |     void sync(Q3DScenePrivate &other); | 
| 88 |  | 
| 89 |     void setViewport(const QRect &viewport); | 
| 90 |     void setViewportSize(int width, int height); | 
| 91 |     void setWindowSize(const QSize &size); | 
| 92 |     QSize windowSize() const; | 
| 93 |     void calculateSubViewports(); | 
| 94 |     void updateGLViewport(); | 
| 95 |     void updateGLSubViewports(); | 
| 96 |  | 
| 97 |     QRect glViewport(); | 
| 98 |     QRect glPrimarySubViewport(); | 
| 99 |     QRect glSecondarySubViewport(); | 
| 100 |  | 
| 101 |     void setLightPositionRelativeToCamera(const QVector3D &relativePosition, | 
| 102 |                                           float fixedRotation = 0.0f, | 
| 103 |                                           float distanceModifier = 0.0f); | 
| 104 |  | 
| 105 |     void markDirty(); | 
| 106 |  | 
| 107 |     bool isInArea(const QRect &area, int x, int y) const; | 
| 108 |  | 
| 109 | Q_SIGNALS: | 
| 110 |     void needRender(); | 
| 111 |  | 
| 112 | public: | 
| 113 |     Q3DScene *q_ptr; | 
| 114 |     Q3DSceneChangeBitField m_changeTracker; | 
| 115 |  | 
| 116 |     QRect m_viewport; | 
| 117 |     QRect m_primarySubViewport; | 
| 118 |     QRect m_secondarySubViewport; | 
| 119 |     bool m_isSecondarySubviewOnTop; | 
| 120 |     float m_devicePixelRatio; | 
| 121 |     Q3DCamera *m_camera; | 
| 122 |     Q3DLight *m_light; | 
| 123 |     bool m_isUnderSideCameraEnabled; | 
| 124 |     bool m_isSlicingActive; | 
| 125 |     QPoint m_selectionQueryPosition; | 
| 126 |     QPoint m_graphPositionQueryPosition; | 
| 127 |     QSize m_windowSize; | 
| 128 |     QRect m_glViewport; | 
| 129 |     QRect m_glPrimarySubViewport; | 
| 130 |     QRect m_glSecondarySubViewport; | 
| 131 |     bool m_sceneDirty; | 
| 132 |     QRect m_defaultSmallViewport; | 
| 133 |     QRect m_defaultLargeViewport; | 
| 134 | }; | 
| 135 |  | 
| 136 | QT_END_NAMESPACE_DATAVISUALIZATION | 
| 137 |  | 
| 138 | #endif | 
| 139 |  |