summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2016-04-07 17:40:55 +0100
committerSean Harmer <sean.harmer@kdab.com>2016-04-11 08:00:08 +0000
commitf9ddd0a0a8f590f16ac9d9122bddd2a33c72b14c (patch)
tree66db07a9bc3d6498d96df4f7cf2d37c218d01f64
parent1c5e9f004ca67201900e7dd2581f3f25bbe74176 (diff)
Move RenderStateNode into its own files
The genericstate_p.h has gotten a little large and contains several classes. Change-Id: I76126a300afaa4dda4686fb231dd9d8c9cc68fab Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r--src/render/backend/managers_p.h2
-rw-r--r--src/render/renderstates/genericstate_p.h21
-rw-r--r--src/render/renderstates/renderstatecollection_p.h2
-rw-r--r--src/render/renderstates/renderstatenode.cpp91
-rw-r--r--src/render/renderstates/renderstatenode_p.h83
-rw-r--r--src/render/renderstates/renderstates.cpp42
-rw-r--r--src/render/renderstates/renderstates.pri6
7 files changed, 180 insertions, 67 deletions
diff --git a/src/render/backend/managers_p.h b/src/render/backend/managers_p.h
index f04a1aaa9..e2294fb1b 100644
--- a/src/render/backend/managers_p.h
+++ b/src/render/backend/managers_p.h
@@ -66,7 +66,7 @@
#include <Qt3DRender/private/transform_p.h>
#include <Qt3DRender/private/rendertarget_p.h>
#include <Qt3DRender/private/renderpass_p.h>
-#include <Qt3DRender/private/genericstate_p.h>
+#include <Qt3DRender/private/renderstatenode_p.h>
#include <Qt3DRender/private/parameter_p.h>
#include <Qt3DRender/private/shaderdata_p.h>
#include <Qt3DRender/private/handle_types_p.h>
diff --git a/src/render/renderstates/genericstate_p.h b/src/render/renderstates/genericstate_p.h
index 82c127553..547e51ccb 100644
--- a/src/render/renderstates/genericstate_p.h
+++ b/src/render/renderstates/genericstate_p.h
@@ -123,27 +123,6 @@ public:
virtual void updateProperty(const char *name, const QVariant &value);
};
-/**
- * @brief Backend Render State Node
- */
-class Q_AUTOTEST_EXPORT RenderStateNode : public BackendNode
-{
-public:
- RenderStateNode();
- virtual ~RenderStateNode();
-
- virtual void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
- virtual void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
-
- void apply(GraphicsContext* gc) const { m_impl->apply(gc); }
- StateMaskSet mask() const { return m_impl->mask(); }
- RenderStateImpl *impl() const { return m_impl; }
-
-protected:
- void cleanup();
-
- RenderStateImpl *m_impl;
-};
template <class State>
State *getOrCreateRenderStateEqualTo(const State &prototype)
diff --git a/src/render/renderstates/renderstatecollection_p.h b/src/render/renderstates/renderstatecollection_p.h
index 060f0011f..c28a6a2b8 100644
--- a/src/render/renderstates/renderstatecollection_p.h
+++ b/src/render/renderstates/renderstatecollection_p.h
@@ -48,7 +48,7 @@
// We mean it.
//
-#include <Qt3DRender/private/genericstate_p.h>
+#include <Qt3DRender/private/renderstatenode_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/render/renderstates/renderstatenode.cpp b/src/render/renderstates/renderstatenode.cpp
new file mode 100644
index 000000000..b04e723c5
--- /dev/null
+++ b/src/render/renderstates/renderstatenode.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** 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 "renderstatenode_p.h"
+#include <Qt3DRender/qrenderstate.h>
+#include <Qt3DCore/qscenepropertychange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Render {
+
+RenderStateNode::RenderStateNode()
+ : BackendNode()
+ , m_impl(NULL)
+{
+}
+
+RenderStateNode::~RenderStateNode()
+{
+ cleanup();
+}
+
+void RenderStateNode::cleanup()
+{
+ if (m_impl != Q_NULLPTR) {
+ if (!m_impl->isPooledImpl())
+ delete m_impl;
+ m_impl = Q_NULLPTR;
+ }
+}
+
+void RenderStateNode::updateFromPeer(Qt3DCore::QNode *peer)
+{
+ cleanup();
+
+ QRenderState *renderState = static_cast<QRenderState *>(peer);
+ m_impl = RenderStateImpl::getOrCreateState(renderState);
+}
+
+void RenderStateNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ if (e->type() == Qt3DCore::NodeUpdated) {
+ Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
+
+ if (m_impl->isPooledImpl()) {
+ m_impl = m_impl->getOrCreateWithPropertyChange(propertyChange->propertyName(), propertyChange->value());
+ } else {
+ m_impl->updateProperty(propertyChange->propertyName(), propertyChange->value());
+ }
+ markDirty(AbstractRenderer::AllDirty);
+ }
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/renderstates/renderstatenode_p.h b/src/render/renderstates/renderstatenode_p.h
new file mode 100644
index 000000000..c9711bc15
--- /dev/null
+++ b/src/render/renderstates/renderstatenode_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_RENDER_RENDERSTATENODE_H
+#define QT3DRENDER_RENDER_RENDERSTATENODE_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/backendnode_p.h>
+#include <Qt3DRender/private/genericstate_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Render {
+
+class Q_AUTOTEST_EXPORT RenderStateNode : public BackendNode
+{
+public:
+ RenderStateNode();
+ virtual ~RenderStateNode();
+
+ virtual void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
+ virtual void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+ void apply(GraphicsContext* gc) const { m_impl->apply(gc); }
+ StateMaskSet mask() const { return m_impl->mask(); }
+ RenderStateImpl *impl() const { return m_impl; }
+
+protected:
+ void cleanup();
+
+ RenderStateImpl *m_impl;
+};
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_RENDERSTATENODE_H
diff --git a/src/render/renderstates/renderstates.cpp b/src/render/renderstates/renderstates.cpp
index c8e1531a7..94e272cdd 100644
--- a/src/render/renderstates/renderstates.cpp
+++ b/src/render/renderstates/renderstates.cpp
@@ -61,48 +61,6 @@ bool RenderStateImpl::isPooledImpl() const Q_DECL_NOEXCEPT
return true;
}
-RenderStateNode::RenderStateNode()
- : BackendNode()
- , m_impl(NULL)
-{
-}
-
-RenderStateNode::~RenderStateNode()
-{
- cleanup();
-}
-
-void RenderStateNode::cleanup()
-{
- if (m_impl != Q_NULLPTR) {
- if (!m_impl->isPooledImpl())
- delete m_impl;
- m_impl = Q_NULLPTR;
- }
-}
-
-void RenderStateNode::updateFromPeer(Qt3DCore::QNode *peer)
-{
- cleanup();
-
- QRenderState *renderState = static_cast<QRenderState *>(peer);
- m_impl = RenderStateImpl::getOrCreateState(renderState);
-}
-
-void RenderStateNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
-{
- if (e->type() == Qt3DCore::NodeUpdated) {
- Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
-
- if (m_impl->isPooledImpl()) {
- m_impl = m_impl->getOrCreateWithPropertyChange(propertyChange->propertyName(), propertyChange->value());
- } else {
- m_impl->updateProperty(propertyChange->propertyName(), propertyChange->value());
- }
- markDirty(AbstractRenderer::AllDirty);
- }
-}
-
void BlendEquationArguments::apply(GraphicsContext* gc) const
{
// Un-indexed BlendEquationArguments -> Use normal GL1.0 functions
diff --git a/src/render/renderstates/renderstates.pri b/src/render/renderstates/renderstates.pri
index d88174d05..818a93cd5 100644
--- a/src/render/renderstates/renderstates.pri
+++ b/src/render/renderstates/renderstates.pri
@@ -43,7 +43,8 @@ HEADERS += \
$$PWD/qstenciloperation_p.h \
$$PWD/qstenciloperationarguments_p.h \
$$PWD/qstenciltest_p.h \
- $$PWD/qstenciltestarguments_p.h
+ $$PWD/qstenciltestarguments_p.h \
+ $$PWD/renderstatenode_p.h
SOURCES += \
@@ -71,4 +72,5 @@ SOURCES += \
$$PWD/renderstatecollection.cpp \
$$PWD/qseamlesscubemap.cpp \
$$PWD/qnodepthmask.cpp \
- $$PWD/qrenderstatecreatedchange.cpp
+ $$PWD/qrenderstatecreatedchange.cpp \
+ $$PWD/renderstatenode.cpp