summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/render/renderstates/qrenderstate.cpp5
-rw-r--r--src/render/renderstates/qrenderstate_p.h1
-rw-r--r--src/render/renderstates/qrenderstatecreatedchange.cpp71
-rw-r--r--src/render/renderstates/qrenderstatecreatedchange_p.h105
-rw-r--r--src/render/renderstates/renderstates.pri4
5 files changed, 185 insertions, 1 deletions
diff --git a/src/render/renderstates/qrenderstate.cpp b/src/render/renderstates/qrenderstate.cpp
index 0de1d405d..9167366ff 100644
--- a/src/render/renderstates/qrenderstate.cpp
+++ b/src/render/renderstates/qrenderstate.cpp
@@ -56,6 +56,11 @@ QRenderStatePrivate *QRenderStatePrivate::get(QRenderState *state)
return state->d_func();
}
+const QRenderStatePrivate *QRenderStatePrivate::get(const QRenderState *state)
+{
+ return state->d_func();
+}
+
QRenderState::~QRenderState()
{
Q_ASSERT_X(Qt3DCore::QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DRender::QRenderState subclass didn't call QNode::cleanup in its destructor");
diff --git a/src/render/renderstates/qrenderstate_p.h b/src/render/renderstates/qrenderstate_p.h
index c3cdd754c..26ff0af65 100644
--- a/src/render/renderstates/qrenderstate_p.h
+++ b/src/render/renderstates/qrenderstate_p.h
@@ -92,6 +92,7 @@ public:
const Type m_type;
static QRenderStatePrivate *get(QRenderState *state);
+ static const QRenderStatePrivate *get(const QRenderState *state);
};
}
diff --git a/src/render/renderstates/qrenderstatecreatedchange.cpp b/src/render/renderstates/qrenderstatecreatedchange.cpp
new file mode 100644
index 000000000..85df30082
--- /dev/null
+++ b/src/render/renderstates/qrenderstatecreatedchange.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include "qrenderstatecreatedchange_p.h"
+#include <Qt3DCore/private/qnodecreatedchange_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QRenderStateCreatedChangeBasePrivate : public Qt3DCore::QNodeCreatedChangeBasePrivate
+{
+public:
+ QRenderStateCreatedChangeBasePrivate(const QRenderState *renderState)
+ : Qt3DCore::QNodeCreatedChangeBasePrivate(renderState)
+ , m_type(QRenderStatePrivate::get(renderState)->m_type)
+ {
+
+ }
+
+ QRenderStatePrivate::Type m_type;
+};
+
+QRenderStateCreatedChangeBase::QRenderStateCreatedChangeBase(const QRenderState *renderState, Priority priority)
+ : QNodeCreatedChangeBase(*new QRenderStateCreatedChangeBasePrivate(renderState))
+{
+ d_func()->m_priority = priority;
+}
+
+QRenderStatePrivate::Type QRenderStateCreatedChangeBase::type() const
+{
+ Q_D(const QRenderStateCreatedChangeBase);
+ return d->m_type;
+}
+
+QT_END_NAMESPACE
+
+} // namespace Qt3DRender
diff --git a/src/render/renderstates/qrenderstatecreatedchange_p.h b/src/render/renderstates/qrenderstatecreatedchange_p.h
new file mode 100644
index 000000000..f0be1448c
--- /dev/null
+++ b/src/render/renderstates/qrenderstatecreatedchange_p.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** 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_QRENDERSTATECREATIONCHANGEBASE_H
+#define QT3DRENDER_QRENDERSTATECREATIONCHANGEBASE_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 <Qt3DCore/qnodecreatedchange.h>
+#include <Qt3DRender/private/qrenderstate_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QRenderState;
+class QRenderStateCreatedChangeBasePrivate;
+
+class QRenderStateCreatedChangeBase : public Qt3DCore::QNodeCreatedChangeBase
+{
+public:
+ explicit QRenderStateCreatedChangeBase(const QRenderState *renderState, Priority priority = QSceneChange::Standard);
+
+ QRenderStatePrivate::Type type() const;
+
+private:
+ Q_DECLARE_PRIVATE(QRenderStateCreatedChangeBase)
+};
+
+typedef QSharedPointer<QRenderStateCreatedChangeBase> QRenderStateCreatedChangeBasePtr;
+
+template<typename T>
+class QRenderStateCreatedChange : public QRenderStateCreatedChangeBase
+{
+public:
+ explicit QRenderStateCreatedChange(const QRenderState *_renderState, Priority _priority = QSceneChange::Standard)
+ : QRenderStateCreatedChangeBase(_renderState, _priority)
+ , data()
+ {
+ }
+
+ T data;
+};
+
+#if defined(Q_COMPILER_TEMPLATE_ALIAS)
+template<typename T>
+using QRenderStateCreatedChangePtr = QSharedPointer<QRenderStateCreatedChange<T>>;
+#else
+template <typename T>
+struct QRenderStateCreatedChangePtr
+{
+ static QSharedPointer<QRenderStateCreatedChange<T> > create(const QRenderState *renderState)
+ {
+ return QSharedPointer<QRenderStateCreatedChange<T> >::create(renderState);
+ }
+};
+#endif
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QRENDERSTATECREATIONCHANGEBASE_H
diff --git a/src/render/renderstates/renderstates.pri b/src/render/renderstates/renderstates.pri
index 58770410e..3b234fb6d 100644
--- a/src/render/renderstates/renderstates.pri
+++ b/src/render/renderstates/renderstates.pri
@@ -20,6 +20,7 @@ HEADERS += \
$$PWD/qstenciloperationarguments.h \
$$PWD/qstenciltest.h \
$$PWD/qstenciltestarguments.h \
+ $$PWD/qrenderstatecreatedchange_p.h \
$$PWD/renderstates_p.h \
$$PWD/renderstateset_p.h \
$$PWD/qpointsize.h \
@@ -53,4 +54,5 @@ SOURCES += \
$$PWD/qpointsize.cpp \
$$PWD/renderstatecollection.cpp \
$$PWD/qseamlesscubemap.cpp \
- $$PWD/qnodepthmask.cpp
+ $$PWD/qnodepthmask.cpp \
+ $$PWD/qrenderstatecreatedchange.cpp