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

source code of qtgraphs/src/graphs3d/data/qcustom3dvolume_p.h