33 Q_PROPERTY(ReflectionQuality quality READ quality WRITE setQuality NOTIFY qualityChanged)
34 Q_PROPERTY(QColor clearColor READ clearColor WRITE setClearColor NOTIFY clearColorChanged)
35 Q_PROPERTY(ReflectionRefreshMode refreshMode READ refreshMode WRITE setRefreshMode NOTIFY refreshModeChanged)
36 Q_PROPERTY(ReflectionTimeSlicing timeSlicing READ timeSlicing WRITE setTimeSlicing NOTIFY timeSlicingChanged)
37 Q_PROPERTY(
bool parallaxCorrection READ parallaxCorrection WRITE setParallaxCorrection NOTIFY parallaxCorrectionChanged)
38 Q_PROPERTY(QVector3D boxSize READ boxSize WRITE setBoxSize NOTIFY boxSizeChanged)
39 Q_PROPERTY(QVector3D boxOffset READ boxOffset WRITE setBoxOffset NOTIFY boxOffsetChanged REVISION(6, 4))
40 Q_PROPERTY(
bool debugView READ debugView WRITE setDebugView NOTIFY debugViewChanged REVISION(6, 4))
41 Q_PROPERTY(QQuick3DCubeMapTexture *texture READ texture WRITE setTexture NOTIFY textureChanged REVISION(6, 5))
42 QML_NAMED_ELEMENT(ReflectionProbe)
43 QML_ADDED_IN_VERSION(6, 3)
46 enum class ReflectionQuality {
53 Q_ENUM(ReflectionQuality)
55 enum class ReflectionRefreshMode {
59 Q_ENUM(ReflectionRefreshMode)
61 enum class ReflectionTimeSlicing {
66 Q_ENUM(ReflectionTimeSlicing)
68 explicit QQuick3DReflectionProbe(QQuick3DNode *parent =
nullptr);
69 ~QQuick3DReflectionProbe() override { }
71 ReflectionQuality quality()
const;
72 QColor clearColor()
const;
73 ReflectionRefreshMode refreshMode()
const;
74 ReflectionTimeSlicing timeSlicing()
const;
75 bool parallaxCorrection()
const;
76 QVector3D boxSize()
const;
77 Q_REVISION(6, 4)
bool debugView()
const;
78 Q_REVISION(6, 4) QVector3D boxOffset()
const;
80 Q_REVISION(6, 4) Q_INVOKABLE
void scheduleUpdate();
81 Q_REVISION(6, 5) QQuick3DCubeMapTexture *texture()
const;
84 void setQuality(ReflectionQuality reflectionQuality);
85 void setClearColor(
const QColor &clearColor);
86 void setRefreshMode(ReflectionRefreshMode newRefreshMode);
87 void setTimeSlicing(ReflectionTimeSlicing newTimeSlicing);
88 void setParallaxCorrection(
bool parallaxCorrection);
89 void setBoxSize(
const QVector3D &newBoxSize);
90 Q_REVISION(6, 4)
void setDebugView(
bool debugView);
91 Q_REVISION(6, 4)
void setBoxOffset(
const QVector3D &boxOffset);
92 Q_REVISION(6, 5)
void setTexture(QQuick3DCubeMapTexture *newTexture);
95 void qualityChanged();
96 void clearColorChanged();
97 void refreshModeChanged();
98 void timeSlicingChanged();
99 void parallaxCorrectionChanged();
101 void boxSizeChanged();
102 Q_REVISION(6, 4)
void debugViewChanged();
103 Q_REVISION(6, 4)
void boxOffsetChanged();
104 Q_REVISION(6, 5)
void textureChanged();
107 QSSGRenderGraphObject *updateSpatialNode(QSSGRenderGraphObject *node) override;
108 void markAllDirty() override;
109 void itemChange(ItemChange,
const ItemChangeData &) override;
111 enum class DirtyFlag {
112 QualityDirty = (1 << 0),
113 ClearColorDirty = (1 << 1),
114 RefreshModeDirty = (1 << 2),
115 ParallaxCorrectionDirty = (1 << 3),
117 TimeSlicingDirty = (1 << 5),
118 TextureDirty = (1 << 6)
120 Q_DECLARE_FLAGS(DirtyFlags, DirtyFlag)
122 static constexpr DirtyFlags AllDirty = DirtyFlags(DirtyFlag::QualityDirty)
123 | DirtyFlags(DirtyFlag::ClearColorDirty)
124 | DirtyFlags(DirtyFlag::RefreshModeDirty)
125 | DirtyFlags(DirtyFlag::ParallaxCorrectionDirty)
126 | DirtyFlags(DirtyFlag::BoxDirty)
127 | DirtyFlags(DirtyFlag::TimeSlicingDirty)
128 | DirtyFlags(DirtyFlag::TextureDirty);
130 DirtyFlags m_dirtyFlags = QQuick3DReflectionProbe::AllDirty;
133 quint32 mapToReflectionResolution(ReflectionQuality quality);
134 void findSceneView();
135 void createDebugView();
136 void updateDebugView();
137 void updateSceneManager(QQuick3DSceneManager *window);
138 ReflectionQuality m_quality = ReflectionQuality::Low;
139 QColor m_clearColor = Qt::transparent;
140 ReflectionRefreshMode m_refreshMode = ReflectionRefreshMode::EveryFrame;
141 bool m_parallaxCorrection =
false;
142 QVector3D m_boxSize = QVector3D(0, 0, 0);
143 ReflectionTimeSlicing m_timeSlicing = ReflectionTimeSlicing::None;
144 bool m_debugView =
false;
146 QQuick3DGeometry *m_debugViewGeometry =
nullptr;
147 QQuick3DModel *m_debugViewModel =
nullptr;
148 QQuick3DDefaultMaterial *m_debugViewMaterial =
nullptr;
149 QVector3D m_boxOffset;
150 QQuick3DViewport* m_sceneView =
nullptr;
151 QQuick3DCubeMapTexture *m_texture =
nullptr;