Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquick3deffect_p.h
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
6#ifndef QQUICK3DEFFECT_H
7#define QQUICK3DEFFECT_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QtQuick3D/qtquick3dglobal.h>
21#include <QtQuick3D/private/qquick3dobject_p.h>
22#include <QtQuick3D/private/qquick3dtexture_p.h>
23
24#include <QtQuick3DUtils/private/qssgrenderbasetypes_p.h>
25
26#include <QtQuick3DRuntimeRender/private/qssgrendercommands_p.h>
27
28#include <QtCore/qvector.h>
29
30#include <QtQuick3D/private/qquick3dshaderutils_p.h>
31
33
34class Q_QUICK3D_EXPORT QQuick3DEffect : public QQuick3DObject, public QQuick3DPropertyChangedTracker
35{
36 Q_OBJECT
37 Q_PROPERTY(QQmlListProperty<QQuick3DShaderUtilsRenderPass> passes READ passes)
38
39 QML_NAMED_ELEMENT(Effect)
40public:
41 explicit QQuick3DEffect(QQuick3DObject *parent = nullptr);
42
43 QQmlListProperty<QQuick3DShaderUtilsRenderPass> passes();
44
45 // Passes
46 static void qmlAppendPass(QQmlListProperty<QQuick3DShaderUtilsRenderPass> *list,
47 QQuick3DShaderUtilsRenderPass *pass);
48 static QQuick3DShaderUtilsRenderPass *qmlPassAt(QQmlListProperty<QQuick3DShaderUtilsRenderPass> *list,
49 qsizetype index);
50 static qsizetype qmlPassCount(QQmlListProperty<QQuick3DShaderUtilsRenderPass> *list);
51 static void qmlPassClear(QQmlListProperty<QQuick3DShaderUtilsRenderPass> *list);
52
53 void effectChainDirty();
54
55protected:
56 QSSGRenderGraphObject *updateSpatialNode(QSSGRenderGraphObject *node) override;
57 void itemChange(QQuick3DObject::ItemChange , const QQuick3DObject::ItemChangeData &) override;
58 void markTrackedPropertyDirty(QMetaProperty property, DirtyPropertyHint hint) override;
59
60private Q_SLOTS:
61 void onTextureDirty();
62 void onPassDirty();
63 void onShaderResourceDirty();
64
65private:
66 friend class QQuick3DShaderUtilsTextureInput;
67 friend class QQuick3DSceneRenderer;
68
69 enum Dirty {
70 TextureDirty = 0x1,
71 PropertyDirty = 0x2,
72 EffectChainDirty = 0x4
73 };
74
75 void setDynamicTextureMap(QQuick3DShaderUtilsTextureInput *textureMap);
76 void markDirty(QQuick3DEffect::Dirty type);
77
78 quint32 m_dirtyAttributes = 0xffffffff;
79
80 void updateSceneManager(QQuick3DSceneManager *sceneManager);
81
82 QVector<QQuick3DShaderUtilsRenderPass *> m_passes;
83 QSet<QQuick3DShaderUtilsTextureInput *> m_dynamicTextureMaps;
84 // TextureDirty is what makes an Effect regenerate its shaders
85 QQuick3DShaderResourceTracker m_shaderResources { this, [this]() { markDirty(Dirty::TextureDirty); } };
86};
87
88QT_END_NAMESPACE
89
90#endif // QQUICK3DEFFECT_H
Combined button and popup list for selecting options.
static void resetShaderDependentEffectFlags(QSSGRenderEffect *effectNode)
static const char * default_effect_fragment_shader
static const char * default_effect_vertex_shader
static void insertVertexMainArgs(QByteArray &snippet)
static void accumulateEffectFlagsFromShader(QSSGRenderEffect *effectNode, const QSSGCustomShaderMetaData &meta)