6#include <PhosphorRendering/phosphorrendering_export.h>
62 Q_PROPERTY(qreal iTime READ iTime WRITE setITime NOTIFY iTimeChanged FINAL)
63 Q_PROPERTY(qreal iTimeDelta READ iTimeDelta WRITE setITimeDelta NOTIFY iTimeDeltaChanged FINAL)
64 Q_PROPERTY(
int iFrame READ iFrame WRITE setIFrame NOTIFY iFrameChanged FINAL)
65 Q_PROPERTY(QSizeF iResolution READ iResolution WRITE setIResolution NOTIFY iResolutionChanged FINAL)
66 Q_PROPERTY(QPointF iMouse READ iMouse WRITE setIMouse NOTIFY iMouseChanged FINAL)
67 Q_PROPERTY(
bool isReversed READ isReversed WRITE setIsReversed NOTIFY isReversedChanged FINAL)
85 Q_PROPERTY(
bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged FINAL)
88 Q_PROPERTY(QUrl shaderSource READ shaderSource WRITE setShaderSource NOTIFY shaderSourceChanged FINAL)
89 Q_PROPERTY(QUrl vertexShaderUrl READ vertexShaderUrl WRITE setVertexShaderUrl NOTIFY vertexShaderUrlChanged FINAL)
90 Q_PROPERTY(QVariantMap shaderParams READ shaderParams WRITE setShaderParams NOTIFY shaderParamsChanged)
91 Q_PROPERTY(QQuickItem* sourceItem READ sourceItem WRITE setSourceItem NOTIFY sourceItemChanged FINAL)
95 QString bufferShaderPath READ bufferShaderPath WRITE setBufferShaderPath NOTIFY bufferShaderPathChanged FINAL)
96 Q_PROPERTY(QStringList bufferShaderPaths READ bufferShaderPaths WRITE setBufferShaderPaths NOTIFY
97 bufferShaderPathsChanged FINAL)
98 Q_PROPERTY(
bool bufferFeedback READ bufferFeedback WRITE setBufferFeedback NOTIFY bufferFeedbackChanged FINAL)
99 Q_PROPERTY(qreal bufferScale READ bufferScale WRITE setBufferScale NOTIFY bufferScaleChanged FINAL)
100 Q_PROPERTY(QString bufferWrap READ bufferWrap WRITE setBufferWrap NOTIFY bufferWrapChanged FINAL)
101 Q_PROPERTY(QStringList bufferWraps READ bufferWraps WRITE setBufferWraps NOTIFY bufferWrapsChanged FINAL)
102 Q_PROPERTY(QString bufferFilter READ bufferFilter WRITE setBufferFilter NOTIFY bufferFilterChanged FINAL)
103 Q_PROPERTY(QStringList bufferFilters READ bufferFilters WRITE setBufferFilters NOTIFY bufferFiltersChanged FINAL)
106 Q_PROPERTY(QVector4D customParams1 READ customParams1 WRITE setCustomParams1 NOTIFY customParamsChanged FINAL)
107 Q_PROPERTY(QVector4D customParams2 READ customParams2 WRITE setCustomParams2 NOTIFY customParamsChanged FINAL)
108 Q_PROPERTY(QVector4D customParams3 READ customParams3 WRITE setCustomParams3 NOTIFY customParamsChanged FINAL)
109 Q_PROPERTY(QVector4D customParams4 READ customParams4 WRITE setCustomParams4 NOTIFY customParamsChanged FINAL)
110 Q_PROPERTY(QVector4D customParams5 READ customParams5 WRITE setCustomParams5 NOTIFY customParamsChanged FINAL)
111 Q_PROPERTY(QVector4D customParams6 READ customParams6 WRITE setCustomParams6 NOTIFY customParamsChanged FINAL)
112 Q_PROPERTY(QVector4D customParams7 READ customParams7 WRITE setCustomParams7 NOTIFY customParamsChanged FINAL)
113 Q_PROPERTY(QVector4D customParams8 READ customParams8 WRITE setCustomParams8 NOTIFY customParamsChanged FINAL)
116 Q_PROPERTY(QColor customColor1 READ customColor1 WRITE setCustomColor1 NOTIFY customColorsChanged FINAL)
117 Q_PROPERTY(QColor customColor2 READ customColor2 WRITE setCustomColor2 NOTIFY customColorsChanged FINAL)
118 Q_PROPERTY(QColor customColor3 READ customColor3 WRITE setCustomColor3 NOTIFY customColorsChanged FINAL)
119 Q_PROPERTY(QColor customColor4 READ customColor4 WRITE setCustomColor4 NOTIFY customColorsChanged FINAL)
120 Q_PROPERTY(QColor customColor5 READ customColor5 WRITE setCustomColor5 NOTIFY customColorsChanged FINAL)
121 Q_PROPERTY(QColor customColor6 READ customColor6 WRITE setCustomColor6 NOTIFY customColorsChanged FINAL)
122 Q_PROPERTY(QColor customColor7 READ customColor7 WRITE setCustomColor7 NOTIFY customColorsChanged FINAL)
123 Q_PROPERTY(QColor customColor8 READ customColor8 WRITE setCustomColor8 NOTIFY customColorsChanged FINAL)
124 Q_PROPERTY(QColor customColor9 READ customColor9 WRITE setCustomColor9 NOTIFY customColorsChanged FINAL)
125 Q_PROPERTY(QColor customColor10 READ customColor10 WRITE setCustomColor10 NOTIFY customColorsChanged FINAL)
126 Q_PROPERTY(QColor customColor11 READ customColor11 WRITE setCustomColor11 NOTIFY customColorsChanged FINAL)
127 Q_PROPERTY(QColor customColor12 READ customColor12 WRITE setCustomColor12 NOTIFY customColorsChanged FINAL)
128 Q_PROPERTY(QColor customColor13 READ customColor13 WRITE setCustomColor13 NOTIFY customColorsChanged FINAL)
129 Q_PROPERTY(QColor customColor14 READ customColor14 WRITE setCustomColor14 NOTIFY customColorsChanged FINAL)
130 Q_PROPERTY(QColor customColor15 READ customColor15 WRITE setCustomColor15 NOTIFY customColorsChanged FINAL)
131 Q_PROPERTY(QColor customColor16 READ customColor16 WRITE setCustomColor16 NOTIFY customColorsChanged FINAL)
134 Q_PROPERTY(QVariant audioSpectrum READ audioSpectrumVariant WRITE setAudioSpectrumVariant NOTIFY
135 audioSpectrumChanged FINAL)
137 QImage wallpaperTexture READ wallpaperTexture WRITE setWallpaperTexture NOTIFY wallpaperTextureChanged FINAL)
138 Q_PROPERTY(
bool useWallpaper READ useWallpaper WRITE setUseWallpaper NOTIFY useWallpaperChanged FINAL)
139 Q_PROPERTY(
bool useDepthBuffer READ useDepthBuffer WRITE setUseDepthBuffer NOTIFY useDepthBufferChanged FINAL)
142 Q_PROPERTY(
Status status READ status NOTIFY statusChanged FINAL)
143 Q_PROPERTY(QString errorLog READ errorLog NOTIFY errorLogChanged FINAL)
163 static constexpr
int kMaxSvgDimension = 2048;
171 static constexpr qint64 kMaxSvgPixelBytes = 16LL * 1024 * 1024;
187 virtual
void setUniformExtension(std::shared_ptr<
PhosphorShaders::IUniformExtension> extension);
228 return m_iResolution;
242 return m_shaderSource;
248 return m_vertexShaderUrl;
254 return m_shaderParams;
342 return m_sourceItem.data();
350 return m_bufferShaderPath;
356 return m_bufferShaderPaths;
362 return m_bufferFeedback;
368 return m_bufferScale;
380 return m_bufferWraps;
386 return m_bufferFilter;
392 return m_bufferFilters;
400 return m_customParams[0];
405 return m_customParams[1];
410 return m_customParams[2];
415 return m_customParams[3];
420 return m_customParams[4];
425 return m_customParams[5];
430 return m_customParams[6];
435 return m_customParams[7];
443 return m_customColors[0];
448 return m_customColors[1];
453 return m_customColors[2];
458 return m_customColors[3];
463 return m_customColors[4];
468 return m_customColors[5];
473 return m_customColors[6];
478 return m_customColors[7];
483 return m_customColors[8];
488 return m_customColors[9];
493 return m_customColors[10];
498 return m_customColors[11];
503 return m_customColors[12];
508 return m_customColors[13];
513 return m_customColors[14];
518 return m_customColors[15];
580 return m_useWallpaper;
586 return m_useDepthBuffer;
596 return m_shaderIncludePaths;
603 return m_status.load(std::memory_order_acquire);
653 void geometryChange(
const QRectF& newGeometry,
const QRectF& oldGeometry)
override;
655 void itemChange(ItemChange change,
const ItemChangeData& value)
override;
678 return m_shaderDirty.exchange(
false);
702 void updatePlayingConnection();
705 void onPlayingTick();
712 qreal m_iTimeDelta = 0.0;
713 qreal m_playingLastFrameSeconds = 0.0;
714 QSizeF m_iResolution;
717 bool m_isReversed =
false;
718 bool m_playing =
false;
719 QMetaObject::Connection m_playingConnection;
723 QUrl m_vertexShaderUrl;
724 QVariantMap m_shaderParams;
725 QStringList m_shaderIncludePaths;
731 QPointer<QQuickItem> m_sourceItem;
735 bool m_warnedSelfSourceItem =
false;
738 QString m_bufferShaderPath;
739 QStringList m_bufferShaderPaths;
740 bool m_bufferFeedback =
false;
741 qreal m_bufferScale = 1.0;
742 QString m_bufferWrap = QStringLiteral(
"clamp");
743 QStringList m_bufferWraps;
744 QString m_bufferFilter = QStringLiteral(
"linear");
745 QStringList m_bufferFilters;
748 std::array<QVector4D, 8> m_customParams = {{
749 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
750 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
751 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
752 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
753 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
754 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
755 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
756 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
760 std::array<QColor, 16> m_customColors = {{
761 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
762 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
763 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
764 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
765 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
766 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
767 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
768 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
769 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
770 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
771 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
772 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
773 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
774 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
775 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
776 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
780 QVector<float> m_audioSpectrum;
781 std::array<QImage, kMaxUserTextureSlots> m_userTextureImages;
782 std::array<QString, kMaxUserTextureSlots> m_userTextureWraps;
788 std::array<QString, kMaxUserTextureSlots> m_userTexturePaths;
795 std::array<int, kMaxUserTextureSlots> m_userTextureSvgSizes = {1024, 1024, 1024, 1024};
805 bool m_userTexturesDirectlyOverridden =
false;
806 QImage m_wallpaperTexture;
807 mutable QMutex m_wallpaperTextureMutex;
808 bool m_useWallpaper =
false;
809 bool m_useDepthBuffer =
false;
812 std::shared_ptr<PhosphorShaders::IUniformExtension> m_uniformExtension;
822 std::atomic<Status> m_status{Status::Null};
826 ShaderNodeRhi* m_renderNode =
nullptr;
829 QPointer<QQuickWindow> m_connectedWindow;
832 std::atomic<bool> m_shaderDirty{
false};
QQuickItem that renders a fullscreen fragment shader via Qt RHI.
Definition ShaderEffect.h:58
void reloadShader()
Force reload of shader from source (callable from QML).
QColor customColor4() const
Definition ShaderEffect.h:456
void setCustomParams4(const QVector4D ¶ms)
void setCustomParams6(const QVector4D ¶ms)
QVariant audioSpectrumVariant() const
void setUserTexture(int slot, const QImage &image)
Set a user texture (slots 0-3, bindings 7-10) directly from a QImage, bypassing the path-driven loade...
void bufferFiltersChanged()
void setITime(qreal time)
void setUserTextureWrap(int slot, const QString &wrap)
Set user texture wrap mode (slots 0-3).
void setShaderSource(const QUrl &source)
void setIResolution(const QSizeF &resolution)
QColor customColorAt(int index) const
Read a customColor slot by index.
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
QVariantMap shaderParams() const
Definition ShaderEffect.h:252
void wallpaperTextureChanged()
void setCustomColor3(const QColor &color)
bool useDepthBuffer() const
Definition ShaderEffect.h:584
void setBufferShaderPath(const QString &path)
void setCustomColor7(const QColor &color)
QVector4D customParams7() const
Definition ShaderEffect.h:428
QVector4D customParams4() const
Definition ShaderEffect.h:413
void setBufferFilters(const QStringList &filters)
QPointF iMouse() const
Definition ShaderEffect.h:232
void setCustomColor2(const QColor &color)
void setBufferFeedback(bool enable)
void setCustomColor11(const QColor &color)
QColor customColor15() const
Definition ShaderEffect.h:511
void setCustomColor10(const QColor &color)
void statusChanged()
Emitted when status() transitions.
qreal bufferScale() const
Definition ShaderEffect.h:366
bool isReversed() const
Definition ShaderEffect.h:216
void shaderParamsChanged()
QUrl shaderSource() const
Definition ShaderEffect.h:240
QColor customColor1() const
Definition ShaderEffect.h:441
void setStatus(Status newStatus)
void setAudioSpectrumVariant(const QVariant &spectrum)
void setCustomColor15(const QColor &color)
void setIFrame(int frame)
void bufferShaderPathsChanged()
bool useWallpaper() const
Definition ShaderEffect.h:578
void shaderSourceChanged()
void setCustomColorAt(int index, const QColor &color)
Write a customColor slot by index.
QColor customColor16() const
Definition ShaderEffect.h:516
void setUseWallpaper(bool use)
void setBufferShaderPaths(const QStringList &paths)
void setPlaying(bool playing)
QImage wallpaperTexture() const
void setBufferWrap(const QString &wrap)
QUrl vertexShaderUrl() const
Definition ShaderEffect.h:246
void setCustomParams2(const QVector4D ¶ms)
void setCustomColor9(const QColor &color)
QColor customColor13() const
Definition ShaderEffect.h:501
QVector4D customParams3() const
Definition ShaderEffect.h:408
void setCustomParams7(const QVector4D ¶ms)
QVector4D customParams1() const
Definition ShaderEffect.h:398
void setCustomColor4(const QColor &color)
QColor customColor14() const
Definition ShaderEffect.h:506
QColor customColor7() const
Definition ShaderEffect.h:471
void setBufferFilter(const QString &filter)
QSGNode * updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) override
QVector4D customParamAt(int index) const
Read a customParams slot by index.
void iResolutionChanged()
void setIMouse(const QPointF &mouse)
void setCustomParamAt(int index, const QVector4D ¶ms)
Write a customParams slot by index.
QVector4D customParams8() const
Definition ShaderEffect.h:433
void audioSpectrumChanged()
QStringList bufferFilters() const
Definition ShaderEffect.h:390
void setCustomColor6(const QColor &color)
void setCustomColor13(const QColor &color)
void setCustomParams5(const QVector4D ¶ms)
void componentComplete() override
bool bufferFeedback() const
Definition ShaderEffect.h:360
QString bufferWrap() const
Definition ShaderEffect.h:372
void setCustomParams3(const QVector4D ¶ms)
bool isPlaying() const
Definition ShaderEffect.h:210
void syncBasePropertiesToNode(ShaderNodeRhi *node)
Sync base properties (time, params, colors, audio, multipass, depth, wallpaper) to a render node.
void setBufferWraps(const QStringList &wraps)
QVector4D customParams5() const
Definition ShaderEffect.h:418
QColor customColor3() const
Definition ShaderEffect.h:451
QString bufferFilter() const
Definition ShaderEffect.h:384
void customParamsChanged()
void customColorsChanged()
Status status() const
Definition ShaderEffect.h:601
QColor customColor2() const
Definition ShaderEffect.h:446
virtual ShaderNodeRhi * createShaderNode()
Factory hook for the render node updatePaintNode() will create.
QStringList bufferWraps() const
Definition ShaderEffect.h:378
void bufferShaderPathChanged()
void setCustomColor8(const QColor &color)
QColor customColor8() const
Definition ShaderEffect.h:476
QVector4D customParams2() const
Definition ShaderEffect.h:403
QColor customColor11() const
Definition ShaderEffect.h:491
Status
Auto-tick mode.
Definition ShaderEffect.h:149
void bufferScaleChanged()
QStringList bufferShaderPaths() const
Definition ShaderEffect.h:354
void setCustomColor5(const QColor &color)
int iFrame() const
Definition ShaderEffect.h:204
QVector4D customParams6() const
Definition ShaderEffect.h:423
void setShaderIncludePaths(const QStringList &paths)
Set directories to search for #include directives in shaders.
void itemChange(ItemChange change, const ItemChangeData &value) override
void setUseDepthBuffer(bool use)
void setAudioSpectrum(const QVector< float > &spectrum)
Direct setter from C++ avoiding QVariantList round-trip.
void setCustomColor16(const QColor &color)
QString errorLog() const
Definition ShaderEffect.h:605
void setCustomColor1(const QColor &color)
void setCustomColor14(const QColor &color)
void bufferWrapsChanged()
void setWallpaperTexture(const QImage &image)
void setCustomParams8(const QVector4D ¶ms)
QSizeF iResolution() const
Definition ShaderEffect.h:226
void bufferFilterChanged()
void setITimeDelta(qreal delta)
QColor customColor5() const
Definition ShaderEffect.h:461
QColor customColor6() const
Definition ShaderEffect.h:466
void setIsReversed(bool reverse)
Direction signal forwarded to ShaderNodeRhi → BaseUniforms::iIsReversed.
virtual void setShaderParams(const QVariantMap ¶ms)
Push a parameter map onto the shader.
void setSourceItem(QQuickItem *item)
void setCustomColor12(const QColor &color)
static QImage loadUserTextureFile(const QString &path, int svgMaxDim)
Static helper that loads a user-texture file (PNG/JPG/etc.
QColor customColor12() const
Definition ShaderEffect.h:496
void setError(const QString &error)
void setBufferScale(qreal scale)
void setCustomParams1(const QVector4D ¶ms)
QStringList shaderIncludePaths() const
Definition ShaderEffect.h:594
QColor customColor10() const
Definition ShaderEffect.h:486
QString bufferShaderPath() const
Definition ShaderEffect.h:348
void vertexShaderUrlChanged()
void setVertexShaderUrl(const QUrl &source)
qreal iTimeDelta() const
Definition ShaderEffect.h:198
void useDepthBufferChanged()
QQuickItem * sourceItem() const
Live texture-provider source bound to SRB binding 7 (uTexture0).
Definition ShaderEffect.h:340
void bufferFeedbackChanged()
void useWallpaperChanged()
QColor customColor9() const
Definition ShaderEffect.h:481
bool consumeShaderDirty()
Atomically read-and-clear the shader-dirty flag.
Definition ShaderEffect.h:676
QSGRenderNode for fullscreen-quad shader rendering via Qt RHI (Vulkan / OpenGL)
Definition ShaderNodeRhi.h:114
Definition ShaderCompiler.h:15
constexpr int kMaxUserTextureSlots
Public mirror of ShaderNodeRhi::kMaxUserTextures (4 user-texture slots at SRB bindings 7....
Definition ShaderEffect.h:41
Definition ShaderEffect.h:28