diff options
author | Nico Vertriest <nico.vertriest@qt.io> | 2017-09-26 11:49:32 +0200 |
---|---|---|
committer | Nico Vertriest <nico.vertriest@qt.io> | 2017-09-29 08:01:21 +0000 |
commit | fa2325da121e3fe3e2cc2c8966c526d16c956098 (patch) | |
tree | e2bdc7b207f06b3c0a0c60a9527c078e50c98d07 /src | |
parent | 296aa2ee18c345ace3ddc424c1d65e62dea810bf (diff) |
Doc: add doc to classes GLTFImporter and GLTFExporter
Change-Id: I890be56a59be47923bd0c2db31d72d3c2c45ae0e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/sceneparsers/gltf/gltfimporter.cpp | 34 | ||||
-rw-r--r-- | src/plugins/sceneparsers/gltfexport/gltfexporter.cpp | 24 |
2 files changed, 54 insertions, 4 deletions
diff --git a/src/plugins/sceneparsers/gltf/gltfimporter.cpp b/src/plugins/sceneparsers/gltf/gltfimporter.cpp index a94a4f307..4419bd708 100644 --- a/src/plugins/sceneparsers/gltf/gltfimporter.cpp +++ b/src/plugins/sceneparsers/gltf/gltfimporter.cpp @@ -268,11 +268,23 @@ GLTFImporter::~GLTFImporter() } +/*! + \class Qt3DRender::GLTFImporter + \inmodule Qt3DRender + \brief Handles importing of gltf files +*/ +/*! + Set the base \a path for importing scenes. +*/ void GLTFImporter::setBasePath(const QString& path) { m_basePath = path; } +/*! + Set a \a json document as the file used for importing a scene. + Returns true if the operation is successful. +*/ bool GLTFImporter::setJSON(const QJsonDocument &json ) { if ( !json.isObject() ) { @@ -286,7 +298,8 @@ bool GLTFImporter::setJSON(const QJsonDocument &json ) } /*! - * Sets the \a path used by the parser to load the scene file. + * Sets the path based on parameter \a source. The path is + * used by the parser to load the scene file. * If the file is valid, parsing is automatically triggered. */ void GLTFImporter::setSource(const QUrl &source) @@ -314,8 +327,9 @@ void GLTFImporter::setSource(const QUrl &source) } /*! - * Sets the \a path used by the parser to load the scene file. - * If the file is valid, parsing is automatically triggered. + * Sets the \a basePath used by the parser to load the scene file. + * If the file derived from \a data is valid, parsing is automatically + * triggered. */ void GLTFImporter::setData(const QByteArray& data, const QString &basePath) { @@ -332,7 +346,7 @@ void GLTFImporter::setData(const QByteArray& data, const QString &basePath) } /*! - * Returns true if the extensions are supported by the + * Returns true if the \a extensions are supported by the * GLTF parser. */ bool GLTFImporter::areFileTypesSupported(const QStringList &extensions) const @@ -340,6 +354,9 @@ bool GLTFImporter::areFileTypesSupported(const QStringList &extensions) const return GLTFImporter::isGLTFSupported(extensions); } +/*! + Imports the node specified in \a id from the GLTF file. +*/ Qt3DCore::QEntity* GLTFImporter::node(const QString &id) { QJsonObject nodes = m_json.object().value(KEY_NODES).toObject(); @@ -507,6 +524,9 @@ Qt3DCore::QEntity* GLTFImporter::node(const QString &id) return result; } +/*! + Imports the scene specified in parameter \a id. +*/ Qt3DCore::QEntity* GLTFImporter::scene(const QString &id) { parse(); @@ -1656,6 +1676,9 @@ void GLTFImporter::processJSONRenderPass(const QString &id, const QJsonObject &j m_renderPasses[id] = pass; } +/*! + Loads raw data from the GLTF file into the buffer. +*/ void GLTFImporter::loadBufferData() { for (auto &bufferData : m_bufferDatas) { @@ -1665,6 +1688,9 @@ void GLTFImporter::loadBufferData() } } +/*! + Removes all data from the buffer. +*/ void GLTFImporter::unloadBufferData() { for (const auto &bufferData : qAsConst(m_bufferDatas)) { diff --git a/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp b/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp index 10f72f849..ba100e095 100644 --- a/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp +++ b/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp @@ -266,6 +266,13 @@ GLTFExporter::~GLTFExporter() { } +/*! + \class Qt3DRender::GLTFExporter + \inmodule Qt3DRender + \brief Manages the export of a 3D scene to the GLTF format. + + Handles the export of a 3D scene to the GLTF format. +*/ // sceneRoot : The root entity that contains the exported scene. If the sceneRoot doesn't have // any exportable components, it is not exported itself. This is because importing a // scene creates an empty top level entity to hold the scene. @@ -278,6 +285,23 @@ GLTFExporter::~GLTFExporter() // "binaryJson" (bool): Generates a binary JSON file, which is more efficient to parse. // "compactJson" (bool): Removes unnecessary whitespace from the generated JSON file. // Ignored if "binaryJson" option is true. + +/*! + Exports the scene to the GLTF format + + \a sceneRoot is the root entity that will be exported. + If the sceneRoot does not have any exportable components, it is not exported itself. + + \a outDir is the directory in which the scene export is created. + + \a exportName is the name of the directory created in \c outDir that will hold + the exported scene. + + \a options contain the export options. + + Returns true if the export was carried out successfully. +*/ + bool GLTFExporter::exportScene(QEntity *sceneRoot, const QString &outDir, const QString &exportName, const QVariantHash &options) { |