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