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