summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2016-04-03 10:00:28 +0100
committerSean Harmer <sean.harmer@kdab.com>2016-04-10 21:09:28 +0000
commitdc8b69bb2ff262709e66254acd4993b103b5b8b2 (patch)
treeb516f1d2cfb16e08c32f137bb3bc40476165ec29
parentd55304bdbfb9997f988342870d48cfc2469d595b (diff)
QBlendEquationArguments creates creation changes
We should change the QBlendEquationSeparate class so that it does not inherit from this one. That would then allow us to simplify this class to not contain the alpha arguments. Alternatively, we could investigate folding the separate args version into this by introducing a NotSet value that we default the alpha arguments to. If they are NotSet then we use the non-separate blending functions on the backend. If they are set then we use the separate Rgb + Alpha blending functionality. Change-Id: I14993b338228d120c6309536b0a286bed9ed870c Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r--src/render/renderstates/qblendequationarguments.cpp40
-rw-r--r--src/render/renderstates/qblendequationarguments.h1
-rw-r--r--src/render/renderstates/qblendequationarguments_p.h93
-rw-r--r--src/render/renderstates/renderstates.pri3
4 files changed, 111 insertions, 26 deletions
diff --git a/src/render/renderstates/qblendequationarguments.cpp b/src/render/renderstates/qblendequationarguments.cpp
index 02137931b..4d0751a0e 100644
--- a/src/render/renderstates/qblendequationarguments.cpp
+++ b/src/render/renderstates/qblendequationarguments.cpp
@@ -39,36 +39,13 @@
****************************************************************************/
#include "qblendequationarguments.h"
-#include "qrenderstate_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
-#include <private/qnode_p.h>
+#include "qblendequationarguments_p.h"
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QBlendEquationArgumentsPrivate : public QRenderStatePrivate
-{
-public:
- QBlendEquationArgumentsPrivate(QRenderStatePrivate::Type type = QRenderStatePrivate::BlendEquationArguments)
- : QRenderStatePrivate(type)
- , m_sourceRgb(QBlendEquationArguments::Zero)
- , m_sourceAlpha(QBlendEquationArguments::Zero)
- , m_destinationRgb(QBlendEquationArguments::Zero)
- , m_destinationAlpha(QBlendEquationArguments::Zero)
- , m_bufferIndex(-1)
- {
- }
-
- Q_DECLARE_PUBLIC(QBlendEquationArguments)
-
- QBlendEquationArguments::Blending m_sourceRgb;
- QBlendEquationArguments::Blending m_sourceAlpha;
- QBlendEquationArguments::Blending m_destinationRgb;
- QBlendEquationArguments::Blending m_destinationAlpha;
- int m_bufferIndex;
-};
-
/*!
\class Qt3DRender::QBlendEquationArguments
\inmodule Qt3DRender
@@ -306,6 +283,19 @@ void QBlendEquationArguments::setBufferIndex(int bufferIndex)
}
}
+Qt3DCore::QNodeCreatedChangeBasePtr QBlendEquationArguments::createNodeCreationChange() const
+{
+ auto creationChange = QRenderStateCreatedChangePtr<QBlendEquationArgumentsData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QBlendEquationArguments);
+ data.sourceRgb = d->m_sourceRgb;
+ data.sourceAlpha = d->m_sourceAlpha;
+ data.destinationRgb = d->m_destinationRgb;
+ data.destinationAlpha = d->m_destinationAlpha;
+ data.bufferIndex = d->m_bufferIndex;
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/renderstates/qblendequationarguments.h b/src/render/renderstates/qblendequationarguments.h
index 9843d23a0..bf0e9ff7d 100644
--- a/src/render/renderstates/qblendequationarguments.h
+++ b/src/render/renderstates/qblendequationarguments.h
@@ -119,6 +119,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QBlendEquationArguments)
QT3D_CLONEABLE(QBlendEquationArguments)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qblendequationarguments_p.h b/src/render/renderstates/qblendequationarguments_p.h
new file mode 100644
index 000000000..f8bd1941a
--- /dev/null
+++ b/src/render/renderstates/qblendequationarguments_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QBLENDEQUATIONARGUMENTS_P_H
+#define QT3DRENDER_QBLENDEQUATIONARGUMENTS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qrenderstate_p.h>
+#include <Qt3DRender/qblendequationarguments.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QBlendEquationArgumentsPrivate : public QRenderStatePrivate
+{
+public:
+ QBlendEquationArgumentsPrivate(QRenderStatePrivate::Type type = QRenderStatePrivate::BlendEquationArguments)
+ : QRenderStatePrivate(type)
+ , m_sourceRgb(QBlendEquationArguments::Zero)
+ , m_sourceAlpha(QBlendEquationArguments::Zero)
+ , m_destinationRgb(QBlendEquationArguments::Zero)
+ , m_destinationAlpha(QBlendEquationArguments::Zero)
+ , m_bufferIndex(-1)
+ {
+ }
+
+ Q_DECLARE_PUBLIC(QBlendEquationArguments)
+
+ QBlendEquationArguments::Blending m_sourceRgb;
+ QBlendEquationArguments::Blending m_sourceAlpha;
+ QBlendEquationArguments::Blending m_destinationRgb;
+ QBlendEquationArguments::Blending m_destinationAlpha;
+ int m_bufferIndex;
+};
+
+struct QBlendEquationArgumentsData
+{
+ QBlendEquationArguments::Blending sourceRgb;
+ QBlendEquationArguments::Blending sourceAlpha;
+ QBlendEquationArguments::Blending destinationRgb;
+ QBlendEquationArguments::Blending destinationAlpha;
+ int bufferIndex;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QBLENDEQUATIONARGUMENTS_P_H
diff --git a/src/render/renderstates/renderstates.pri b/src/render/renderstates/renderstates.pri
index 85ef8207d..5bea8203c 100644
--- a/src/render/renderstates/renderstates.pri
+++ b/src/render/renderstates/renderstates.pri
@@ -29,7 +29,8 @@ HEADERS += \
$$PWD/qdepthtest.h \
$$PWD/qnodepthmask.h \
$$PWD/qalphatest_p.h \
- $$PWD/qblendequation_p.h
+ $$PWD/qblendequation_p.h \
+ $$PWD/qblendequationarguments_p.h
SOURCES += \