diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2016-04-03 12:00:43 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2016-04-10 21:09:55 +0000 |
commit | 1c5e9f004ca67201900e7dd2581f3f25bbe74176 (patch) | |
tree | f154b10d206487230ccf43b7c0c9a410f15b6f1b | |
parent | ae6f4d469dba743e34700d5c6696c260f395d70a (diff) |
QStencilTest creates creation changes
Change-Id: I19965c493c0eac74c9f86a74075c113ba499d34e
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r-- | src/render/renderstates/qstenciltest.cpp | 36 | ||||
-rw-r--r-- | src/render/renderstates/qstenciltest.h | 1 | ||||
-rw-r--r-- | src/render/renderstates/qstenciltest_p.h | 85 | ||||
-rw-r--r-- | src/render/renderstates/qstenciltestarguments.cpp | 22 | ||||
-rw-r--r-- | src/render/renderstates/qstenciltestarguments_p.h | 89 | ||||
-rw-r--r-- | src/render/renderstates/renderstates.pri | 4 |
6 files changed, 196 insertions, 41 deletions
diff --git a/src/render/renderstates/qstenciltest.cpp b/src/render/renderstates/qstenciltest.cpp index 3b08602cb..233389cb0 100644 --- a/src/render/renderstates/qstenciltest.cpp +++ b/src/render/renderstates/qstenciltest.cpp @@ -39,31 +39,14 @@ ****************************************************************************/ #include "qstenciltest.h" -#include "qrenderstate_p.h" -#include <private/qnode_p.h> -#include <Qt3DCore/qscenepropertychange.h> +#include "qstenciltest_p.h" #include "qstenciltestarguments.h" - +#include <Qt3DRender/private/qrenderstatecreatedchange_p.h> QT_BEGIN_NAMESPACE namespace Qt3DRender { -class QStencilTestPrivate : public QRenderStatePrivate -{ -public: - QStencilTestPrivate() - : QRenderStatePrivate(QRenderStatePrivate::StencilTest) - , m_front(new QStencilTestArguments(QStencilTestArguments::Front)) - , m_back(new QStencilTestArguments(QStencilTestArguments::Back)) - { - } - - Q_DECLARE_PUBLIC(QStencilTest) - QStencilTestArguments *m_front; - QStencilTestArguments *m_back; -}; - QStencilTest::QStencilTest(QNode *parent) : QRenderState(*new QStencilTestPrivate, parent) { @@ -98,6 +81,21 @@ void QStencilTest::copy(const QNode *ref) d_func()->m_back->setStencilFunction(refState->d_func()->m_back->stencilFunction()); } +Qt3DCore::QNodeCreatedChangeBasePtr QStencilTest::createNodeCreationChange() const +{ + auto creationChange = QRenderStateCreatedChangePtr<QStencilTestData>::create(this); + auto &data = creationChange->data; + Q_D(const QStencilTest); + data.front.face = d->m_front->faceMode(); + data.front.comparisonMask = d->m_front->comparisonMask(); + data.front.referenceValue = d->m_front->referenceValue(); + data.front.stencilFunction = d->m_front->stencilFunction(); + data.back.face = d->m_back->faceMode(); + data.back.comparisonMask = d->m_back->comparisonMask(); + data.back.referenceValue = d->m_back->referenceValue(); + data.back.stencilFunction = d->m_back->stencilFunction(); + return creationChange; +} } // namespace Qt3DRender diff --git a/src/render/renderstates/qstenciltest.h b/src/render/renderstates/qstenciltest.h index a09d780e3..ad644dd9a 100644 --- a/src/render/renderstates/qstenciltest.h +++ b/src/render/renderstates/qstenciltest.h @@ -69,6 +69,7 @@ protected: private: Q_DECLARE_PRIVATE(QStencilTest) QT3D_CLONEABLE(QStencilTest) + Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qstenciltest_p.h b/src/render/renderstates/qstenciltest_p.h new file mode 100644 index 000000000..16fe85682 --- /dev/null +++ b/src/render/renderstates/qstenciltest_p.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** 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_QSTENCILTEST_P_H +#define QT3DRENDER_QSTENCILTEST_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/qstenciltest.h> +#include <Qt3DRender/qstenciltestarguments.h> +#include <Qt3DRender/private/qstenciltestarguments_p.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3DRender { + +class QStencilTestPrivate : public QRenderStatePrivate +{ +public: + QStencilTestPrivate() + : QRenderStatePrivate(QRenderStatePrivate::StencilTest) + , m_front(new QStencilTestArguments(QStencilTestArguments::Front)) + , m_back(new QStencilTestArguments(QStencilTestArguments::Back)) + { + } + + Q_DECLARE_PUBLIC(QStencilTest) + QStencilTestArguments *m_front; + QStencilTestArguments *m_back; +}; + +struct QStencilTestData +{ + QStencilTestArgumentsData front; + QStencilTestArgumentsData back; +}; + +} // namespace Qt3DRender + +QT_END_NAMESPACE + +#endif // QT3DRENDER_QSTENCILTEST_P_H diff --git a/src/render/renderstates/qstenciltestarguments.cpp b/src/render/renderstates/qstenciltestarguments.cpp index 3673a7840..28affeeb8 100644 --- a/src/render/renderstates/qstenciltestarguments.cpp +++ b/src/render/renderstates/qstenciltestarguments.cpp @@ -38,32 +38,12 @@ ****************************************************************************/ #include "qstenciltestarguments.h" -#include <private/qobject_p.h> +#include "qstenciltestarguments_p.h" QT_BEGIN_NAMESPACE namespace Qt3DRender { -class QStencilTestArgumentsPrivate : public QObjectPrivate -{ -public: - QStencilTestArgumentsPrivate(QStencilTestArguments::StencilFaceMode face) - : QObjectPrivate() - , m_face(face) - , m_comparisonMask(0) - , m_referenceValue(0) - , m_stencilFunction(QStencilTestArguments::Never) - { - } - - Q_DECLARE_PUBLIC(QStencilTestArguments) - QStencilTestArguments::StencilFaceMode m_face; - uint m_comparisonMask; - int m_referenceValue; - QStencilTestArguments::StencilFunction m_stencilFunction; -}; - - QStencilTestArguments::QStencilTestArguments(QStencilTestArguments::StencilFaceMode face, QObject *parent) : QObject(*new QStencilTestArgumentsPrivate(face), parent) { diff --git a/src/render/renderstates/qstenciltestarguments_p.h b/src/render/renderstates/qstenciltestarguments_p.h new file mode 100644 index 000000000..06a5bb91a --- /dev/null +++ b/src/render/renderstates/qstenciltestarguments_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_QSTENCILTESTARGUMENTS_P_H +#define QT3DRENDER_QSTENCILTESTARGUMENTS_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/qstenciltestarguments.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3DRender { + +class QStencilTestArgumentsPrivate : public QObjectPrivate +{ +public: + QStencilTestArgumentsPrivate(QStencilTestArguments::StencilFaceMode face) + : QObjectPrivate() + , m_face(face) + , m_comparisonMask(0) + , m_referenceValue(0) + , m_stencilFunction(QStencilTestArguments::Never) + { + } + + Q_DECLARE_PUBLIC(QStencilTestArguments) + QStencilTestArguments::StencilFaceMode m_face; + uint m_comparisonMask; + int m_referenceValue; + QStencilTestArguments::StencilFunction m_stencilFunction; +}; + +struct QStencilTestArgumentsData +{ + QStencilTestArguments::StencilFaceMode face; + uint comparisonMask; + int referenceValue; + QStencilTestArguments::StencilFunction stencilFunction; +}; + +} // namespace Qt3DRender + +QT_END_NAMESPACE + +#endif // QT3DRENDER_QSTENCILTESTARGUMENTS_P_H diff --git a/src/render/renderstates/renderstates.pri b/src/render/renderstates/renderstates.pri index 08effea85..d88174d05 100644 --- a/src/render/renderstates/renderstates.pri +++ b/src/render/renderstates/renderstates.pri @@ -41,7 +41,9 @@ HEADERS += \ $$PWD/qscissortest_p.h \ $$PWD/qstencilmask_p.h \ $$PWD/qstenciloperation_p.h \ - $$PWD/qstenciloperationarguments_p.h + $$PWD/qstenciloperationarguments_p.h \ + $$PWD/qstenciltest_p.h \ + $$PWD/qstenciltestarguments_p.h SOURCES += \ |