diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2016-04-03 11:07:10 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2016-04-10 21:09:38 +0000 |
commit | b4370262e1de54d34dc39cc0cfe8fa1b08f1238a (patch) | |
tree | 89817bc3c186fdf2f29fd33d1271ad45b30de8fc | |
parent | 5964a47d20cfd5164f67e87ad722382bbdcb9731 (diff) |
QDepthTest creates creation changes
Change-Id: I569ced3777ee0963e5471d1a8f623d8cfaaa900e
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r-- | src/render/renderstates/qdepthtest.cpp | 29 | ||||
-rw-r--r-- | src/render/renderstates/qdepthtest.h | 1 | ||||
-rw-r--r-- | src/render/renderstates/qdepthtest_p.h | 80 | ||||
-rw-r--r-- | src/render/renderstates/renderstates.pri | 3 |
4 files changed, 94 insertions, 19 deletions
diff --git a/src/render/renderstates/qdepthtest.cpp b/src/render/renderstates/qdepthtest.cpp index 990aabc85..64a1bff74 100644 --- a/src/render/renderstates/qdepthtest.cpp +++ b/src/render/renderstates/qdepthtest.cpp @@ -39,29 +39,13 @@ ****************************************************************************/ #include "qdepthtest.h" -#include "qrenderstate_p.h" -#include <private/qnode_p.h> -#include <Qt3DCore/qscenepropertychange.h> +#include "qdepthtest_p.h" +#include <Qt3DRender/private/qrenderstatecreatedchange_p.h> QT_BEGIN_NAMESPACE namespace Qt3DRender { -class QDepthTest; - -class QDepthTestPrivate : public QRenderStatePrivate -{ -public : - QDepthTestPrivate() - : QRenderStatePrivate(QRenderStatePrivate::DepthTest) - , m_depthFunction(QDepthTest::Never) - { - } - - Q_DECLARE_PUBLIC(QDepthTest) - QDepthTest::DepthFunction m_depthFunction; -}; - void QDepthTest::copy(const QNode *ref) { QRenderState::copy(ref); @@ -94,6 +78,15 @@ void QDepthTest::setDepthFunction(QDepthTest::DepthFunction depthFunction) } } +Qt3DCore::QNodeCreatedChangeBasePtr QDepthTest::createNodeCreationChange() const +{ + auto creationChange = QRenderStateCreatedChangePtr<QDepthTestData>::create(this); + auto &data = creationChange->data; + Q_D(const QDepthTest); + data.depthFunction = d->m_depthFunction; + return creationChange; +} + } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qdepthtest.h b/src/render/renderstates/qdepthtest.h index 4a7b25f33..35e4d3ceb 100644 --- a/src/render/renderstates/qdepthtest.h +++ b/src/render/renderstates/qdepthtest.h @@ -84,6 +84,7 @@ protected: private: Q_DECLARE_PRIVATE(QDepthTest) QT3D_CLONEABLE(QDepthTest) + Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qdepthtest_p.h b/src/render/renderstates/qdepthtest_p.h new file mode 100644 index 000000000..c12e6b351 --- /dev/null +++ b/src/render/renderstates/qdepthtest_p.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** 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_QDEPTHTEST_P_H +#define QT3DRENDER_QDEPTHTEST_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/qdepthtest.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3DRender { + +class QDepthTestPrivate : public QRenderStatePrivate +{ +public : + QDepthTestPrivate() + : QRenderStatePrivate(QRenderStatePrivate::DepthTest) + , m_depthFunction(QDepthTest::Never) + { + } + + Q_DECLARE_PUBLIC(QDepthTest) + QDepthTest::DepthFunction m_depthFunction; +}; + +struct QDepthTestData +{ + QDepthTest::DepthFunction depthFunction; +}; + +} // namespace Qt3DRender + +QT_END_NAMESPACE + +#endif // QT3DRENDER_QDEPTHTEST_P_H diff --git a/src/render/renderstates/renderstates.pri b/src/render/renderstates/renderstates.pri index fc482f3a3..0dfad0c5b 100644 --- a/src/render/renderstates/renderstates.pri +++ b/src/render/renderstates/renderstates.pri @@ -33,7 +33,8 @@ HEADERS += \ $$PWD/qblendequationarguments_p.h \ $$PWD/qclipplane_p.h \ $$PWD/qcolormask_p.h \ - $$PWD/qcullface_p.h + $$PWD/qcullface_p.h \ + $$PWD/qdepthtest_p.h SOURCES += \ |