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 QCUSTOM3DVOLUME_P_H |
15 | #define QCUSTOM3DVOLUME_P_H |
16 | |
17 | #include "qcustom3dvolume.h" |
18 | #include "qcustom3ditem_p.h" |
19 | |
20 | QT_BEGIN_NAMESPACE |
21 | |
22 | struct QCustomVolumeDirtyBitField { |
23 | bool textureDimensionsDirty : 1; |
24 | bool slicesDirty : 1; |
25 | bool colorTableDirty : 1; |
26 | bool textureDataDirty : 1; |
27 | bool textureFormatDirty : 1; |
28 | bool alphaDirty : 1; |
29 | bool shaderDirty : 1; |
30 | |
31 | QCustomVolumeDirtyBitField() |
32 | : textureDimensionsDirty(false), |
33 | slicesDirty(false), |
34 | colorTableDirty(false), |
35 | textureDataDirty(false), |
36 | textureFormatDirty(false), |
37 | alphaDirty(false), |
38 | shaderDirty(false) |
39 | { |
40 | } |
41 | }; |
42 | |
43 | class QCustom3DVolumePrivate : public QCustom3DItemPrivate |
44 | { |
45 | Q_DECLARE_PUBLIC(QCustom3DVolume) |
46 | |
47 | public: |
48 | QCustom3DVolumePrivate(QCustom3DVolume *q); |
49 | QCustom3DVolumePrivate(QCustom3DVolume *q, const QVector3D &position, const QVector3D &scaling, |
50 | const QQuaternion &rotation, int textureWidth, int textureHeight, |
51 | int textureDepth, QList<uchar> *textureData, |
52 | QImage::Format textureFormat, const QList<QRgb> &colorTable); |
53 | virtual ~QCustom3DVolumePrivate(); |
54 | |
55 | void resetDirtyBits(); |
56 | QImage renderSlice(Qt::Axis axis, int index); |
57 | |
58 | public: |
59 | int m_textureWidth; |
60 | int m_textureHeight; |
61 | int m_textureDepth; |
62 | int m_sliceIndexX; |
63 | int m_sliceIndexY; |
64 | int m_sliceIndexZ; |
65 | |
66 | QImage::Format m_textureFormat; |
67 | QList<QRgb> m_colorTable; |
68 | QList<uchar> *m_textureData; |
69 | |
70 | float m_alphaMultiplier; |
71 | bool m_preserveOpacity; |
72 | bool m_useHighDefShader; |
73 | |
74 | bool m_drawSlices; |
75 | bool m_drawSliceFrames; |
76 | QColor m_sliceFrameColor; |
77 | QVector3D m_sliceFrameWidths; |
78 | QVector3D m_sliceFrameGaps; |
79 | QVector3D m_sliceFrameThicknesses; |
80 | |
81 | QCustomVolumeDirtyBitField m_dirtyBitsVolume; |
82 | |
83 | private: |
84 | int multipliedAlphaValue(int alpha); |
85 | }; |
86 | |
87 | QT_END_NAMESPACE |
88 | |
89 | #endif |
90 | |