2023-08-16 11:35:10 +03:00
|
|
|
// Copyright (C) 2023 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2024-01-26 14:55:50 +02:00
|
|
|
#include "effectcomposeruniformsmodel.h"
|
2023-08-21 11:52:11 +03:00
|
|
|
|
2023-11-14 14:49:42 +02:00
|
|
|
#include <QJsonObject>
|
2023-08-16 11:35:10 +03:00
|
|
|
#include <QObject>
|
|
|
|
|
|
2024-01-26 14:55:50 +02:00
|
|
|
namespace EffectComposer {
|
2023-08-16 11:35:10 +03:00
|
|
|
|
|
|
|
|
class CompositionNode : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
2023-08-17 15:59:46 +03:00
|
|
|
Q_PROPERTY(QString nodeName MEMBER m_name CONSTANT)
|
2023-12-07 18:32:55 +02:00
|
|
|
Q_PROPERTY(bool nodeEnabled READ isEnabled WRITE setIsEnabled NOTIFY isEnabledChanged)
|
|
|
|
|
Q_PROPERTY(bool isDependency READ isDependency NOTIFY isDepencyChanged)
|
2023-08-21 11:52:11 +03:00
|
|
|
Q_PROPERTY(QObject *nodeUniformsModel READ uniformsModel NOTIFY uniformsModelChanged)
|
2023-08-17 15:59:46 +03:00
|
|
|
|
2023-08-16 11:35:10 +03:00
|
|
|
public:
|
2023-09-01 16:43:56 +03:00
|
|
|
enum NodeType {
|
|
|
|
|
SourceNode = 0,
|
|
|
|
|
DestinationNode,
|
|
|
|
|
CustomNode
|
|
|
|
|
};
|
|
|
|
|
|
2023-11-14 14:49:42 +02:00
|
|
|
CompositionNode(const QString &effectName, const QString &qenPath, const QJsonObject &json = {});
|
2023-08-16 11:35:10 +03:00
|
|
|
|
|
|
|
|
QString fragmentCode() const;
|
|
|
|
|
QString vertexCode() const;
|
|
|
|
|
QString description() const;
|
2023-12-07 18:32:55 +02:00
|
|
|
QString id() const;
|
2023-08-16 11:35:10 +03:00
|
|
|
|
2023-08-21 11:52:11 +03:00
|
|
|
QObject *uniformsModel();
|
|
|
|
|
|
2023-08-28 13:30:36 +03:00
|
|
|
QStringList requiredNodes() const;
|
|
|
|
|
|
2023-09-01 16:43:56 +03:00
|
|
|
NodeType type() const;
|
|
|
|
|
|
|
|
|
|
bool isEnabled() const;
|
|
|
|
|
void setIsEnabled(bool newIsEnabled);
|
|
|
|
|
|
2023-12-07 18:32:55 +02:00
|
|
|
bool isDependency() const;
|
|
|
|
|
|
2023-11-08 16:12:35 +02:00
|
|
|
QString name() const;
|
|
|
|
|
|
|
|
|
|
QList<Uniform *> uniforms() const;
|
|
|
|
|
|
2023-12-07 18:32:55 +02:00
|
|
|
int incRefCount();
|
|
|
|
|
int decRefCount();
|
|
|
|
|
void setRefCount(int count);
|
|
|
|
|
|
2024-03-21 15:14:57 +02:00
|
|
|
int extraMargin() const { return m_extraMargin; }
|
|
|
|
|
|
2023-08-21 11:52:11 +03:00
|
|
|
signals:
|
|
|
|
|
void uniformsModelChanged();
|
2023-09-06 15:18:02 +03:00
|
|
|
void isEnabledChanged();
|
2023-12-07 18:32:55 +02:00
|
|
|
void isDepencyChanged();
|
2024-02-02 13:08:01 +02:00
|
|
|
void rebakeRequested();
|
2023-08-21 11:52:11 +03:00
|
|
|
|
2023-08-16 11:35:10 +03:00
|
|
|
private:
|
2023-11-14 14:49:42 +02:00
|
|
|
void parse(const QString &effectName, const QString &qenPath, const QJsonObject &json);
|
2023-08-16 11:35:10 +03:00
|
|
|
|
|
|
|
|
QString m_name;
|
2023-09-01 16:43:56 +03:00
|
|
|
NodeType m_type = CustomNode;
|
2023-08-16 11:35:10 +03:00
|
|
|
QString m_fragmentCode;
|
|
|
|
|
QString m_vertexCode;
|
|
|
|
|
QString m_description;
|
2023-08-28 13:30:36 +03:00
|
|
|
QStringList m_requiredNodes;
|
2023-12-07 18:32:55 +02:00
|
|
|
QString m_id;
|
2023-09-06 15:18:02 +03:00
|
|
|
bool m_isEnabled = true;
|
2023-12-07 18:32:55 +02:00
|
|
|
int m_refCount = 0;
|
2024-03-21 15:14:57 +02:00
|
|
|
int m_extraMargin = 0;
|
2023-08-21 11:52:11 +03:00
|
|
|
|
2024-01-26 14:55:50 +02:00
|
|
|
QList<Uniform *> m_uniforms;
|
2023-11-08 16:12:35 +02:00
|
|
|
|
2024-01-26 14:55:50 +02:00
|
|
|
EffectComposerUniformsModel m_unifomrsModel;
|
2023-08-16 11:35:10 +03:00
|
|
|
};
|
|
|
|
|
|
2024-01-26 14:55:50 +02:00
|
|
|
} // namespace EffectComposer
|