summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2016-04-03 11:50:36 +0100
committerSean Harmer <sean.harmer@kdab.com>2016-04-10 21:09:52 +0000
commitae6f4d469dba743e34700d5c6696c260f395d70a (patch)
treef8b455270cee4cfd41aa79844dd52a9a3a94cb1a /src
parentc8f44080a34e8a430b2aceb86e6811fbcf85b598 (diff)
QStencilOperation creates creation changes
Change-Id: I4de6a94381e67be0b98e4786d057196e3729b501 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/render/renderstates/qstenciloperation.cpp33
-rw-r--r--src/render/renderstates/qstenciloperation.h1
-rw-r--r--src/render/renderstates/qstenciloperation_p.h83
-rw-r--r--src/render/renderstates/qstenciloperationarguments.cpp21
-rw-r--r--src/render/renderstates/qstenciloperationarguments_p.h89
-rw-r--r--src/render/renderstates/renderstates.pri4
6 files changed, 195 insertions, 36 deletions
diff --git a/src/render/renderstates/qstenciloperation.cpp b/src/render/renderstates/qstenciloperation.cpp
index 81f44dac4..32e134f4a 100644
--- a/src/render/renderstates/qstenciloperation.cpp
+++ b/src/render/renderstates/qstenciloperation.cpp
@@ -38,27 +38,14 @@
****************************************************************************/
#include "qstenciloperation.h"
+#include "qstenciloperation_p.h"
#include "qstenciloperationarguments.h"
-#include <Qt3DRender/private/qrenderstate_p.h>
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QStencilOperationPrivate : public QRenderStatePrivate
-{
-public:
- QStencilOperationPrivate()
- : QRenderStatePrivate(QRenderStatePrivate::StencilOp)
- , m_front(new QStencilOperationArguments(QStencilOperationArguments::Front, q_ptr))
- , m_back(new QStencilOperationArguments(QStencilOperationArguments::Back, q_ptr))
- {}
-
- QStencilOperationArguments *m_front;
- QStencilOperationArguments *m_back;
-};
-
-
QStencilOperation::QStencilOperation(QNode *parent)
: QRenderState(*new QStencilOperationPrivate(), parent)
{
@@ -93,6 +80,22 @@ void QStencilOperation::copy(const QNode *ref)
d_func()->m_front->setAllTestsPassOperation(refState->d_func()->m_front->allTestsPassOperation());
}
+Qt3DCore::QNodeCreatedChangeBasePtr QStencilOperation::createNodeCreationChange() const
+{
+ auto creationChange = QRenderStateCreatedChangePtr<QStencilOperationData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QStencilOperation);
+ data.front.face = d->m_front->faceMode();
+ data.front.stencilTestFailureOperation = d->m_front->stencilTestFailureOperation();
+ data.front.depthTestFailureOperation = d->m_front->depthTestFailureOperation();
+ data.front.allTestsPassOperation = d->m_front->allTestsPassOperation();
+ data.back.face = d->m_back->faceMode();
+ data.back.stencilTestFailureOperation = d->m_back->stencilTestFailureOperation();
+ data.back.depthTestFailureOperation = d->m_back->depthTestFailureOperation();
+ data.back.allTestsPassOperation = d->m_back->allTestsPassOperation();
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/renderstates/qstenciloperation.h b/src/render/renderstates/qstenciloperation.h
index 4f0ff08aa..6af756d0c 100644
--- a/src/render/renderstates/qstenciloperation.h
+++ b/src/render/renderstates/qstenciloperation.h
@@ -68,6 +68,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QStencilOperation)
QT3D_CLONEABLE(QStencilOperation)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qstenciloperation_p.h b/src/render/renderstates/qstenciloperation_p.h
new file mode 100644
index 000000000..cf144e644
--- /dev/null
+++ b/src/render/renderstates/qstenciloperation_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** 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_QSTENCILOPERATION_P_H
+#define QT3DRENDER_QSTENCILOPERATION_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/qstenciloperation.h>
+#include <Qt3DRender/qstenciloperationarguments.h>
+#include <Qt3DRender/private/qstenciloperationarguments_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QStencilOperationPrivate : public QRenderStatePrivate
+{
+public:
+ QStencilOperationPrivate()
+ : QRenderStatePrivate(QRenderStatePrivate::StencilOp)
+ , m_front(new QStencilOperationArguments(QStencilOperationArguments::Front, q_ptr))
+ , m_back(new QStencilOperationArguments(QStencilOperationArguments::Back, q_ptr))
+ {}
+
+ QStencilOperationArguments *m_front;
+ QStencilOperationArguments *m_back;
+};
+
+struct QStencilOperationData
+{
+ QStencilOperationArgumentsData front;
+ QStencilOperationArgumentsData back;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSTENCILOPERATION_P_H
diff --git a/src/render/renderstates/qstenciloperationarguments.cpp b/src/render/renderstates/qstenciloperationarguments.cpp
index 8dee988ce..553dd4ca4 100644
--- a/src/render/renderstates/qstenciloperationarguments.cpp
+++ b/src/render/renderstates/qstenciloperationarguments.cpp
@@ -38,31 +38,12 @@
****************************************************************************/
#include "qstenciloperationarguments.h"
-#include <private/qobject_p.h>
+#include "qstenciloperationarguments_p.h"
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QStencilOperationArgumentsPrivate : public QObjectPrivate
-{
-public:
- QStencilOperationArgumentsPrivate(QStencilOperationArguments::FaceMode mode)
- : QObjectPrivate()
- , m_face(mode)
- , m_stencilTestFailureOperation(QStencilOperationArguments::Keep)
- , m_depthTestFailureOperation(QStencilOperationArguments::Keep)
- , m_allTestsPassOperation(QStencilOperationArguments::Keep)
- {
-
- }
-
- QStencilOperationArguments::FaceMode m_face;
- QStencilOperationArguments::Operation m_stencilTestFailureOperation;
- QStencilOperationArguments::Operation m_depthTestFailureOperation;
- QStencilOperationArguments::Operation m_allTestsPassOperation;
-};
-
QStencilOperationArguments::QStencilOperationArguments(FaceMode mode, QObject *parent)
: QObject(*new QStencilOperationArgumentsPrivate(mode), parent)
{
diff --git a/src/render/renderstates/qstenciloperationarguments_p.h b/src/render/renderstates/qstenciloperationarguments_p.h
new file mode 100644
index 000000000..a0082c60b
--- /dev/null
+++ b/src/render/renderstates/qstenciloperationarguments_p.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** 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_QSTENCILOPERATIONARGUMENTS_P_H
+#define QT3DRENDER_QSTENCILOPERATIONARGUMENTS_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 <QtCore/private/qobject_p.h>
+#include <Qt3DRender/qstenciloperationarguments.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QStencilOperationArgumentsPrivate : public QObjectPrivate
+{
+public:
+ QStencilOperationArgumentsPrivate(QStencilOperationArguments::FaceMode mode)
+ : QObjectPrivate()
+ , m_face(mode)
+ , m_stencilTestFailureOperation(QStencilOperationArguments::Keep)
+ , m_depthTestFailureOperation(QStencilOperationArguments::Keep)
+ , m_allTestsPassOperation(QStencilOperationArguments::Keep)
+ {
+
+ }
+
+ QStencilOperationArguments::FaceMode m_face;
+ QStencilOperationArguments::Operation m_stencilTestFailureOperation;
+ QStencilOperationArguments::Operation m_depthTestFailureOperation;
+ QStencilOperationArguments::Operation m_allTestsPassOperation;
+};
+
+struct QStencilOperationArgumentsData
+{
+ QStencilOperationArguments::FaceMode face;
+ QStencilOperationArguments::Operation stencilTestFailureOperation;
+ QStencilOperationArguments::Operation depthTestFailureOperation;
+ QStencilOperationArguments::Operation allTestsPassOperation;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSTENCILOPERATIONARGUMENTS_P_H
diff --git a/src/render/renderstates/renderstates.pri b/src/render/renderstates/renderstates.pri
index 1742583b4..08effea85 100644
--- a/src/render/renderstates/renderstates.pri
+++ b/src/render/renderstates/renderstates.pri
@@ -39,7 +39,9 @@ HEADERS += \
$$PWD/qpointsize_p.h \
$$PWD/qpolygonoffset_p.h \
$$PWD/qscissortest_p.h \
- $$PWD/qstencilmask_p.h
+ $$PWD/qstencilmask_p.h \
+ $$PWD/qstenciloperation_p.h \
+ $$PWD/qstenciloperationarguments_p.h
SOURCES += \