summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@theqtcompany.com>2015-11-03 18:21:58 +0100
committerAndy Nichols <andy.nichols@theqtcompany.com>2015-11-04 16:03:09 +0000
commit03d2259029cafe89c87d49c142131bd16d837c69 (patch)
treebdd7a21bbab058bb496a56a5528d5a6cc4abc56a /src/plugins
parent6806287f41efdaacb1efb006c3cec0a760f64b68 (diff)
Create proper plugin infrastructure for sceneloaders
Now Qt3D sceneloaders plugins follow the same pattern as the rest of Qt. This also makes the loading much more standard and less error prone. Change-Id: Ibb5aae0a16d9d197a9c34fe2885dd5435e68d7eb Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/sceneparsers/assimp/assimp.json3
-rw-r--r--src/plugins/sceneparsers/assimp/assimp.pri9
-rw-r--r--src/plugins/sceneparsers/assimp/assimp.pro16
-rw-r--r--src/plugins/sceneparsers/assimp/assimphelpers.cpp2
-rw-r--r--src/plugins/sceneparsers/assimp/assimphelpers.h (renamed from src/plugins/sceneparsers/assimp/assimphelpers_p.h)0
-rw-r--r--src/plugins/sceneparsers/assimp/assimpparser.cpp4
-rw-r--r--src/plugins/sceneparsers/assimp/assimpparser.h (renamed from src/plugins/sceneparsers/assimp/assimpparser_p.h)7
-rw-r--r--src/plugins/sceneparsers/assimp/main.cpp58
-rw-r--r--src/plugins/sceneparsers/gltf/gltf.json3
-rw-r--r--src/plugins/sceneparsers/gltf/gltf.pro8
-rw-r--r--src/plugins/sceneparsers/gltf/gltfparser.cpp4
-rw-r--r--src/plugins/sceneparsers/gltf/gltfparser.h (renamed from src/plugins/sceneparsers/gltf/gltfparser_p.h)6
-rw-r--r--src/plugins/sceneparsers/gltf/main.cpp59
13 files changed, 152 insertions, 27 deletions
diff --git a/src/plugins/sceneparsers/assimp/assimp.json b/src/plugins/sceneparsers/assimp/assimp.json
new file mode 100644
index 000000000..77d26508f
--- /dev/null
+++ b/src/plugins/sceneparsers/assimp/assimp.json
@@ -0,0 +1,3 @@
+{
+ "Keys": ["assimp"]
+}
diff --git a/src/plugins/sceneparsers/assimp/assimp.pri b/src/plugins/sceneparsers/assimp/assimp.pri
deleted file mode 100644
index 89074c9d3..000000000
--- a/src/plugins/sceneparsers/assimp/assimp.pri
+++ /dev/null
@@ -1,9 +0,0 @@
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/assimpparser_p.h \
- $$PWD/assimphelpers_p.h
-
-SOURCES += \
- $$PWD/assimpparser.cpp \
- $$PWD/assimphelpers.cpp
diff --git a/src/plugins/sceneparsers/assimp/assimp.pro b/src/plugins/sceneparsers/assimp/assimp.pro
index a7607cb73..215941071 100644
--- a/src/plugins/sceneparsers/assimp/assimp.pro
+++ b/src/plugins/sceneparsers/assimp/assimp.pro
@@ -2,11 +2,9 @@ TARGET = assimpsceneparser
QT += core-private 3dcore 3dcore-private 3drender 3drender-private
PLUGIN_TYPE = sceneparsers
-PLUGIN_CLASS_NAME = AssimpParser
+PLUGIN_CLASS_NAME = AssimpParserPlugin
load(qt_plugin)
-include(assimp.pri)
-
config_assimp {
LIBS += -lassimp
@@ -17,3 +15,15 @@ config_assimp {
} else {
include(../../../3rdparty/assimp/assimp.pri)
}
+
+HEADERS += \
+ assimphelpers.h \
+ assimpparser.h
+
+SOURCES += \
+ assimpparser.cpp \
+ assimphelpers.cpp \
+ main.cpp
+
+DISTFILES += \
+ assimp.json
diff --git a/src/plugins/sceneparsers/assimp/assimphelpers.cpp b/src/plugins/sceneparsers/assimp/assimphelpers.cpp
index 7d7c93266..72dd3b5ce 100644
--- a/src/plugins/sceneparsers/assimp/assimphelpers.cpp
+++ b/src/plugins/sceneparsers/assimp/assimphelpers.cpp
@@ -34,7 +34,7 @@
**
****************************************************************************/
-#include "assimphelpers_p.h"
+#include "assimphelpers.h"
#include <QFileDevice>
#include <QFileInfo>
diff --git a/src/plugins/sceneparsers/assimp/assimphelpers_p.h b/src/plugins/sceneparsers/assimp/assimphelpers.h
index 8f7855730..8f7855730 100644
--- a/src/plugins/sceneparsers/assimp/assimphelpers_p.h
+++ b/src/plugins/sceneparsers/assimp/assimphelpers.h
diff --git a/src/plugins/sceneparsers/assimp/assimpparser.cpp b/src/plugins/sceneparsers/assimp/assimpparser.cpp
index ad6b5ccd3..4c98e8c1e 100644
--- a/src/plugins/sceneparsers/assimp/assimpparser.cpp
+++ b/src/plugins/sceneparsers/assimp/assimpparser.cpp
@@ -34,7 +34,7 @@
**
****************************************************************************/
-#include "assimpparser_p.h"
+#include "assimpparser.h"
#include <Qt3DCore/qentity.h>
#include <Qt3DCore/qtransform.h>
@@ -286,7 +286,7 @@ private:
/*!
* Constructor. Initializes a new instance of AssimpParser.
*/
-AssimpParser::AssimpParser() : AbstractSceneParser(),
+AssimpParser::AssimpParser() : QAbstractSceneParser(),
m_sceneParsed(false),
m_scene(Q_NULLPTR)
{
diff --git a/src/plugins/sceneparsers/assimp/assimpparser_p.h b/src/plugins/sceneparsers/assimp/assimpparser.h
index 33bcf1831..f385206bd 100644
--- a/src/plugins/sceneparsers/assimp/assimpparser_p.h
+++ b/src/plugins/sceneparsers/assimp/assimpparser.h
@@ -53,8 +53,8 @@
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include <assimp/DefaultLogger.hpp>
-#include <Qt3DRender/private/abstractsceneparser_p.h>
-#include "assimphelpers_p.h"
+#include <Qt3DRender/qabstractsceneparser.h>
+#include "assimphelpers.h"
#include <QMap>
#include <QDir>
@@ -79,10 +79,9 @@ class QGeometryRenderer;
Q_DECLARE_LOGGING_CATEGORY(AssimpParserLog)
-class AssimpParser : public AbstractSceneParser
+class AssimpParser : public QAbstractSceneParser
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt3DRenderer.AssimParser")
public:
AssimpParser();
diff --git a/src/plugins/sceneparsers/assimp/main.cpp b/src/plugins/sceneparsers/assimp/main.cpp
new file mode 100644
index 000000000..39686a77b
--- /dev/null
+++ b/src/plugins/sceneparsers/assimp/main.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
+** 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 "assimpparser.h"
+
+#include <Qt3DRender/QSceneParserPlugin>
+
+QT_BEGIN_NAMESPACE
+
+class AssimpSceneParserPlugin : public Qt3DRender::QSceneParserPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QSceneParserFactoryInterface_iid FILE "assimp.json")
+
+ Qt3DRender::QAbstractSceneParser *create(const QString &key, const QStringList &paramList) Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(key)
+ Q_UNUSED(paramList)
+ return new Qt3DRender::AssimpParser();
+ }
+};
+
+QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/sceneparsers/gltf/gltf.json b/src/plugins/sceneparsers/gltf/gltf.json
new file mode 100644
index 000000000..a6e1dd470
--- /dev/null
+++ b/src/plugins/sceneparsers/gltf/gltf.json
@@ -0,0 +1,3 @@
+{
+ "Keys": ["gltf"]
+}
diff --git a/src/plugins/sceneparsers/gltf/gltf.pro b/src/plugins/sceneparsers/gltf/gltf.pro
index 100140f97..84f4a173e 100644
--- a/src/plugins/sceneparsers/gltf/gltf.pro
+++ b/src/plugins/sceneparsers/gltf/gltf.pro
@@ -6,7 +6,11 @@ PLUGIN_CLASS_NAME = GLTFParser
load(qt_plugin)
HEADERS += \
- gltfparser_p.h
+ gltfparser.h
SOURCES += \
- gltfparser.cpp
+ gltfparser.cpp \
+ main.cpp
+
+DISTFILES += \
+ gltf.json
diff --git a/src/plugins/sceneparsers/gltf/gltfparser.cpp b/src/plugins/sceneparsers/gltf/gltfparser.cpp
index 07399716f..5c21604bc 100644
--- a/src/plugins/sceneparsers/gltf/gltfparser.cpp
+++ b/src/plugins/sceneparsers/gltf/gltfparser.cpp
@@ -35,7 +35,7 @@
**
****************************************************************************/
-#include "gltfparser_p.h"
+#include "gltfparser.h"
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
@@ -150,7 +150,7 @@ const QString KEY_TECHNIQUE_GL2 = QStringLiteral("techniqueGL2");
} // of anonymous namespace
-GLTFParser::GLTFParser() : AbstractSceneParser(),
+GLTFParser::GLTFParser() : QAbstractSceneParser(),
m_parseDone(false)
{
}
diff --git a/src/plugins/sceneparsers/gltf/gltfparser_p.h b/src/plugins/sceneparsers/gltf/gltfparser.h
index 5ce69ebc5..85fff0040 100644
--- a/src/plugins/sceneparsers/gltf/gltfparser_p.h
+++ b/src/plugins/sceneparsers/gltf/gltfparser.h
@@ -54,8 +54,7 @@
#include <Qt3DRender/qattribute.h>
#include <Qt3DRender/qbuffer.h>
-
-#include <Qt3DRender/private/abstractsceneparser_p.h>
+#include <Qt3DRender/qabstractsceneparser.h>
QT_BEGIN_NAMESPACE
@@ -80,10 +79,9 @@ class QGeometryRenderer;
Q_DECLARE_LOGGING_CATEGORY(GLTFParserLog)
-class GLTFParser : public AbstractSceneParser
+class GLTFParser : public QAbstractSceneParser
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt3DRenderer.GLTFParser")
public:
GLTFParser();
diff --git a/src/plugins/sceneparsers/gltf/main.cpp b/src/plugins/sceneparsers/gltf/main.cpp
new file mode 100644
index 000000000..e680b42f0
--- /dev/null
+++ b/src/plugins/sceneparsers/gltf/main.cpp
@@ -0,0 +1,59 @@
+
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
+** 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 "gltfparser.h"
+
+#include <Qt3DRender/QSceneParserPlugin>
+
+QT_BEGIN_NAMESPACE
+
+class GLTFSceneParserPlugin : public Qt3DRender::QSceneParserPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QSceneParserFactoryInterface_iid FILE "gltf.json")
+
+ Qt3DRender::QAbstractSceneParser *create(const QString &key, const QStringList &paramList) Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(key)
+ Q_UNUSED(paramList)
+ return new Qt3DRender::GLTFParser();
+ }
+};
+
+QT_END_NAMESPACE
+
+#include "main.moc"