diff options
author | Mike Krus <mike.krus@kdab.com> | 2020-01-22 21:35:32 +0000 |
---|---|---|
committer | Mike Krus <mike.krus@kdab.com> | 2020-02-27 06:29:57 +0000 |
commit | 17706144e9dc6c2dfde580b7821f18c5f6924682 (patch) | |
tree | 5f77929db358607fe63a1d438b7a746a6966cbfb /src/plugins/sceneparsers | |
parent | 7f625e93620b313466d0223e911c0c3a5b492617 (diff) |
Geometry refactoring
Move QBuffer, QAttribute, QGeometry to Qt3DCore.
Change-Id: I59dfd091eefadcada93350b3aba955f40b304385
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/plugins/sceneparsers')
-rw-r--r-- | src/plugins/sceneparsers/assimp/assimpimporter.cpp | 28 | ||||
-rw-r--r-- | src/plugins/sceneparsers/gltf/gltfimporter.cpp | 8 | ||||
-rw-r--r-- | src/plugins/sceneparsers/gltf/gltfimporter.h | 10 | ||||
-rw-r--r-- | src/plugins/sceneparsers/gltfexport/gltfexporter.cpp | 6 |
4 files changed, 26 insertions, 26 deletions
diff --git a/src/plugins/sceneparsers/assimp/assimpimporter.cpp b/src/plugins/sceneparsers/assimp/assimpimporter.cpp index ef28c577f..7655bf931 100644 --- a/src/plugins/sceneparsers/assimp/assimpimporter.cpp +++ b/src/plugins/sceneparsers/assimp/assimpimporter.cpp @@ -41,20 +41,20 @@ #include <Qt3DCore/qentity.h> #include <Qt3DCore/qtransform.h> -#include <Qt3DExtras/qdiffusemapmaterial.h> -#include <Qt3DExtras/qdiffusespecularmapmaterial.h> -#include <Qt3DExtras/qphongmaterial.h> -#include <Qt3DRender/qattribute.h> -#include <Qt3DRender/qbuffer.h> +#include <Qt3DCore/qattribute.h> +#include <Qt3DCore/qbuffer.h> +#include <Qt3DCore/qgeometry.h> #include <Qt3DRender/qcameralens.h> #include <Qt3DRender/qeffect.h> -#include <Qt3DRender/qgeometry.h> #include <Qt3DRender/qgeometryrenderer.h> #include <Qt3DRender/qmaterial.h> #include <Qt3DRender/qmesh.h> #include <Qt3DRender/qparameter.h> #include <Qt3DRender/qtexture.h> #include <Qt3DRender/qtextureimagedatagenerator.h> +#include <Qt3DExtras/qdiffusemapmaterial.h> +#include <Qt3DExtras/qdiffusespecularmapmaterial.h> +#include <Qt3DExtras/qphongmaterial.h> #include <Qt3DExtras/qmorphphongmaterial.h> #include <Qt3DExtras/qdiffusemapmaterial.h> #include <Qt3DExtras/qdiffusespecularmapmaterial.h> @@ -67,8 +67,8 @@ #include <qmath.h> #include <Qt3DCore/private/qabstractnodefactory_p.h> +#include <Qt3DCore/private/qurlhelper_p.h> #include <Qt3DRender/private/renderlogging_p.h> -#include <Qt3DRender/private/qurlhelper_p.h> QT_BEGIN_NAMESPACE @@ -394,7 +394,7 @@ bool AssimpImporter::areAssimpExtensions(const QStringList &extensions) */ void AssimpImporter::setSource(const QUrl &source) { - const QString path = QUrlHelper::urlToLocalFileOrQrc(source); + const QString path = Qt3DCore::QUrlHelper::urlToLocalFileOrQrc(source); QFileInfo file(path); m_sceneDir = file.absoluteDir(); if (!file.exists()) { @@ -702,12 +702,12 @@ QGeometryRenderer *AssimpImporter::loadMesh(uint meshIndex) QGeometryRenderer *geometryRenderer = QAbstractNodeFactory::createNode<QGeometryRenderer>("QGeometryRenderer"); QGeometry *meshGeometry = QAbstractNodeFactory::createNode<QGeometry>("QGeometry"); meshGeometry->setParent(geometryRenderer); - Qt3DRender::QBuffer *vertexBuffer = QAbstractNodeFactory::createNode<Qt3DRender::QBuffer>("QBuffer"); + Qt3DCore::QBuffer *vertexBuffer = QAbstractNodeFactory::createNode<Qt3DCore::QBuffer>("QBuffer"); vertexBuffer->setParent(meshGeometry); - vertexBuffer->setType(Qt3DRender::QBuffer::VertexBuffer); - Qt3DRender::QBuffer *indexBuffer = QAbstractNodeFactory::createNode<Qt3DRender::QBuffer>("QBuffer"); + vertexBuffer->setType(Qt3DCore::QBuffer::VertexBuffer); + Qt3DCore::QBuffer *indexBuffer = QAbstractNodeFactory::createNode<Qt3DCore::QBuffer>("QBuffer"); indexBuffer->setParent(meshGeometry); - indexBuffer->setType(Qt3DRender::QBuffer::IndexBuffer); + indexBuffer->setType(Qt3DCore::QBuffer::IndexBuffer); geometryRenderer->setGeometry(meshGeometry); @@ -922,8 +922,8 @@ QGeometryRenderer *AssimpImporter::loadMesh(uint meshIndex) } } - Qt3DRender::QBuffer *targetBuffer - = QAbstractNodeFactory::createNode<Qt3DRender::QBuffer>("QBuffer"); + Qt3DCore::QBuffer *targetBuffer + = QAbstractNodeFactory::createNode<Qt3DCore::QBuffer>("QBuffer"); targetBuffer->setData(targetBufferArray); targetBuffer->setParent(meshGeometry); diff --git a/src/plugins/sceneparsers/gltf/gltfimporter.cpp b/src/plugins/sceneparsers/gltf/gltfimporter.cpp index 860dec3e7..b141a44a5 100644 --- a/src/plugins/sceneparsers/gltf/gltfimporter.cpp +++ b/src/plugins/sceneparsers/gltf/gltfimporter.cpp @@ -50,6 +50,7 @@ #include <Qt3DCore/qentity.h> #include <Qt3DCore/qtransform.h> +#include <Qt3DCore/qgeometry.h> #include <Qt3DRender/qcameralens.h> #include <Qt3DRender/qcamera.h> @@ -74,7 +75,6 @@ #include <Qt3DRender/qstenciltestarguments.h> #include <Qt3DRender/qeffect.h> #include <Qt3DRender/qfrontface.h> -#include <Qt3DRender/qgeometry.h> #include <Qt3DRender/qgeometryrenderer.h> #include <Qt3DRender/qmaterial.h> #include <Qt3DRender/qgraphicsapifilter.h> @@ -1522,7 +1522,7 @@ void GLTFImporter::processJSONBufferView(const QString &id, const QJsonObject& j qUtf16PrintableImpl(bufferData.path), qUtf16PrintableImpl(id)); } - Qt3DRender::QBuffer *b = new Qt3DRender::QBuffer(); + Qt3DCore::QBuffer *b = new Qt3DCore::QBuffer(); b->setData(bytes); m_buffers[id] = b; } @@ -1768,7 +1768,7 @@ void GLTFImporter::processJSONMesh(const QString &id, const QJsonObject &json) attributeName = attrName; //Get buffer handle for accessor - Qt3DRender::QBuffer *buffer = m_buffers.value(accessorIt->bufferViewName, nullptr); + Qt3DCore::QBuffer *buffer = m_buffers.value(accessorIt->bufferViewName, nullptr); if (Q_UNLIKELY(!buffer)) { qCWarning(GLTFImporterLog, "unknown buffer-view: %ls processing accessor: %ls", qUtf16PrintableImpl(accessorIt->bufferViewName), @@ -1796,7 +1796,7 @@ void GLTFImporter::processJSONMesh(const QString &id, const QJsonObject &json) qUtf16PrintableImpl(accIndex), qUtf16PrintableImpl(id)); } else { //Get buffer handle for accessor - Qt3DRender::QBuffer *buffer = m_buffers.value(accessorIt->bufferViewName, nullptr); + Qt3DCore::QBuffer *buffer = m_buffers.value(accessorIt->bufferViewName, nullptr); if (Q_UNLIKELY(!buffer)) { qCWarning(GLTFImporterLog, "unknown buffer-view: %ls processing accessor: %ls", qUtf16PrintableImpl(accessorIt->bufferViewName), diff --git a/src/plugins/sceneparsers/gltf/gltfimporter.h b/src/plugins/sceneparsers/gltf/gltfimporter.h index 271ce5979..79f35ebad 100644 --- a/src/plugins/sceneparsers/gltf/gltfimporter.h +++ b/src/plugins/sceneparsers/gltf/gltfimporter.h @@ -52,8 +52,8 @@ // We mean it. // -#include <Qt3DRender/qattribute.h> -#include <Qt3DRender/qbuffer.h> +#include <Qt3DCore/qattribute.h> +#include <Qt3DCore/qbuffer.h> #include <QtCore/qjsondocument.h> #include <QtCore/qjsonobject.h> #include <QtCore/qhash.h> @@ -135,7 +135,7 @@ private: explicit AccessorData(const QJsonObject& json, int major, int minor); QString bufferViewName; - QAttribute::VertexBaseType type; + Qt3DCore::QAttribute::VertexBaseType type; uint dataSize; int count; int offset; @@ -178,7 +178,7 @@ private: QByteArray resolveLocalData(const QString &path) const; QVariant parameterValueFromJSON(int type, const QJsonValue &value) const; - static QAttribute::VertexBaseType accessorTypeFromJSON(int componentType); + static Qt3DCore::QAttribute::VertexBaseType accessorTypeFromJSON(int componentType); static uint accessorDataSizeFromJson(const QString &type); static QRenderState *buildStateEnable(int state); @@ -212,7 +212,7 @@ private: QHash<QString, QMaterial*> m_materialCache; QHash<QString, BufferData> m_bufferDatas; - QHash<QString, Qt3DRender::QBuffer*> m_buffers; + QHash<QString, Qt3DCore::QBuffer*> m_buffers; QHash<QString, QString> m_shaderPaths; QHash<QString, QShaderProgram*> m_programs; diff --git a/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp b/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp index 9fced8e89..8b4fac1ce 100644 --- a/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp +++ b/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp @@ -58,14 +58,15 @@ #include <QtGui/qmatrix4x4.h> #include <Qt3DCore/qentity.h> +#include <Qt3DCore/qattribute.h> +#include <Qt3DCore/qbuffer.h> +#include <Qt3DCore/qgeometry.h> #include <Qt3DCore/qtransform.h> #include <Qt3DRender/qcameralens.h> #include <Qt3DRender/qcamera.h> #include <Qt3DRender/qblendequation.h> #include <Qt3DRender/qblendequationarguments.h> #include <Qt3DRender/qeffect.h> -#include <Qt3DRender/qattribute.h> -#include <Qt3DRender/qbuffer.h> #include <Qt3DRender/qmaterial.h> #include <Qt3DRender/qgraphicsapifilter.h> #include <Qt3DRender/qparameter.h> @@ -74,7 +75,6 @@ #include <Qt3DRender/qpointlight.h> #include <Qt3DRender/qspotlight.h> #include <Qt3DRender/qdirectionallight.h> -#include <Qt3DRender/qgeometry.h> #include <Qt3DRender/qgeometryrenderer.h> #include <Qt3DRender/qtechnique.h> #include <Qt3DRender/qalphacoverage.h> |