6#include <PhosphorRendering/phosphorrendering_export.h>
64 Q_PROPERTY(qreal iTime READ iTime WRITE setITime NOTIFY iTimeChanged FINAL)
65 Q_PROPERTY(qreal iTimeDelta READ iTimeDelta WRITE setITimeDelta NOTIFY iTimeDeltaChanged FINAL)
66 Q_PROPERTY(
int iFrame READ iFrame WRITE setIFrame NOTIFY iFrameChanged FINAL)
67 Q_PROPERTY(QSizeF iResolution READ iResolution WRITE setIResolution NOTIFY iResolutionChanged FINAL)
68 Q_PROPERTY(QPointF iMouse READ iMouse WRITE setIMouse NOTIFY iMouseChanged FINAL)
69 Q_PROPERTY(
bool isReversed READ isReversed WRITE setIsReversed NOTIFY isReversedChanged FINAL)
87 Q_PROPERTY(
bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged FINAL)
90 Q_PROPERTY(QUrl shaderSource READ shaderSource WRITE setShaderSource NOTIFY shaderSourceChanged FINAL)
91 Q_PROPERTY(QUrl vertexShaderUrl READ vertexShaderUrl WRITE setVertexShaderUrl NOTIFY vertexShaderUrlChanged FINAL)
92 Q_PROPERTY(QVariantMap shaderParams READ shaderParams WRITE setShaderParams NOTIFY shaderParamsChanged)
93 Q_PROPERTY(QString paramPreamble READ paramPreamble WRITE setParamPreamble NOTIFY paramPreambleChanged)
94 Q_PROPERTY(QQuickItem* sourceItem READ sourceItem WRITE setSourceItem NOTIFY sourceItemChanged FINAL)
98 QString bufferShaderPath READ bufferShaderPath WRITE setBufferShaderPath NOTIFY bufferShaderPathChanged FINAL)
99 Q_PROPERTY(QStringList bufferShaderPaths READ bufferShaderPaths WRITE setBufferShaderPaths NOTIFY
100 bufferShaderPathsChanged FINAL)
101 Q_PROPERTY(
bool bufferFeedback READ bufferFeedback WRITE setBufferFeedback NOTIFY bufferFeedbackChanged FINAL)
102 Q_PROPERTY(qreal bufferScale READ bufferScale WRITE setBufferScale NOTIFY bufferScaleChanged FINAL)
103 Q_PROPERTY(QString bufferWrap READ bufferWrap WRITE setBufferWrap NOTIFY bufferWrapChanged FINAL)
104 Q_PROPERTY(QStringList bufferWraps READ bufferWraps WRITE setBufferWraps NOTIFY bufferWrapsChanged FINAL)
105 Q_PROPERTY(QString bufferFilter READ bufferFilter WRITE setBufferFilter NOTIFY bufferFilterChanged FINAL)
106 Q_PROPERTY(QStringList bufferFilters READ bufferFilters WRITE setBufferFilters NOTIFY bufferFiltersChanged FINAL)
109 Q_PROPERTY(QVector4D customParams1 READ customParams1 WRITE setCustomParams1 NOTIFY customParamsChanged FINAL)
110 Q_PROPERTY(QVector4D customParams2 READ customParams2 WRITE setCustomParams2 NOTIFY customParamsChanged FINAL)
111 Q_PROPERTY(QVector4D customParams3 READ customParams3 WRITE setCustomParams3 NOTIFY customParamsChanged FINAL)
112 Q_PROPERTY(QVector4D customParams4 READ customParams4 WRITE setCustomParams4 NOTIFY customParamsChanged FINAL)
113 Q_PROPERTY(QVector4D customParams5 READ customParams5 WRITE setCustomParams5 NOTIFY customParamsChanged FINAL)
114 Q_PROPERTY(QVector4D customParams6 READ customParams6 WRITE setCustomParams6 NOTIFY customParamsChanged FINAL)
115 Q_PROPERTY(QVector4D customParams7 READ customParams7 WRITE setCustomParams7 NOTIFY customParamsChanged FINAL)
116 Q_PROPERTY(QVector4D customParams8 READ customParams8 WRITE setCustomParams8 NOTIFY customParamsChanged FINAL)
119 Q_PROPERTY(QColor customColor1 READ customColor1 WRITE setCustomColor1 NOTIFY customColorsChanged FINAL)
120 Q_PROPERTY(QColor customColor2 READ customColor2 WRITE setCustomColor2 NOTIFY customColorsChanged FINAL)
121 Q_PROPERTY(QColor customColor3 READ customColor3 WRITE setCustomColor3 NOTIFY customColorsChanged FINAL)
122 Q_PROPERTY(QColor customColor4 READ customColor4 WRITE setCustomColor4 NOTIFY customColorsChanged FINAL)
123 Q_PROPERTY(QColor customColor5 READ customColor5 WRITE setCustomColor5 NOTIFY customColorsChanged FINAL)
124 Q_PROPERTY(QColor customColor6 READ customColor6 WRITE setCustomColor6 NOTIFY customColorsChanged FINAL)
125 Q_PROPERTY(QColor customColor7 READ customColor7 WRITE setCustomColor7 NOTIFY customColorsChanged FINAL)
126 Q_PROPERTY(QColor customColor8 READ customColor8 WRITE setCustomColor8 NOTIFY customColorsChanged FINAL)
127 Q_PROPERTY(QColor customColor9 READ customColor9 WRITE setCustomColor9 NOTIFY customColorsChanged FINAL)
128 Q_PROPERTY(QColor customColor10 READ customColor10 WRITE setCustomColor10 NOTIFY customColorsChanged FINAL)
129 Q_PROPERTY(QColor customColor11 READ customColor11 WRITE setCustomColor11 NOTIFY customColorsChanged FINAL)
130 Q_PROPERTY(QColor customColor12 READ customColor12 WRITE setCustomColor12 NOTIFY customColorsChanged FINAL)
131 Q_PROPERTY(QColor customColor13 READ customColor13 WRITE setCustomColor13 NOTIFY customColorsChanged FINAL)
132 Q_PROPERTY(QColor customColor14 READ customColor14 WRITE setCustomColor14 NOTIFY customColorsChanged FINAL)
133 Q_PROPERTY(QColor customColor15 READ customColor15 WRITE setCustomColor15 NOTIFY customColorsChanged FINAL)
134 Q_PROPERTY(QColor customColor16 READ customColor16 WRITE setCustomColor16 NOTIFY customColorsChanged FINAL)
137 Q_PROPERTY(QVariant audioSpectrum READ audioSpectrumVariant WRITE setAudioSpectrumVariant NOTIFY
138 audioSpectrumChanged FINAL)
140 QImage wallpaperTexture READ wallpaperTexture WRITE setWallpaperTexture NOTIFY wallpaperTextureChanged FINAL)
141 Q_PROPERTY(
bool useWallpaper READ useWallpaper WRITE setUseWallpaper NOTIFY useWallpaperChanged FINAL)
142 Q_PROPERTY(
bool useDepthBuffer READ useDepthBuffer WRITE setUseDepthBuffer NOTIFY useDepthBufferChanged FINAL)
145 Q_PROPERTY(
Status status READ status NOTIFY statusChanged FINAL)
146 Q_PROPERTY(QString errorLog READ errorLog NOTIFY errorLogChanged FINAL)
166 static constexpr
int kMaxSvgDimension = 2048;
174 static constexpr qint64 kMaxSvgPixelBytes = 16LL * 1024 * 1024;
190 virtual
void setUniformExtension(std::shared_ptr<
PhosphorShaders::IUniformExtension> extension);
231 return m_iResolution;
245 return m_shaderSource;
251 return m_vertexShaderUrl;
257 return m_shaderParams;
345 return m_sourceItem.data();
353 return m_bufferShaderPath;
359 return m_bufferShaderPaths;
365 return m_bufferFeedback;
371 return m_bufferScale;
383 return m_bufferWraps;
389 return m_bufferFilter;
395 return m_bufferFilters;
403 return m_customParams[0];
408 return m_customParams[1];
413 return m_customParams[2];
418 return m_customParams[3];
423 return m_customParams[4];
428 return m_customParams[5];
433 return m_customParams[6];
438 return m_customParams[7];
446 return m_customColors[0];
451 return m_customColors[1];
456 return m_customColors[2];
461 return m_customColors[3];
466 return m_customColors[4];
471 return m_customColors[5];
476 return m_customColors[6];
481 return m_customColors[7];
486 return m_customColors[8];
491 return m_customColors[9];
496 return m_customColors[10];
501 return m_customColors[11];
506 return m_customColors[12];
511 return m_customColors[13];
516 return m_customColors[14];
521 return m_customColors[15];
583 return m_useWallpaper;
589 return m_useDepthBuffer;
599 return m_shaderIncludePaths;
612 return m_paramPreamble;
622 void setEntryScaffold(
const QString& prologue,
const QList<PhosphorShaders::EntryCandidate>& candidates);
628 return m_status.load(std::memory_order_acquire);
679 void geometryChange(
const QRectF& newGeometry,
const QRectF& oldGeometry)
override;
681 void itemChange(ItemChange change,
const ItemChangeData& value)
override;
704 return m_shaderDirty.exchange(
false);
728 void updatePlayingConnection();
731 void onPlayingTick();
738 qreal m_iTimeDelta = 0.0;
739 qreal m_playingLastFrameSeconds = 0.0;
740 QSizeF m_iResolution;
743 bool m_isReversed =
false;
744 bool m_playing =
false;
745 QMetaObject::Connection m_playingConnection;
749 QUrl m_vertexShaderUrl;
750 QVariantMap m_shaderParams;
751 QStringList m_shaderIncludePaths;
752 QString m_paramPreamble;
753 QString m_entryPrologue;
754 QList<PhosphorShaders::EntryCandidate> m_entryCandidates;
760 QPointer<QQuickItem> m_sourceItem;
764 bool m_warnedSelfSourceItem =
false;
767 QString m_bufferShaderPath;
768 QStringList m_bufferShaderPaths;
769 bool m_bufferFeedback =
false;
770 qreal m_bufferScale = 1.0;
771 QString m_bufferWrap = QStringLiteral(
"clamp");
772 QStringList m_bufferWraps;
773 QString m_bufferFilter = QStringLiteral(
"linear");
774 QStringList m_bufferFilters;
777 std::array<QVector4D, 8> m_customParams = {{
778 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
779 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
780 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
781 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
782 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
783 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
784 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
785 QVector4D(-1.0f, -1.0f, -1.0f, -1.0f),
789 std::array<QColor, 16> m_customColors = {{
790 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
791 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
792 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
793 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
794 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
795 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
796 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
797 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
798 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
799 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
800 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
801 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
802 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
803 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
804 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
805 QColor::fromRgbF(0.0f, 0.0f, 0.0f, 0.0f),
809 QVector<float> m_audioSpectrum;
810 std::array<QImage, kMaxUserTextureSlots> m_userTextureImages;
811 std::array<QString, kMaxUserTextureSlots> m_userTextureWraps;
817 std::array<QString, kMaxUserTextureSlots> m_userTexturePaths;
824 std::array<int, kMaxUserTextureSlots> m_userTextureSvgSizes = {1024, 1024, 1024, 1024};
834 bool m_userTexturesDirectlyOverridden =
false;
835 QImage m_wallpaperTexture;
836 mutable QMutex m_wallpaperTextureMutex;
837 bool m_useWallpaper =
false;
838 bool m_useDepthBuffer =
false;
841 std::shared_ptr<PhosphorShaders::IUniformExtension> m_uniformExtension;
851 std::atomic<Status> m_status{Status::Null};
855 ShaderNodeRhi* m_renderNode =
nullptr;
858 QPointer<QQuickWindow> m_connectedWindow;
861 std::atomic<bool> m_shaderDirty{
false};
QQuickItem that renders a fullscreen fragment shader via Qt RHI.
Definition ShaderEffect.h:60
void reloadShader()
Force reload of shader from source (callable from QML).
QColor customColor4() const
Definition ShaderEffect.h:459
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:255
void wallpaperTextureChanged()
QString paramPreamble() const
Definition ShaderEffect.h:610
void setCustomColor3(const QColor &color)
bool useDepthBuffer() const
Definition ShaderEffect.h:587
void setBufferShaderPath(const QString &path)
void setCustomColor7(const QColor &color)
QVector4D customParams7() const
Definition ShaderEffect.h:431
QVector4D customParams4() const
Definition ShaderEffect.h:416
void setBufferFilters(const QStringList &filters)
QPointF iMouse() const
Definition ShaderEffect.h:235
void setCustomColor2(const QColor &color)
void setBufferFeedback(bool enable)
void setCustomColor11(const QColor &color)
QColor customColor15() const
Definition ShaderEffect.h:514
void setCustomColor10(const QColor &color)
void statusChanged()
Emitted when status() transitions.
qreal bufferScale() const
Definition ShaderEffect.h:369
bool isReversed() const
Definition ShaderEffect.h:219
void shaderParamsChanged()
QUrl shaderSource() const
Definition ShaderEffect.h:243
QColor customColor1() const
Definition ShaderEffect.h:444
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:581
void shaderSourceChanged()
void setCustomColorAt(int index, const QColor &color)
Write a customColor slot by index.
QColor customColor16() const
Definition ShaderEffect.h:519
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:249
void setCustomParams2(const QVector4D ¶ms)
void setCustomColor9(const QColor &color)
void paramPreambleChanged()
QColor customColor13() const
Definition ShaderEffect.h:504
QVector4D customParams3() const
Definition ShaderEffect.h:411
void setCustomParams7(const QVector4D ¶ms)
QVector4D customParams1() const
Definition ShaderEffect.h:401
void setCustomColor4(const QColor &color)
QColor customColor14() const
Definition ShaderEffect.h:509
void setParamPreamble(const QString &preamble)
Set the generated named-parameter preamble spliced after #version into the fragment source at load ti...
QColor customColor7() const
Definition ShaderEffect.h:474
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:436
void audioSpectrumChanged()
QStringList bufferFilters() const
Definition ShaderEffect.h:393
void setCustomColor6(const QColor &color)
void setCustomColor13(const QColor &color)
void setCustomParams5(const QVector4D ¶ms)
void componentComplete() override
bool bufferFeedback() const
Definition ShaderEffect.h:363
QString bufferWrap() const
Definition ShaderEffect.h:375
void setCustomParams3(const QVector4D ¶ms)
bool isPlaying() const
Definition ShaderEffect.h:213
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:421
QColor customColor3() const
Definition ShaderEffect.h:454
QString bufferFilter() const
Definition ShaderEffect.h:387
void customParamsChanged()
void customColorsChanged()
Status status() const
Definition ShaderEffect.h:626
QColor customColor2() const
Definition ShaderEffect.h:449
virtual ShaderNodeRhi * createShaderNode()
Factory hook for the render node updatePaintNode() will create.
QStringList bufferWraps() const
Definition ShaderEffect.h:381
void bufferShaderPathChanged()
void setCustomColor8(const QColor &color)
QColor customColor8() const
Definition ShaderEffect.h:479
QVector4D customParams2() const
Definition ShaderEffect.h:406
QColor customColor11() const
Definition ShaderEffect.h:494
Status
Auto-tick mode.
Definition ShaderEffect.h:152
void bufferScaleChanged()
QStringList bufferShaderPaths() const
Definition ShaderEffect.h:357
void setCustomColor5(const QColor &color)
int iFrame() const
Definition ShaderEffect.h:207
QVector4D customParams6() const
Definition ShaderEffect.h:426
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:630
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:229
void setEntryScaffold(const QString &prologue, const QList< PhosphorShaders::EntryCandidate > &candidates)
Install the entry-point scaffold forwarded to the render node: when the fragment source defines no ma...
void bufferFilterChanged()
void setITimeDelta(qreal delta)
QColor customColor5() const
Definition ShaderEffect.h:464
QColor customColor6() const
Definition ShaderEffect.h:469
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:499
void setError(const QString &error)
void setBufferScale(qreal scale)
void setCustomParams1(const QVector4D ¶ms)
QStringList shaderIncludePaths() const
Definition ShaderEffect.h:597
QColor customColor10() const
Definition ShaderEffect.h:489
QString bufferShaderPath() const
Definition ShaderEffect.h:351
void vertexShaderUrlChanged()
void setVertexShaderUrl(const QUrl &source)
qreal iTimeDelta() const
Definition ShaderEffect.h:201
void useDepthBufferChanged()
QQuickItem * sourceItem() const
Live texture-provider source bound to SRB binding 7 (uTexture0).
Definition ShaderEffect.h:343
void bufferFeedbackChanged()
void useWallpaperChanged()
QColor customColor9() const
Definition ShaderEffect.h:484
bool consumeShaderDirty()
Atomically read-and-clear the shader-dirty flag.
Definition ShaderEffect.h:702
QSGRenderNode for fullscreen-quad shader rendering via Qt RHI (Vulkan / OpenGL)
Definition ShaderNodeRhi.h:115
Definition ShaderCompiler.h:15
constexpr int kMaxUserTextureSlots
Public mirror of ShaderNodeRhi::kMaxUserTextures (4 user-texture slots at SRB bindings 7....
Definition ShaderEffect.h:43
Definition ShaderEffect.h:30