| 1 | // Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies). |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #include <Qt3DRender/private/qgeometryloaderfactory_p.h> |
| 5 | |
| 6 | #include "objgeometryloader.h" |
| 7 | #include "plygeometryloader.h" |
| 8 | #include "stlgeometryloader.h" |
| 9 | |
| 10 | QT_BEGIN_NAMESPACE |
| 11 | |
| 12 | class DefaultGeometryLoaderPlugin : public Qt3DRender::QGeometryLoaderFactory |
| 13 | { |
| 14 | Q_OBJECT |
| 15 | Q_PLUGIN_METADATA(IID QGeometryLoaderFactory_iid FILE "default.json") |
| 16 | public: |
| 17 | |
| 18 | QStringList keys() const override |
| 19 | { |
| 20 | return QStringList() << OBJGEOMETRYLOADER_EXT |
| 21 | << PLYGEOMETRYLOADER_EXT |
| 22 | << STLGEOMETRYLOADER_EXT; |
| 23 | } |
| 24 | |
| 25 | Qt3DRender::QGeometryLoaderInterface *create(const QString &ext) override |
| 26 | { |
| 27 | if (ext.compare(OBJGEOMETRYLOADER_EXT, cs: Qt::CaseInsensitive) == 0) |
| 28 | return new Qt3DRender::ObjGeometryLoader; |
| 29 | else if (ext.compare(PLYGEOMETRYLOADER_EXT, cs: Qt::CaseInsensitive) == 0) |
| 30 | return new Qt3DRender::PlyGeometryLoader; |
| 31 | else if (ext.compare(STLGEOMETRYLOADER_EXT, cs: Qt::CaseInsensitive) == 0) |
| 32 | return new Qt3DRender::StlGeometryLoader; |
| 33 | return nullptr; |
| 34 | } |
| 35 | }; |
| 36 | |
| 37 | QT_END_NAMESPACE |
| 38 | |
| 39 | #include "main.moc" |
| 40 |
