| 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 SELECTIONPOINTER_P_H |
| 15 | #define SELECTIONPOINTER_P_H |
| 16 | |
| 17 | #include "datavisualizationglobal_p.h" |
| 18 | #include "surface3dcontroller_p.h" |
| 19 | |
| 20 | #include <QtGui/qquaternion.h> |
| 21 | |
| 22 | QT_BEGIN_NAMESPACE |
| 23 | |
| 24 | class ShaderHelper; |
| 25 | class ObjectHelper; |
| 26 | class TextureHelper; |
| 27 | class Drawer; |
| 28 | |
| 29 | class SelectionPointer : public QObject, protected QOpenGLFunctions |
| 30 | { |
| 31 | Q_OBJECT |
| 32 | |
| 33 | public: |
| 34 | explicit SelectionPointer(Drawer *drawer); |
| 35 | ~SelectionPointer(); |
| 36 | |
| 37 | void renderSelectionPointer(GLuint defaultFboHandle = 0, bool useOrtho = false); |
| 38 | void renderSelectionLabel(GLuint defaultFboHandle = 0, bool useOrtho = false); |
| 39 | void setPosition(const QVector3D &position); |
| 40 | void setLabel(const QString &label, bool themeChange = false); |
| 41 | void setPointerObject(ObjectHelper *object); |
| 42 | void setLabelObject(ObjectHelper *object); |
| 43 | void handleDrawerChange(); |
| 44 | void updateBoundingRect(const QRect &rect); |
| 45 | void updateScene(Q3DScene *scene); |
| 46 | void updateSliceData(bool sliceActivated, GLfloat autoScaleAdjustment); |
| 47 | void setHighlightColor(const QVector4D &colorVector); |
| 48 | void setRotation(const QQuaternion &rotation); |
| 49 | |
| 50 | private: |
| 51 | void initializeOpenGL(); |
| 52 | void initShaders(); |
| 53 | |
| 54 | private: |
| 55 | ShaderHelper *m_labelShader; |
| 56 | ShaderHelper *m_pointShader; |
| 57 | ObjectHelper *m_labelObj; // Not owned |
| 58 | ObjectHelper *m_pointObj; // Not owned |
| 59 | TextureHelper *m_textureHelper; |
| 60 | Q3DTheme *m_cachedTheme; |
| 61 | bool m_labelBackground; |
| 62 | LabelItem m_labelItem; |
| 63 | Drawer *m_drawer; |
| 64 | QRect m_mainViewPort; |
| 65 | QVector3D m_position; |
| 66 | Q3DScene *m_cachedScene; |
| 67 | QString m_label; |
| 68 | bool m_cachedIsSlicingActivated; |
| 69 | GLfloat m_autoScaleAdjustment; |
| 70 | QVector4D m_highlightColor; |
| 71 | QQuaternion m_rotation; |
| 72 | }; |
| 73 | |
| 74 | QT_END_NAMESPACE |
| 75 | |
| 76 | #endif |
| 77 | |