diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2015-03-16 04:13:32 +0400 |
---|---|---|
committer | Konstantin Ritt <ritt.ks@gmail.com> | 2015-03-16 11:06:14 +0000 |
commit | 137265904638da501a175f1332ec880d77bfd214 (patch) | |
tree | 91dcac9b73bdd9c0130f28365b1b0dbee7a40312 /src/render | |
parent | 5dc05523555c35d3ea043ed2405dcdf9e6b62ba4 (diff) |
[.*SceneParser] Minor clean-up
Change-Id: I171a3e44383f2f5160b24113de6d92725ed19fe9
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/io/abstractsceneparser.cpp | 2 | ||||
-rw-r--r-- | src/render/io/abstractsceneparser_p.h | 18 | ||||
-rw-r--r-- | src/render/io/gltfparser.cpp | 14 | ||||
-rw-r--r-- | src/render/io/gltfparser_p.h | 18 |
4 files changed, 25 insertions, 27 deletions
diff --git a/src/render/io/abstractsceneparser.cpp b/src/render/io/abstractsceneparser.cpp index a8fd7175a..3019e0b77 100644 --- a/src/render/io/abstractsceneparser.cpp +++ b/src/render/io/abstractsceneparser.cpp @@ -80,6 +80,6 @@ void AbstractSceneParser::logInfo(const QString &info) qCDebug(Render::Io) << info; } -} // Qt3D namespace +} // namespace Qt3D QT_END_NAMESPACE diff --git a/src/render/io/abstractsceneparser_p.h b/src/render/io/abstractsceneparser_p.h index c6aef1729..83257e3b9 100644 --- a/src/render/io/abstractsceneparser_p.h +++ b/src/render/io/abstractsceneparser_p.h @@ -59,7 +59,6 @@ class QT3DRENDERERSHARED_EXPORT AbstractSceneParser : public QObject Q_PROPERTY(QStringList errors READ errors NOTIFY errorsChanged) public: - enum ParserStatus { Empty, Loading, @@ -70,20 +69,19 @@ public: AbstractSceneParser(); virtual ~AbstractSceneParser(); - virtual void setSource(const QUrl &source) = 0; - virtual bool isExtensionSupported(const QUrl &source) = 0; - virtual QEntity *scene(QString id = QString()) = 0; - virtual QEntity *node(QString id) = 0; + virtual void setSource(const QUrl &source) = 0; + virtual bool isExtensionSupported(const QUrl &source) const = 0; + virtual QEntity *scene(const QString &id = QString()) = 0; + virtual QEntity *node(const QString &id) = 0; ParserStatus parserStatus() const; - QStringList errors() const; + QStringList errors() const; Q_SIGNALS: - void parserStatusChanged(); - void errorsChanged(); + void parserStatusChanged(); + void errorsChanged(); protected: - void setParserStatus(ParserStatus parserStatus); void logError(const QString &error); void logInfo(const QString &info); @@ -93,7 +91,7 @@ private: QStringList m_errors; }; -} +} // namespace Qt3D QT_END_NAMESPACE diff --git a/src/render/io/gltfparser.cpp b/src/render/io/gltfparser.cpp index 570ceab77..d3848473e 100644 --- a/src/render/io/gltfparser.cpp +++ b/src/render/io/gltfparser.cpp @@ -309,13 +309,13 @@ void GLTFParser::setSource(const QUrl &source) * Returns true if the extension of \a path is supported by the * GLTF parser. */ -bool GLTFParser::isExtensionSupported(const QUrl &source) +bool GLTFParser::isExtensionSupported(const QUrl &source) const { const QString path = QUrlHelper::urlToLocalFileOrQrc(source); return GLTFParser::isGLTFPath(path); } -QMeshDataPtr GLTFParser::mesh(QString id) +QMeshDataPtr GLTFParser::mesh(const QString &id) { parse(); if (m_meshDict.contains(id)) @@ -336,7 +336,7 @@ QEntity* GLTFParser::defaultScene() return scene(m_defaultScene); } -QEntity* GLTFParser::scene(QString id) +QEntity* GLTFParser::scene(const QString &id) { parse(); @@ -359,7 +359,7 @@ QEntity* GLTFParser::scene(QString id) return sceneEntity; } -QEntity* GLTFParser::node(QString id) +QEntity* GLTFParser::node(const QString &id) { QJsonObject nodes = m_json.object().value(KEY_NODES).toObject(); if (!nodes.contains(id)) { @@ -460,7 +460,7 @@ QEntity* GLTFParser::node(QString id) #undef far #endif -QCameraLens* GLTFParser::camera(QString id) +QCameraLens* GLTFParser::camera(const QString &id) { parse(); QJsonObject cams = m_json.object().value(KEY_CAMERAS).toObject(); @@ -496,7 +496,7 @@ QCameraLens* GLTFParser::camera(QString id) } } -QMaterial* GLTFParser::material(QString id) +QMaterial* GLTFParser::material(const QString &id) { parse(); @@ -1048,7 +1048,7 @@ bool GLTFParserMesh::GLTFParserMeshFunctor::operator ==(const QAbstractMeshFunct return false; } -} // of namespace Qt3D +} // namespace Qt3D QT_END_NAMESPACE diff --git a/src/render/io/gltfparser_p.h b/src/render/io/gltfparser_p.h index a72e03793..d18e4483e 100644 --- a/src/render/io/gltfparser_p.h +++ b/src/render/io/gltfparser_p.h @@ -70,28 +70,28 @@ class GLTFParser : public AbstractSceneParser public: GLTFParser(); - static bool isGLTFPath(const QString &path); void setBasePath(const QString& path); bool setJSON( QJsonDocument json ); // SceneParserInterface interface void setSource(const QUrl &source) Q_DECL_OVERRIDE; - bool isExtensionSupported(const QUrl &source) Q_DECL_OVERRIDE; + bool isExtensionSupported(const QUrl &source) const Q_DECL_OVERRIDE; /** * @brief instantiate Create Nodes based on glTf JSON document * @return A new scene-graph fragment based on the provided glTf */ - QEntity *node(QString id) Q_DECL_OVERRIDE; - QEntity *scene(QString id) Q_DECL_OVERRIDE; + QEntity *node(const QString &id) Q_DECL_OVERRIDE; + QEntity *scene(const QString &id = QString()) Q_DECL_OVERRIDE; +private: + static bool isGLTFPath(const QString &path); QEntity *defaultScene(); - QMeshDataPtr mesh(QString id); - QMaterial *material(QString id); - QCameraLens *camera(QString id); + QMeshDataPtr mesh(const QString &id); + QMaterial *material(const QString &id); + QCameraLens *camera(const QString &id); -private: void parse(); void processJSONMesh( QString id, QJsonObject jsonObj ); @@ -158,7 +158,7 @@ private: //Render::RenderState *buildState(const QByteArray& nm, QJsonValue obj); }; -} +} // namespace Qt3D QT_END_NAMESPACE |