summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2016-04-03 10:56:44 +0100
committerSean Harmer <sean.harmer@kdab.com>2016-04-10 21:09:33 +0000
commitfd254b66e02b2128127eab52eb070e9928891d50 (patch)
treef95efc429edda8702f19e1af41043636bf2961e2
parent35cfc13c21c7fa8d276178649df14aa1ba7c7a5a (diff)
QColorMask creates creation changes
Change-Id: I1f7673e8494c2dd43a874c101f0d806dfdb3d02c Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r--src/render/renderstates/qcolormask.cpp34
-rw-r--r--src/render/renderstates/qcolormask.h1
-rw-r--r--src/render/renderstates/qcolormask_p.h88
-rw-r--r--src/render/renderstates/renderstates.pri3
4 files changed, 105 insertions, 21 deletions
diff --git a/src/render/renderstates/qcolormask.cpp b/src/render/renderstates/qcolormask.cpp
index 88752f7a0..1086cc372 100644
--- a/src/render/renderstates/qcolormask.cpp
+++ b/src/render/renderstates/qcolormask.cpp
@@ -38,31 +38,13 @@
****************************************************************************/
#include "qcolormask.h"
-#include <Qt3DRender/private/qrenderstate_p.h>
+#include "qcolormask_p.h"
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QColorMaskPrivate : public QRenderStatePrivate
-{
-public:
- QColorMaskPrivate()
- : QRenderStatePrivate(QRenderStatePrivate::ColorMask)
- , m_redMasked(true)
- , m_greenMasked(true)
- , m_blueMasked(true)
- , m_alphaMasked(true)
- {}
-
- bool m_redMasked;
- bool m_greenMasked;
- bool m_blueMasked;
- bool m_alphaMasked;
-
- Q_DECLARE_PUBLIC(QColorMask)
-};
-
/*!
\class Qt3DRender::QColorMask
\inmodule Qt3DRender
@@ -176,6 +158,18 @@ void QColorMask::copy(const QNode *ref)
d_func()->m_alphaMasked = refState->d_func()->m_alphaMasked;
}
+Qt3DCore::QNodeCreatedChangeBasePtr QColorMask::createNodeCreationChange() const
+{
+ auto creationChange = QRenderStateCreatedChangePtr<QColorMaskData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QColorMask);
+ data.redMasked = d->m_redMasked;
+ data.greenMasked = d->m_greenMasked;
+ data.blueMasked = d->m_blueMasked;
+ data.alphaMasked = d->m_alphaMasked;
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/renderstates/qcolormask.h b/src/render/renderstates/qcolormask.h
index e0a66b033..b7519aac9 100644
--- a/src/render/renderstates/qcolormask.h
+++ b/src/render/renderstates/qcolormask.h
@@ -83,6 +83,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QColorMask)
QT3D_CLONEABLE(QColorMask)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qcolormask_p.h b/src/render/renderstates/qcolormask_p.h
new file mode 100644
index 000000000..4459ec526
--- /dev/null
+++ b/src/render/renderstates/qcolormask_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** 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_QCOLORMASK_P_H
+#define QT3DRENDER_QCOLORMASK_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>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QColorMaskPrivate : public QRenderStatePrivate
+{
+public:
+ QColorMaskPrivate()
+ : QRenderStatePrivate(QRenderStatePrivate::ColorMask)
+ , m_redMasked(true)
+ , m_greenMasked(true)
+ , m_blueMasked(true)
+ , m_alphaMasked(true)
+ {}
+
+ bool m_redMasked;
+ bool m_greenMasked;
+ bool m_blueMasked;
+ bool m_alphaMasked;
+
+ Q_DECLARE_PUBLIC(QColorMask)
+};
+
+struct QColorMaskData
+{
+ bool redMasked;
+ bool greenMasked;
+ bool blueMasked;
+ bool alphaMasked;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QCOLORMASK_P_H
diff --git a/src/render/renderstates/renderstates.pri b/src/render/renderstates/renderstates.pri
index bd3a6819f..fb27eeede 100644
--- a/src/render/renderstates/renderstates.pri
+++ b/src/render/renderstates/renderstates.pri
@@ -31,7 +31,8 @@ HEADERS += \
$$PWD/qalphatest_p.h \
$$PWD/qblendequation_p.h \
$$PWD/qblendequationarguments_p.h \
- $$PWD/qclipplane_p.h
+ $$PWD/qclipplane_p.h \
+ $$PWD/qcolormask_p.h
SOURCES += \