From cb33734c90f32082311916488bdc04423acfeac8 Mon Sep 17 00:00:00 2001 From: Sergey Dubitskiy Date: Wed, 7 Mar 2012 11:27:21 +1000 Subject: Port to new Plugin Loader. AiScene, Bezier and Obj plugins were ported. Task-number: QTBUG-24467 Change-Id: Ic0b31272cd9c13171da10857261eb296f0a0cd77 Reviewed-by: Alex Wilson Reviewed-by: Danny Pope --- src/plugins/sceneformats/assimp/ai_plugin.cpp | 60 +++++++++++++ src/plugins/sceneformats/assimp/ai_plugin.h | 62 +++++++++++++ .../sceneformats/assimp/ai_scene_plugin.json | 53 +++++++++++ src/plugins/sceneformats/assimp/assimp.pro | 17 +++- src/plugins/sceneformats/assimp/main.cpp | 100 --------------------- src/plugins/sceneformats/bezier/bezier.pro | 15 +++- src/plugins/sceneformats/bezier/bezier_plugin.cpp | 60 +++++++++++++ src/plugins/sceneformats/bezier/bezier_plugin.h | 62 +++++++++++++ .../sceneformats/bezier/bezier_scene_plugin.json | 6 ++ src/plugins/sceneformats/bezier/main.cpp | 70 --------------- src/plugins/sceneformats/obj/main.cpp | 78 ---------------- src/plugins/sceneformats/obj/obj.pro | 15 +++- src/plugins/sceneformats/obj/obj_plugin.cpp | 58 ++++++++++++ src/plugins/sceneformats/obj/obj_plugin.h | 62 +++++++++++++ src/plugins/sceneformats/obj/obj_scene_plugin.json | 5 ++ .../sceneformats/obj/qglobjscenehandler.cpp | 1 - src/plugins/sceneformats/obj/qglobjscenehandler.h | 2 +- 17 files changed, 464 insertions(+), 262 deletions(-) create mode 100644 src/plugins/sceneformats/assimp/ai_plugin.cpp create mode 100644 src/plugins/sceneformats/assimp/ai_plugin.h create mode 100644 src/plugins/sceneformats/assimp/ai_scene_plugin.json delete mode 100644 src/plugins/sceneformats/assimp/main.cpp create mode 100644 src/plugins/sceneformats/bezier/bezier_plugin.cpp create mode 100644 src/plugins/sceneformats/bezier/bezier_plugin.h create mode 100644 src/plugins/sceneformats/bezier/bezier_scene_plugin.json delete mode 100644 src/plugins/sceneformats/bezier/main.cpp delete mode 100644 src/plugins/sceneformats/obj/main.cpp create mode 100644 src/plugins/sceneformats/obj/obj_plugin.cpp create mode 100644 src/plugins/sceneformats/obj/obj_plugin.h create mode 100644 src/plugins/sceneformats/obj/obj_scene_plugin.json (limited to 'src/plugins') diff --git a/src/plugins/sceneformats/assimp/ai_plugin.cpp b/src/plugins/sceneformats/assimp/ai_plugin.cpp new file mode 100644 index 000000000..9e1dbd6be --- /dev/null +++ b/src/plugins/sceneformats/assimp/ai_plugin.cpp @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 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 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "ai_plugin.h" +#include "qaiscenehandler.h" + +QT_BEGIN_NAMESPACE + +QAiScenePlugin::QAiScenePlugin() {} +QAiScenePlugin::~QAiScenePlugin() {} + +QGLSceneFormatHandler *QAiScenePlugin::create(QIODevice *device, const QUrl& url, const QString &format) const +{ + Q_UNUSED(device); + Q_UNUSED(url); + Q_UNUSED(format); + return new QAiSceneHandler; +} + +QT_END_NAMESPACE + + diff --git a/src/plugins/sceneformats/assimp/ai_plugin.h b/src/plugins/sceneformats/assimp/ai_plugin.h new file mode 100644 index 000000000..ea0696785 --- /dev/null +++ b/src/plugins/sceneformats/assimp/ai_plugin.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 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 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef AI_PLUGIN_H +#define AI_PLUGIN_H + +#include "qglsceneformatplugin.h" + +QT_BEGIN_NAMESPACE + +class QAiScenePlugin : public QObject, public QGLSceneFormatFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QGLSceneFormatFactoryInterface) + Q_PLUGIN_METADATA(IID "com.trolltech.Qt.QGLSceneFormatFactoryInterface" FILE "ai_scene_plugin.json") +public: + QAiScenePlugin(); + ~QAiScenePlugin(); + virtual QGLSceneFormatHandler *create(QIODevice *device, const QUrl& url, const QString &format) const; +}; + +QT_END_NAMESPACE + +#endif // AI_PLUGIN_H diff --git a/src/plugins/sceneformats/assimp/ai_scene_plugin.json b/src/plugins/sceneformats/assimp/ai_scene_plugin.json new file mode 100644 index 000000000..a0c272e2b --- /dev/null +++ b/src/plugins/sceneformats/assimp/ai_scene_plugin.json @@ -0,0 +1,53 @@ +{ + "Keys": [ + "3d", + "3ds", + "ac", + "ac3d", + "acc", + "ase", + "ask", + "b3d", + "blend", + "bvh", + "cob", + "csm", + "dae", + "dxf", + "enff", + "hmp", + "irr", + "irrmesh", + "lwo", + "lws", + "lxo", + "md2", + "md3", + "md5anim", + "md5camera", + "md5mesh", + "mdc", + "mdl", + "mesh.xml", + "mot", + "ms3d", + "ndo", + "nff", + "obj", + "off", + "pk3", + "ply", + "prj", + "q3o", + "q3s", + "raw", + "scn", + "smd", + "stl", + "ter", + "uc", + "vta", + "x", + "xml" + ] +} diff --git a/src/plugins/sceneformats/assimp/assimp.pro b/src/plugins/sceneformats/assimp/assimp.pro index 39fbb5454..5a0fca51d 100644 --- a/src/plugins/sceneformats/assimp/assimp.pro +++ b/src/plugins/sceneformats/assimp/assimp.pro @@ -1,20 +1,29 @@ TARGET = qsceneai +QT += 3d + +load(qt_plugin) + include(../../qpluginbase.pri) HEADERS += qailoader.h \ qaiscene.h \ qaiscenehandler.h \ qaimesh.h \ ailoaderiostream.h \ - ailoaderiosystem.h -SOURCES += main.cpp \ + ailoaderiosystem.h \ + ai_plugin.h +SOURCES += \ qailoader.cpp \ qaiscene.cpp \ qaiscenehandler.cpp \ qaimesh.cpp \ ailoaderiostream.cpp \ - ailoaderiosystem.cpp + ailoaderiosystem.cpp \ + ai_plugin.cpp + +OTHER_FILES += \ + ai_scene_plugin.json + -QT += 3d DESTDIR = $$QT.3d.plugins/sceneformats target.path = $$[QT_INSTALL_PLUGINS]/sceneformats diff --git a/src/plugins/sceneformats/assimp/main.cpp b/src/plugins/sceneformats/assimp/main.cpp deleted file mode 100644 index e9724a6da..000000000 --- a/src/plugins/sceneformats/assimp/main.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 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 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qglsceneformatplugin.h" -#include "qaiscenehandler.h" - -#include "assimp.hpp" - -#include -#include - -QT_BEGIN_NAMESPACE - -class QAiScenePlugin : public QGLSceneFormatPlugin -{ -public: - QStringList keys() const; - virtual QGLSceneFormatHandler *create(QIODevice *device, const QUrl& url, const QString &format) const; -}; - -QStringList QAiScenePlugin::keys() const -{ - static QMultiMap mimetypes; - if (mimetypes.size() == 0) - { - mimetypes.insertMulti("3ds", "application/x-3ds"); - mimetypes.insertMulti("3ds", "image/x-3ds"); - mimetypes.insertMulti("dae", "model/x3d+binary"); - mimetypes.insertMulti("dxf", "application/x-dxf"); - } - QStringList result; - Assimp::Importer importer; - aiString extns; - importer.GetExtensionList(extns); - QString qextns = QString::fromUtf8(extns.data, extns.length); - QStringList extnList = qextns.split(';'); - for (int i = 0; i < extnList.size(); ++i) - { - QString xt = extnList.at(i); - xt = xt.simplified(); - if (xt.startsWith(QLatin1String("*."))) - xt = xt.mid(2); - result << xt; - QMap::const_iterator it = mimetypes.constFind(xt); - for ( ; it != mimetypes.constEnd(); ++it) - result << it.value(); - } - return result; -} - -QGLSceneFormatHandler *QAiScenePlugin::create(QIODevice *device, const QUrl& url, const QString &format) const -{ - Q_UNUSED(device); - Q_UNUSED(url); - Q_UNUSED(format); - return new QAiSceneHandler; -} - -Q_EXPORT_STATIC_PLUGIN(QAiScenePlugin) -Q_EXPORT_PLUGIN2(qsceneai, QAiScenePlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/sceneformats/bezier/bezier.pro b/src/plugins/sceneformats/bezier/bezier.pro index 911dc60ef..870d6970c 100644 --- a/src/plugins/sceneformats/bezier/bezier.pro +++ b/src/plugins/sceneformats/bezier/bezier.pro @@ -1,13 +1,20 @@ TARGET = qscenebezier +QT += 3d + +load(qt_plugin) + include(../../qpluginbase.pri) HEADERS += qglbezierscene.h \ - qglbezierscenehandler.h -SOURCES += main.cpp \ + qglbezierscenehandler.h \ + bezier_plugin.h +SOURCES += \ qglbezierscene.cpp \ - qglbezierscenehandler.cpp + qglbezierscenehandler.cpp \ + bezier_plugin.cpp -QT += 3d +OTHER_FILES += \ + bezier_scene_plugin.json DESTDIR = $$QT.3d.plugins/sceneformats target.path = $$[QT_INSTALL_PLUGINS]/sceneformats diff --git a/src/plugins/sceneformats/bezier/bezier_plugin.cpp b/src/plugins/sceneformats/bezier/bezier_plugin.cpp new file mode 100644 index 000000000..91a81afe6 --- /dev/null +++ b/src/plugins/sceneformats/bezier/bezier_plugin.cpp @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 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 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "bezier_plugin.h" +#include "qglbezierscenehandler.h" + +QT_BEGIN_NAMESPACE + +QGLBezierScenePlugin::QGLBezierScenePlugin() {} +QGLBezierScenePlugin::~QGLBezierScenePlugin() {} + +QGLSceneFormatHandler *QGLBezierScenePlugin::create(QIODevice *device, const QUrl& url, const QString &format) const +{ + Q_UNUSED(device); + Q_UNUSED(url); + Q_UNUSED(format); + return new QGLBezierSceneHandler; +} + +QT_END_NAMESPACE + + diff --git a/src/plugins/sceneformats/bezier/bezier_plugin.h b/src/plugins/sceneformats/bezier/bezier_plugin.h new file mode 100644 index 000000000..83b40b726 --- /dev/null +++ b/src/plugins/sceneformats/bezier/bezier_plugin.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 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 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef BEZIER_PLUGIN_H +#define BEZIER_PLUGIN_H + +#include "qglsceneformatplugin.h" + +QT_BEGIN_NAMESPACE + +class QGLBezierScenePlugin : public QObject, public QGLSceneFormatFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QGLSceneFormatFactoryInterface) + Q_PLUGIN_METADATA(IID "com.trolltech.Qt.QGLSceneFormatFactoryInterface" FILE "bezier_scene_plugin.json") +public: + QGLBezierScenePlugin(); + ~QGLBezierScenePlugin(); + virtual QGLSceneFormatHandler *create(QIODevice *device, const QUrl& url, const QString &format) const; +}; + +QT_END_NAMESPACE + +#endif // BEZIER_PLUGIN_H diff --git a/src/plugins/sceneformats/bezier/bezier_scene_plugin.json b/src/plugins/sceneformats/bezier/bezier_scene_plugin.json new file mode 100644 index 000000000..d91418547 --- /dev/null +++ b/src/plugins/sceneformats/bezier/bezier_scene_plugin.json @@ -0,0 +1,6 @@ +{ + "Keys": [ + "bezier", + "bez" + ] +} diff --git a/src/plugins/sceneformats/bezier/main.cpp b/src/plugins/sceneformats/bezier/main.cpp deleted file mode 100644 index a56bc8653..000000000 --- a/src/plugins/sceneformats/bezier/main.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 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 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qglsceneformatplugin.h" -#include "qglbezierscenehandler.h" - -QT_BEGIN_NAMESPACE - -class QGLBezierScenePlugin : public QGLSceneFormatPlugin -{ -public: - QStringList keys() const; - virtual QGLSceneFormatHandler *create(QIODevice *device, const QUrl& url, const QString &format) const; -}; - -QStringList QGLBezierScenePlugin::keys() const -{ - return QStringList() << QLatin1String("bezier") << QLatin1String("bez"); -} - -QGLSceneFormatHandler *QGLBezierScenePlugin::create(QIODevice *device, const QUrl& url, const QString &format) const -{ - Q_UNUSED(device); - Q_UNUSED(url); - Q_UNUSED(format); - return new QGLBezierSceneHandler; -} - -Q_EXPORT_STATIC_PLUGIN(QGLBezierScenePlugin) -Q_EXPORT_PLUGIN2(qscenebezier, QGLBezierScenePlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/sceneformats/obj/main.cpp b/src/plugins/sceneformats/obj/main.cpp deleted file mode 100644 index 46ed0b3f2..000000000 --- a/src/plugins/sceneformats/obj/main.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 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 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qglsceneformatplugin.h" -#include "qglobjscenehandler.h" - -QT_BEGIN_NAMESPACE - -//! [1] -class QGLObjScenePlugin : public QGLSceneFormatPlugin -{ -public: - QStringList keys() const; - virtual QGLSceneFormatHandler *create(QIODevice *device, const QUrl& url, const QString &format) const; -}; -//! [1] - -//! [2] -QStringList QGLObjScenePlugin::keys() const -{ - return QStringList() << QLatin1String("obj") << QLatin1String("model/obj"); -} -//! [2] - -//! [3] -QGLSceneFormatHandler *QGLObjScenePlugin::create(QIODevice *device, const QUrl& url, const QString &format) const -{ - Q_UNUSED(device); - Q_UNUSED(url); - Q_UNUSED(format); - return new QGLObjSceneHandler; -} -//! [3] - -//! [4] -Q_EXPORT_STATIC_PLUGIN(QGLObjScenePlugin) -Q_EXPORT_PLUGIN2(qsceneobj, QGLObjScenePlugin) -//! [4] - -QT_END_NAMESPACE diff --git a/src/plugins/sceneformats/obj/obj.pro b/src/plugins/sceneformats/obj/obj.pro index c20cc91f3..73bd0e8ec 100644 --- a/src/plugins/sceneformats/obj/obj.pro +++ b/src/plugins/sceneformats/obj/obj.pro @@ -1,13 +1,20 @@ TARGET = qsceneobj +QT += 3d + +load(qt_plugin) + include(../../qpluginbase.pri) HEADERS += qglobjscene.h \ - qglobjscenehandler.h -SOURCES += main.cpp \ + qglobjscenehandler.h \ + obj_plugin.h +SOURCES += \ qglobjscene.cpp \ - qglobjscenehandler.cpp + qglobjscenehandler.cpp \ + obj_plugin.cpp -QT += 3d +OTHER_FILES += \ + obj_scene_plugin.json DESTDIR = $$QT.3d.plugins/sceneformats target.path = $$[QT_INSTALL_PLUGINS]/sceneformats diff --git a/src/plugins/sceneformats/obj/obj_plugin.cpp b/src/plugins/sceneformats/obj/obj_plugin.cpp new file mode 100644 index 000000000..ae88ae374 --- /dev/null +++ b/src/plugins/sceneformats/obj/obj_plugin.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 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 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "obj_plugin.h" +#include "qglobjscenehandler.h" + +QT_BEGIN_NAMESPACE + +QGLObjScenePlugin::QGLObjScenePlugin() {} +QGLObjScenePlugin::~QGLObjScenePlugin() {} + +QGLSceneFormatHandler *QGLObjScenePlugin::create(QIODevice *device, const QUrl& url, const QString &format) const +{ + Q_UNUSED(device); + Q_UNUSED(url); + Q_UNUSED(format); + return new QGLObjSceneHandler; +} + +QT_END_NAMESPACE diff --git a/src/plugins/sceneformats/obj/obj_plugin.h b/src/plugins/sceneformats/obj/obj_plugin.h new file mode 100644 index 000000000..de9283a23 --- /dev/null +++ b/src/plugins/sceneformats/obj/obj_plugin.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 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 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef OBJ_PLUGIN_H +#define OBJ_PLUGIN_H + +#include "qglsceneformatplugin.h" + +QT_BEGIN_NAMESPACE + +class QGLObjScenePlugin : public QObject, public QGLSceneFormatFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QGLSceneFormatFactoryInterface) + Q_PLUGIN_METADATA(IID "com.trolltech.Qt.QGLSceneFormatFactoryInterface" FILE "obj_scene_plugin.json") +public: + QGLObjScenePlugin(); + ~QGLObjScenePlugin(); + virtual QGLSceneFormatHandler *create(QIODevice *device, const QUrl& url, const QString &format) const; +}; + +QT_END_NAMESPACE + +#endif // OBJ_PLUGIN_H diff --git a/src/plugins/sceneformats/obj/obj_scene_plugin.json b/src/plugins/sceneformats/obj/obj_scene_plugin.json new file mode 100644 index 000000000..b33d38205 --- /dev/null +++ b/src/plugins/sceneformats/obj/obj_scene_plugin.json @@ -0,0 +1,5 @@ +{ + "Keys": [ + "obj" + ] +} diff --git a/src/plugins/sceneformats/obj/qglobjscenehandler.cpp b/src/plugins/sceneformats/obj/qglobjscenehandler.cpp index 9568be6d3..6ae0b7872 100644 --- a/src/plugins/sceneformats/obj/qglobjscenehandler.cpp +++ b/src/plugins/sceneformats/obj/qglobjscenehandler.cpp @@ -53,7 +53,6 @@ QT_BEGIN_NAMESPACE QGLObjSceneHandler::QGLObjSceneHandler() : QGLSceneFormatHandler() - , palette(0) , smoothing(QGL::Faceted) , smoothingForced(false) { diff --git a/src/plugins/sceneformats/obj/qglobjscenehandler.h b/src/plugins/sceneformats/obj/qglobjscenehandler.h index b55d29d1b..1cfd5551f 100644 --- a/src/plugins/sceneformats/obj/qglobjscenehandler.h +++ b/src/plugins/sceneformats/obj/qglobjscenehandler.h @@ -63,7 +63,7 @@ private: void loadMaterials(QIODevice *device); QGLTexture2D *loadTexture(const QString& name); - QGLMaterialCollection *palette; + QSharedPointer palette; QGL::Smoothing smoothing; bool smoothingForced; //! [2] -- cgit v1.2.3