diff options
author | Paul Lemire <paul.lemire350@gmail.com> | 2015-08-10 15:26:28 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2015-08-11 17:29:25 +0000 |
commit | 86efa9fe761915d738ba231a5d94c74af3660500 (patch) | |
tree | 62176b3200e30bdf4f52ac2e1fd01277c80188ff | |
parent | dfe50678f651f4effd677e4fc9d7b518a5975329 (diff) |
Cleanup: remove QAbstractMesh/QMeshData/MeshDataManager
Change-Id: I1f13cea4cf864dcf985d1f487e195509de9006e7
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
35 files changed, 20 insertions, 1285 deletions
diff --git a/examples/qt3d/custom-mesh-cpp/main.cpp b/examples/qt3d/custom-mesh-cpp/main.cpp index 6ef760b83..c17c71906 100644 --- a/examples/qt3d/custom-mesh-cpp/main.cpp +++ b/examples/qt3d/custom-mesh-cpp/main.cpp @@ -59,7 +59,6 @@ #include <Qt3DRenderer/QGeometry> #include <Qt3DRenderer/QAttribute> #include <Qt3DRenderer/QBuffer> -#include <Qt3DRenderer/QMeshData> #include <QPropertyAnimation> diff --git a/src/plugins/sceneparsers/assimp/assimpparser.cpp b/src/plugins/sceneparsers/assimp/assimpparser.cpp index 506222693..50feb4b83 100644 --- a/src/plugins/sceneparsers/assimp/assimpparser.cpp +++ b/src/plugins/sceneparsers/assimp/assimpparser.cpp @@ -41,7 +41,6 @@ #include <Qt3DCore/qlookattransform.h> #include <Qt3DCore/qmatrixtransform.h> #include <Qt3DCore/qcameralens.h> -#include <private/qabstractmesh_p.h> #include <Qt3DRenderer/qparameter.h> #include <Qt3DRenderer/qeffect.h> #include <Qt3DRenderer/qmesh.h> @@ -515,9 +514,9 @@ void AssimpParser::loadMaterial(uint materialIndex) } /*! - * Converts the Assimp aiMesh mesh identified by \a meshIndex to a QMeshData + * Converts the Assimp aiMesh mesh identified by \a meshIndex to a QGeometryRenderer * and adds it to a dictionary of meshes. - * \sa QMeshData + * \sa QGeometryRenderer */ void AssimpParser::loadMesh(uint meshIndex) { diff --git a/src/plugins/sceneparsers/assimp/assimpparser_p.h b/src/plugins/sceneparsers/assimp/assimpparser_p.h index e70cfcc4b..250cb9ec3 100644 --- a/src/plugins/sceneparsers/assimp/assimpparser_p.h +++ b/src/plugins/sceneparsers/assimp/assimpparser_p.h @@ -42,8 +42,6 @@ #include <assimp/scene.h> #include <assimp/postprocess.h> #include <assimp/DefaultLogger.hpp> -#include <Qt3DRenderer/qabstractmesh.h> -#include <Qt3DRenderer/qmeshdata.h> #include <Qt3DRenderer/private/abstractsceneparser_p.h> #include "assimphelpers_p.h" diff --git a/src/plugins/sceneparsers/gltf/gltfparser_p.h b/src/plugins/sceneparsers/gltf/gltfparser_p.h index 93676d3a6..73048bebd 100644 --- a/src/plugins/sceneparsers/gltf/gltfparser_p.h +++ b/src/plugins/sceneparsers/gltf/gltfparser_p.h @@ -43,7 +43,6 @@ #include <Qt3DRenderer/qattribute.h> #include <Qt3DRenderer/qbuffer.h> -#include <Qt3DRenderer/qmeshdata.h> #include <Qt3DRenderer/private/abstractsceneparser_p.h> diff --git a/src/quick3d/imports/render/qt3dquick3drendererplugin.cpp b/src/quick3d/imports/render/qt3dquick3drendererplugin.cpp index bb3fd8bd2..4edb5c2c8 100644 --- a/src/quick3d/imports/render/qt3dquick3drendererplugin.cpp +++ b/src/quick3d/imports/render/qt3dquick3drendererplugin.cpp @@ -37,7 +37,6 @@ #include <QtQml> #include "qt3dquick3drendererplugin.h" -#include <Qt3DRenderer/qabstractmesh.h> #include <Qt3DRenderer/qabstractsceneloader.h> #include <Qt3DRenderer/qsceneloader.h> #include <Qt3DRenderer/qmesh.h> @@ -204,7 +203,6 @@ void Qt3DQuick3DRendererPlugin::registerTypes(const char *uri) qmlRegisterType<Qt3D::QGeometryRenderer>(uri, 2, 0, "GeometryRenderer"); // Meshes - qmlRegisterUncreatableType<Qt3D::QAbstractMesh>(uri, 2, 0, "QAbstractMesh", QStringLiteral("QAbstractMesh is abstract")); qmlRegisterType<Qt3D::QMesh>(uri, 2, 0, "Mesh"); qmlRegisterType<Qt3D::QCuboidMesh>(uri, 2, 0, "CuboidMesh"); qmlRegisterType<Qt3D::QCylinderMesh>(uri, 2, 0, "CylinderMesh"); diff --git a/src/render/backend/handle_types_p.h b/src/render/backend/handle_types_p.h index 5a53e43b9..5681d6e3d 100644 --- a/src/render/backend/handle_types_p.h +++ b/src/render/backend/handle_types_p.h @@ -47,7 +47,6 @@ class QOpenGLVertexArrayObject; namespace Qt3D { -class QMeshData; class TexImageData; namespace Render { @@ -86,7 +85,6 @@ typedef QHandle<RenderMaterial, 16> HMaterial; typedef QHandle<QMatrix4x4, 16> HMatrix; typedef QHandle<RenderShader, 16> HShader; typedef QHandle<QOpenGLVertexArrayObject*, 16> HVao; -typedef QHandle<QMeshData, 16> HMeshData; typedef QHandle<RenderShader, 16> HShader; typedef QHandle<SortCriterion, 8> HSortCriterion; typedef QHandle<RenderTechnique, 16> HTechnique; diff --git a/src/render/backend/jobs/framepreparationjob.cpp b/src/render/backend/jobs/framepreparationjob.cpp index 34465406c..c402783cc 100644 --- a/src/render/backend/jobs/framepreparationjob.cpp +++ b/src/render/backend/jobs/framepreparationjob.cpp @@ -38,7 +38,6 @@ #include <Qt3DRenderer/private/renderer_p.h> #include <Qt3DRenderer/private/renderentity_p.h> #include <Qt3DRenderer/private/rendershaderdata_p.h> -#include <Qt3DRenderer/qmeshdata.h> #include <Qt3DRenderer/sphere.h> QT_BEGIN_NAMESPACE diff --git a/src/render/backend/jobs/loadmeshdatajob.cpp b/src/render/backend/jobs/loadmeshdatajob.cpp deleted file mode 100644 index 93c3aea7d..000000000 --- a/src/render/backend/jobs/loadmeshdatajob.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "loadmeshdatajob_p.h" - -#include <qattribute.h> -#include <qmesh.h> -#include <sphere.h> -#include <Qt3DRenderer/private/renderer_p.h> -#include <Qt3DRenderer/private/managers_p.h> -#include <Qt3DRenderer/private/meshdatamanager_p.h> -#include <Qt3DRenderer/private/renderlogging_p.h> - -#include <QThread> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { -namespace Render { - -LoadMeshDataJob::LoadMeshDataJob(QAbstractMeshFunctorPtr functor, const QNodeId &meshUuid) - : QAspectJob() - , m_meshUuid(meshUuid) - , m_functor(functor) -{ -} - -void LoadMeshDataJob::run() -{ - qCDebug(Jobs) << "Entering" << Q_FUNC_INFO << QThread::currentThread(); - - if (m_functor.isNull()) - return ; - - QMutexLocker lock(m_renderer->mutex()); - HMeshData meshDataHandle = m_renderer->meshDataManager()->meshDataFromFunctor(m_functor); - lock.unlock(); - - if (meshDataHandle.isNull()) { - // Load the mesh from disk (or wherever) - QMeshDataPtr meshDataPtr = m_functor->operator ()().staticCast<QMeshData>(); - if (meshDataPtr.isNull()) { - qCDebug(Jobs) << Q_FUNC_INFO << "Mesh has no raw data"; - return ; - } - // TO DO try to use QAbstractMeshData if possible - lock.relock(); - meshDataHandle = m_renderer->meshDataManager()->acquire(); - QMeshData *meshData = m_renderer->meshDataManager()->data(meshDataHandle); - *meshData = *(meshDataPtr.data()); - m_renderer->meshDataManager()->addMeshDataForFunctor(meshDataHandle, m_functor); - QAttribute *attr = static_cast<QAttribute *>(meshData->attributeByName(QMeshData::defaultPositionAttributeName())); - if (!attr) - qCWarning(Jobs) << Q_FUNC_INFO << "unknown attribute: position"; - } - lock.relock(); -// m_renderer->meshManager()->lookupResource(m_meshUuid)->setMeshData(meshDataHandle); -} - -} // namespace Render -} // namespace Qt3D - -QT_END_NAMESPACE diff --git a/src/render/backend/jobs/loadmeshdatajob_p.h b/src/render/backend/jobs/loadmeshdatajob_p.h deleted file mode 100644 index c8d20ca45..000000000 --- a/src/render/backend/jobs/loadmeshdatajob_p.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_RENDER_LOADMESHDATAJOB_H -#define QT3D_RENDER_LOADMESHDATAJOB_H - -#include <Qt3DCore/qnodeid.h> -#include <Qt3DCore/qaspectjob.h> -#include <Qt3DCore/qhandle.h> -#include <Qt3DRenderer/qmeshdata.h> -#include <Qt3DRenderer/qabstractmesh.h> -#include <QSharedPointer> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -namespace Render { - -class Renderer; - -class LoadMeshDataJob : public Qt3D::QAspectJob -{ -public: - LoadMeshDataJob(QAbstractMeshFunctorPtr functor, const QNodeId &meshUuid); - void setRenderer(Renderer *renderer) { m_renderer = renderer; } -protected: - void run() Q_DECL_OVERRIDE; - -private: - QNodeId m_meshUuid; - QAbstractMeshFunctorPtr m_functor; - Renderer *m_renderer; -}; - -typedef QSharedPointer<LoadMeshDataJob> LoadMeshDataJobPtr; - -} // namespace Render -} // namespace Qt3D - -QT_END_NAMESPACE - -#endif // QT3D_RENDER_LOADMESHDATAJOB_H diff --git a/src/render/backend/jobs/render-jobs.pri b/src/render/backend/jobs/render-jobs.pri index a9905525d..2c9b93a4e 100644 --- a/src/render/backend/jobs/render-jobs.pri +++ b/src/render/backend/jobs/render-jobs.pri @@ -3,7 +3,6 @@ INCLUDEPATH += $$PWD HEADERS += \ $$PWD/updateworldtransformjob_p.h \ $$PWD/updateboundingvolumejob_p.h \ - $$PWD/loadmeshdatajob_p.h \ $$PWD/renderviewjob_p.h \ $$PWD/renderviewjobutils_p.h \ $$PWD/loadscenejob_p.h \ @@ -16,7 +15,6 @@ HEADERS += \ SOURCES += \ $$PWD/updateworldtransformjob.cpp \ $$PWD/updateboundingvolumejob.cpp \ - $$PWD/loadmeshdatajob.cpp \ $$PWD/renderviewjob.cpp \ $$PWD/renderviewjobutils.cpp \ $$PWD/loadscenejob.cpp \ diff --git a/src/render/backend/managers_p.h b/src/render/backend/managers_p.h index 7dc7405ff..7f156688c 100644 --- a/src/render/backend/managers_p.h +++ b/src/render/backend/managers_p.h @@ -64,8 +64,6 @@ QT_BEGIN_NAMESPACE namespace Qt3D { -class QMeshData; - namespace Render { class AttachmentManager : public QResourceManager< diff --git a/src/render/backend/meshdatamanager.cpp b/src/render/backend/meshdatamanager.cpp deleted file mode 100644 index f4fd7c00c..000000000 --- a/src/render/backend/meshdatamanager.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "meshdatamanager_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3D { -namespace Render { - -// Called by aspect thread when RenderMesh receive a new functor in syncChanges -void MeshDataManager::addMeshData(QAbstractMeshFunctorPtr functor, const QNodeId &meshUuid) -{ - m_meshesPending[meshUuid] = functor; -} - -// Called by single thread in QRenderAspect -// Needs to be protected as we ways call it while addMeshData is called -QHash<QNodeId, QAbstractMeshFunctorPtr> MeshDataManager::meshesPending() -{ - QHash<QNodeId, QAbstractMeshFunctorPtr> meshFunctors = m_meshesPending; - m_meshesPending.clear(); - return meshFunctors; -} - -HMeshData MeshDataManager::meshDataFromFunctor(QAbstractMeshFunctorPtr functor) const -{ - QHash<QAbstractMeshFunctorPtr, HMeshData>::const_iterator it = m_meshFunctors.begin(); - const QHash<QAbstractMeshFunctorPtr, HMeshData>::const_iterator end = m_meshFunctors.end(); - - while (it != end) { - if (*it.key() == *functor) - return it.value(); - ++it; - } - return HMeshData(); -} - -void MeshDataManager::addMeshDataForFunctor(HMeshData meshDataHandle, QAbstractMeshFunctorPtr functor) -{ - m_meshFunctors.insert(functor, meshDataHandle); -} - -} // namespace Render -} // namespace Qt3D - -QT_END_NAMESPACE diff --git a/src/render/backend/meshdatamanager_p.h b/src/render/backend/meshdatamanager_p.h deleted file mode 100644 index 4c4e54a9c..000000000 --- a/src/render/backend/meshdatamanager_p.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_RENDER_MESHDATAMANAGER_H -#define QT3D_RENDER_MESHDATAMANAGER_H - -#include <Qt3DRenderer/qabstractmesh.h> -#include <Qt3DRenderer/qmeshdata.h> -#include <Qt3DRenderer/private/handle_types_p.h> - -#include <Qt3DCore/private/qresourcemanager_p.h> - -#include <QHash> -#include <QPair> -#include <QString> -#include <Qt3DCore/qnodeid.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { -namespace Render { - -class MeshDataManager : public QResourceManager<QMeshData, - QNodeId, - 16, - Qt3D::ArrayAllocatingPolicy, - Qt3D::ObjectLevelLockingPolicy> -{ -public: - MeshDataManager() {} - void addMeshData(QAbstractMeshFunctorPtr functor, const QNodeId &meshUuid); - - QHash<QNodeId, QAbstractMeshFunctorPtr> meshesPending(); - HMeshData meshDataFromFunctor(QAbstractMeshFunctorPtr functor) const; - void addMeshDataForFunctor(HMeshData meshDataHandle, QAbstractMeshFunctorPtr functor); - -private: - // List of meshes that we need to schedule jobs to load - // and calculate bounds for. - - QHash<QNodeId, QAbstractMeshFunctorPtr> m_meshesPending; - QHash<QAbstractMeshFunctorPtr, HMeshData> m_meshFunctors; -}; - -} // namespace Render -} // namespace Qt3D - -QT_END_NAMESPACE - -#endif // QT3D_RENDER_MESHDATAMANAGER_H diff --git a/src/render/backend/qrenderaspect.cpp b/src/render/backend/qrenderaspect.cpp index 1bb9e1ffc..1c68454f5 100644 --- a/src/render/backend/qrenderaspect.cpp +++ b/src/render/backend/qrenderaspect.cpp @@ -37,7 +37,6 @@ #include "qrenderaspect.h" #include "qrenderaspect_p.h" -#include <Qt3DRenderer/private/meshdatamanager_p.h> #include <Qt3DRenderer/private/texturedatamanager_p.h> #include <Qt3DRenderer/private/renderer_p.h> #include <Qt3DRenderer/private/scenemanager_p.h> @@ -71,7 +70,6 @@ #include <Qt3DRenderer/private/cameraselectornode_p.h> #include <Qt3DRenderer/private/layerfilternode_p.h> -#include <Qt3DRenderer/private/meshdatamanager_p.h> #include <Qt3DRenderer/private/renderannotation_p.h> #include <Qt3DRenderer/private/renderentity_p.h> #include <Qt3DRenderer/private/renderer_p.h> @@ -89,7 +87,6 @@ #include <Qt3DRenderer/private/renderlogging_p.h> #include <Qt3DRenderer/private/rendernodefunctor_p.h> #include <Qt3DRenderer/private/framegraphnode_p.h> -#include <Qt3DRenderer/private/loadmeshdatajob_p.h> #include <Qt3DRenderer/private/loadtexturedatajob_p.h> #include <Qt3DRenderer/private/updateboundingvolumejob_p.h> #include <Qt3DRenderer/private/updateworldtransformjob_p.h> @@ -276,14 +273,6 @@ QVector<QAspectJobPtr> QRenderAspect::jobsToExecute(qint64 time) d->m_worldTransformJob.reset(new Render::UpdateWorldTransformJob(d->m_renderer->renderSceneRoot())); d->m_boundingVolumeJob.reset(new Render::UpdateBoundingVolumeJob(d->m_renderer->renderSceneRoot())); - const QHash<QNodeId, QAbstractMeshFunctorPtr> meshSources = d->m_renderer->meshDataManager()->meshesPending(); - Q_FOREACH (const QNodeId &meshId, meshSources.keys()) { - Render::LoadMeshDataJobPtr loadMeshJob(new Render::LoadMeshDataJob(meshSources[meshId], meshId)); - loadMeshJob->setRenderer(d->m_renderer); - jobs.append(loadMeshJob); - } - - const QVector<QNodeId> texturesPending = d->m_renderer->textureDataManager()->texturesPending(); Q_FOREACH (const QNodeId &textureId, texturesPending) { Render::LoadTextureDataJobPtr loadTextureJob(new Render::LoadTextureDataJob(textureId)); diff --git a/src/render/backend/render-backend.pri b/src/render/backend/render-backend.pri index 81aecd726..0f57db809 100644 --- a/src/render/backend/render-backend.pri +++ b/src/render/backend/render-backend.pri @@ -16,7 +16,6 @@ HEADERS += \ $$PWD/rendercameralens_p.h \ $$PWD/quniformvalue_p.h \ $$PWD/rendertexture_p.h \ - $$PWD/meshdatamanager_p.h \ $$PWD/states/blendstate_p.h \ $$PWD/genericstate_p.h \ $$PWD/qgraphicshelperinterface_p.h \ @@ -72,7 +71,6 @@ SOURCES += \ $$PWD/rendercameralens.cpp \ $$PWD/quniformvalue.cpp \ $$PWD/rendertexture.cpp \ - $$PWD/meshdatamanager.cpp \ $$PWD/states/blendstate.cpp \ $$PWD/qgraphicshelpergl3.cpp \ $$PWD/qgraphicshelperes2.cpp \ diff --git a/src/render/backend/rendercommand_p.h b/src/render/backend/rendercommand_p.h index 64d714efa..9d0e2d856 100644 --- a/src/render/backend/rendercommand_p.h +++ b/src/render/backend/rendercommand_p.h @@ -40,7 +40,6 @@ #include <qglobal.h> #include <Qt3DRenderer/private/quniformvalue_p.h> -#include <Qt3DRenderer/private/qmeshdata_p.h> #include <Qt3DRenderer/private/handle_types_p.h> #include <QOpenGLShaderProgram> #include <QOpenGLTexture> diff --git a/src/render/backend/renderentity.cpp b/src/render/backend/renderentity.cpp index 3ac0e4692..11301e032 100644 --- a/src/render/backend/renderentity.cpp +++ b/src/render/backend/renderentity.cpp @@ -35,7 +35,6 @@ ****************************************************************************/ #include "renderentity_p.h" -#include <Qt3DRenderer/private/meshdatamanager_p.h> #include <Qt3DRenderer/private/managers_p.h> #include <Qt3DRenderer/private/renderer_p.h> #include <Qt3DRenderer/qabstractlight.h> @@ -93,9 +92,9 @@ void RenderEntity::cleanup() // Clear components m_transformComponent = QNodeId(); - m_meshComponent = QNodeId(); m_cameraComponent = QNodeId(); m_materialComponent = QNodeId(); + m_geometryRendererComponent = QNodeId(); m_layerComponents.clear(); m_shaderDataComponents.clear(); } @@ -141,8 +140,8 @@ void RenderEntity::updateFromPeer(QNode *peer) // TO DO: Suboptimal -> Maybe have a Hash<QComponent, QEntityList> instead m_transformComponent = QNodeId(); m_materialComponent = QNodeId(); - m_meshComponent = QNodeId(); m_cameraComponent = QNodeId(); + m_geometryRendererComponent = QNodeId(); m_layerComponents.clear(); m_shaderDataComponents.clear(); @@ -243,8 +242,6 @@ void RenderEntity::addComponent(QComponent *component) if (qobject_cast<QTransform*>(component) != Q_NULLPTR) m_transformComponent = component->id(); - else if (qobject_cast<QAbstractMesh *>(component) != Q_NULLPTR) - m_meshComponent = component->id(); else if (qobject_cast<QCameraLens *>(component) != Q_NULLPTR) m_cameraComponent = component->id(); else if (qobject_cast<QLayer *>(component) != Q_NULLPTR) @@ -261,8 +258,6 @@ void RenderEntity::removeComponent(const QNodeId &nodeId) { if (m_transformComponent == nodeId) m_transformComponent = QNodeId(); - else if (m_meshComponent == nodeId) - m_meshComponent = QNodeId(); else if (m_cameraComponent == nodeId) m_cameraComponent = QNodeId(); else if (m_layerComponents.contains(nodeId)) diff --git a/src/render/backend/renderentity_p.h b/src/render/backend/renderentity_p.h index ec0837e02..f3afa822a 100644 --- a/src/render/backend/renderentity_p.h +++ b/src/render/backend/renderentity_p.h @@ -153,7 +153,6 @@ private: // Handles to Components QNodeId m_transformComponent; - QNodeId m_meshComponent; QNodeId m_materialComponent; QNodeId m_cameraComponent; QList<QNodeId> m_layerComponents; diff --git a/src/render/backend/renderer.cpp b/src/render/backend/renderer.cpp index 9c49e00ce..b79ebbecb 100644 --- a/src/render/backend/renderer.cpp +++ b/src/render/backend/renderer.cpp @@ -53,7 +53,6 @@ #include <Qt3DRenderer/private/blendstate_p.h> #include <Qt3DRenderer/private/cameraselectornode_p.h> #include <Qt3DRenderer/private/framegraphvisitor_p.h> -#include <Qt3DRenderer/private/meshdatamanager_p.h> #include <Qt3DRenderer/private/qgraphicscontext_p.h> #include <Qt3DRenderer/private/rendercameralens_p.h> #include <Qt3DRenderer/private/rendercommand_p.h> @@ -134,7 +133,6 @@ Renderer::Renderer(QRenderAspect::RenderType type) : m_rendererAspect(Q_NULLPTR) , m_graphicsContext(Q_NULLPTR) , m_surface(Q_NULLPTR) - , m_meshDataManager(new MeshDataManager()) , m_cameraManager(new CameraManager()) , m_renderNodesManager(new EntityManager()) , m_materialManager(new MaterialManager()) diff --git a/src/render/backend/renderer_p.h b/src/render/backend/renderer_p.h index a188acfaf..0c56b06cd 100644 --- a/src/render/backend/renderer_p.h +++ b/src/render/backend/renderer_p.h @@ -85,7 +85,6 @@ class RenderMaterial; class RenderTechnique; class RenderShader; class RenderEntity; -class MeshDataManager; class RenderCommand; class CameraManager; class EntityManager; @@ -156,7 +155,6 @@ public: RenderAttribute *updateBuffersAndAttributes(RenderGeometry *geometry, RenderCommand *command, GLsizei &count, bool forceUpdate); void addAllocator(QFrameAllocator *allocator); - inline MeshDataManager *meshDataManager() const { return m_meshDataManager; } inline CameraManager *cameraManager() const { return m_cameraManager; } inline EntityManager *renderNodesManager() const { return m_renderNodesManager; } inline MaterialManager *materialManager() const { return m_materialManager; } @@ -238,7 +236,6 @@ private: QScopedPointer<QGraphicsContext> m_graphicsContext; QSurface *m_surface; - MeshDataManager *m_meshDataManager; CameraManager *m_cameraManager; EntityManager *m_renderNodesManager; MaterialManager *m_materialManager; diff --git a/src/render/backend/renderview.cpp b/src/render/backend/renderview.cpp index f3ded5bd3..5c6b8a436 100644 --- a/src/render/backend/renderview.cpp +++ b/src/render/backend/renderview.cpp @@ -44,8 +44,6 @@ #include <Qt3DRenderer/private/cameraselectornode_p.h> #include <Qt3DRenderer/private/framegraphnode_p.h> #include <Qt3DRenderer/private/layerfilternode_p.h> -#include <Qt3DRenderer/private/qmeshdata_p.h> -#include <Qt3DRenderer/private/meshdatamanager_p.h> #include <Qt3DRenderer/private/qparameter_p.h> #include <Qt3DRenderer/private/rendercameralens_p.h> #include <Qt3DRenderer/private/rendercommand_p.h> @@ -138,11 +136,11 @@ QStringList RenderView::initializeStandardAttributeNames() { QStringList attributesNames; - attributesNames << QMeshData::defaultPositionAttributeName(); - attributesNames << QMeshData::defaultTextureCoordinateAttributeName(); - attributesNames << QMeshData::defaultNormalAttributeName(); - attributesNames << QMeshData::defaultColorAttributeName(); - attributesNames << QMeshData::defaultTangentAttributeName(); + attributesNames << QAttribute::defaultPositionAttributeName(); + attributesNames << QAttribute::defaultTextureCoordinateAttributeName(); + attributesNames << QAttribute::defaultNormalAttributeName(); + attributesNames << QAttribute::defaultColorAttributeName(); + attributesNames << QAttribute::defaultTangentAttributeName(); return attributesNames; } diff --git a/src/render/frontend/qabstractmesh.cpp b/src/render/frontend/qabstractmesh.cpp deleted file mode 100644 index a8912b63e..000000000 --- a/src/render/frontend/qabstractmesh.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qabstractmesh.h" -#include "qabstractmesh_p.h" -#include <Qt3DCore/qscenepropertychange.h> - -/*! - \class Qt3D::QAbstractMeshFunctor - - \brief Encapsulates all the required data to build a mesh at any given time. - - Each Qt3D::QAbstractMesh implementation needs to provide a Qt3D::QAbstractMeshFunctor. - The functor allows the creation of meshes at runtime by the renderer. - - At runtime, mesh functors are compared so that several optimizations can take - place. When implementing the comparison operator you should use - Qt3D::QAbstractFunctor::functor_cast to check that other - Qt3D::QAbstractFunctor instances are of the same type as an alternative - to dynamic_cast. - - \note Be sure to add the QT3D_FUNCTOR macro in the public declarations - of your Qt3D::QAbstractMeshFunctor subclass so that - Qt3D::QAbstractMeshFunctor::isType can function properly. - - \sa Qt3D::QAbstractMesh - - */ - -/*! - * \class Qt3D::QAbstractMesh - * - * \brief Provides an abstract class that should be the base of all Mesh - * primitives in a scene - * - * QAbstractMesh subclasses should encapsulate vertices needed to render a - * Mesh. These should match and be packed according to what the aspect they - * live in expects. - * - * \sa QAbstractTechnique, Component - */ - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -/*! - \class Qt3D::QAbstractMeshPrivate - \internal -*/ -QAbstractMeshPrivate::QAbstractMeshPrivate() - : QComponentPrivate() -{ -} - -void QAbstractMesh::copy(const QNode *ref) -{ - QComponent::copy(ref); - const QAbstractMesh *abstractMesh = static_cast<const QAbstractMesh*>(ref); - d_func()->m_id = abstractMesh->d_func()->m_id; -} - - -QAbstractMesh::QAbstractMesh(QNode *parent) - : QComponent(*new QAbstractMeshPrivate, parent) -{ -} - -QAbstractMesh::~QAbstractMesh() -{ - Q_ASSERT_X(QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3D::QAbstractMesh subclass didn't call QNode::cleanup in its destructor"); -} - -/*! \internal */ -QAbstractMesh::QAbstractMesh(QAbstractMeshPrivate &dd, QNode *parent) - : QComponent(dd, parent) -{ -} - -void QAbstractMesh::update() -{ - Q_D(QAbstractMesh); - if (d->m_changeArbiter != Q_NULLPTR) { - QScenePropertyChangePtr change(new QScenePropertyChange(NodeUpdated, QSceneChange::Node, id())); - change->setPropertyName("meshFunctor"); - change->setValue(QVariant::fromValue(meshFunctor())); - d->notifyObservers(change); - // TO DO see if we can clear the d->m_dirty on request. - // This would allow to send a single notification for classes that have several property changes occur - // over a single given frame or maybe that's the job of the QChangeArbiter - } -} - -} // Qt3D - -QT_END_NAMESPACE diff --git a/src/render/frontend/qabstractmesh.h b/src/render/frontend/qabstractmesh.h deleted file mode 100644 index bc6207040..000000000 --- a/src/render/frontend/qabstractmesh.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_QABSTRACTMESH_H -#define QT3D_QABSTRACTMESH_H - -#include <Qt3DRenderer/qt3drenderer_global.h> -#include <Qt3DCore/qcomponent.h> -#include <Qt3DCore/qabstractfunctor.h> -#include <QSharedPointer> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -class QAbstractMeshPrivate; -class QMeshData; - -typedef QSharedPointer<QMeshData> QMeshDataPtr; - -class QT3DRENDERERSHARED_EXPORT QAbstractMeshFunctor : public QAbstractFunctor -{ -public: - virtual QMeshDataPtr operator()() = 0; - virtual bool operator ==(const QAbstractMeshFunctor &other) const = 0; - virtual ~QAbstractMeshFunctor() {} -}; - -typedef QSharedPointer<QAbstractMeshFunctor> QAbstractMeshFunctorPtr; - -class QT3DRENDERERSHARED_EXPORT QAbstractMesh : public QComponent -{ - Q_OBJECT - -public: - explicit QAbstractMesh(QNode *parent = 0); - ~QAbstractMesh(); - - void update(); - - virtual QAbstractMeshFunctorPtr meshFunctor() const = 0; - -protected: - QAbstractMesh(QAbstractMeshPrivate &dd, QNode *parent = 0); - void copy(const QNode *ref) Q_DECL_OVERRIDE; - -private: - Q_DECLARE_PRIVATE(QAbstractMesh) -}; - -} // Qt3D - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(Qt3D::QAbstractMeshFunctorPtr) - -#endif // QABSTRACTMESH_H diff --git a/src/render/frontend/qabstractmesh_p.h b/src/render/frontend/qabstractmesh_p.h deleted file mode 100644 index e960b95cb..000000000 --- a/src/render/frontend/qabstractmesh_p.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_QABSTRACTMESH_P_H -#define QT3D_QABSTRACTMESH_P_H - -#include <Qt3DRenderer/qt3drenderer_global.h> -#include <private/qcomponent_p.h> - -#include <QString> -#include <Qt3DCore/qnodeid.h> -#include <QSharedPointer> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -class QAbstractMesh; - -class QT3DRENDERERSHARED_EXPORT QAbstractMeshPrivate : public QComponentPrivate -{ -public: - QAbstractMeshPrivate(); - - Q_DECLARE_PUBLIC(QAbstractMesh) - - QNodeId m_id; -}; - -} - -QT_END_NAMESPACE - -#endif // QT3D_QABSTRACTMESH_P_H diff --git a/src/render/frontend/qitemmodelbuffer.h b/src/render/frontend/qitemmodelbuffer.h index 6e02a6e53..d33ee76c9 100644 --- a/src/render/frontend/qitemmodelbuffer.h +++ b/src/render/frontend/qitemmodelbuffer.h @@ -40,7 +40,6 @@ #include <QObject> #include <Qt3DRenderer/qt3drenderer_global.h> -#include <Qt3DRenderer/qmeshdata.h> #include <Qt3DRenderer/qbuffer.h> #include <Qt3DRenderer/qattribute.h> diff --git a/src/render/frontend/qmesh.h b/src/render/frontend/qmesh.h index d34fe1fe3..ff50a80a6 100644 --- a/src/render/frontend/qmesh.h +++ b/src/render/frontend/qmesh.h @@ -46,9 +46,7 @@ QT_BEGIN_NAMESPACE namespace Qt3D { class QMeshPrivate; -class QMeshData; -typedef QSharedPointer<QMeshData> QMeshDataPtr; /** * @brief Simple static mesh * diff --git a/src/render/frontend/qmeshv2.cpp b/src/render/frontend/qmeshv2.cpp deleted file mode 100644 index 7fbb75770..000000000 --- a/src/render/frontend/qmeshv2.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmeshv2.h" - -#include <private/qgeometryrenderer_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -class QMeshV2Private : public QGeometryRendererPrivate -{ -public: - Q_DECLARE_PUBLIC(QMeshV2) - QMeshV2Private(); - QUrl m_source; -}; - -QMeshV2Private::QMeshV2Private() - : QGeometryRendererPrivate() -{ -} - -QMeshV2::QMeshV2(QNode *parent) - : QGeometryRenderer(*new QMeshV2Private(), parent) -{ -} - -QMeshV2::~QMeshV2() -{ - QGeometryRenderer::cleanup(); -} - -QUrl QMeshV2::source() const -{ - Q_D(const QMeshV2); - return d->m_source; -} - -void QMeshV2::setSource(const QUrl &source) -{ - Q_D(QMeshV2); - if (d->m_source == source) - return; - - d->m_source = source; - emit sourceChanged(source); -} - - -void QMeshV2::copy(const QNode *ref) -{ - QGeometryRenderer::copy(ref); - const QMeshV2 *mesh = static_cast<const QMeshV2 *>(ref); - d_func()->m_source = mesh->d_func()->m_source; -} - -} - -QT_END_NAMESPACE diff --git a/src/render/frontend/qmeshv2.h b/src/render/frontend/qmeshv2.h deleted file mode 100644 index 8cad897a5..000000000 --- a/src/render/frontend/qmeshv2.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_QMESHV2_H -#define QT3D_QMESHV2_H - -#include <Qt3DRenderer/qt3drenderer_global.h> -#include <Qt3DRenderer/qgeometryrenderer.h> -#include <QUrl> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -class QMeshV2Private; - -class QT3DRENDERERSHARED_EXPORT QMeshV2 : public QGeometryRenderer -{ - Q_OBJECT - Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) - -public: - QMeshV2(QNode *parent = 0); - ~QMeshV2(); - - QUrl source() const; - void setSource(const QUrl &arg); - - // FIXME now this is an attribute provider directly. but we still do want - // a functor factory for loading the mesh data to load it in a aspect's job? - // so when THAT happens, how is the loaded mesh data connected to this class? - - // should this class have something like - // * the usual mesh functor to create mesh data - // * a protected/private "setMeshData" that sets back the mesh data - // * and attributes() reading from that mesh data? - -Q_SIGNALS: - void sourceChanged(const QUrl &arg); - -protected: - void copy(const QNode *ref) Q_DECL_OVERRIDE; - -private: - Q_DISABLE_COPY(QMeshV2) - Q_DECLARE_PRIVATE(QMeshV2) - QT3D_CLONEABLE(QMeshV2) -}; - -} - -QT_END_NAMESPACE - -#endif // QT3D_QMESHV2_H diff --git a/src/render/frontend/qplanemesh.cpp b/src/render/frontend/qplanemesh.cpp index 9b37bd357..569a8ffed 100644 --- a/src/render/frontend/qplanemesh.cpp +++ b/src/render/frontend/qplanemesh.cpp @@ -39,7 +39,6 @@ #include <Qt3DRenderer/qattribute.h> #include <Qt3DRenderer/qbuffer.h> #include <Qt3DRenderer/qbufferfunctor.h> -#include <Qt3DRenderer/qmeshdata.h> #include <Qt3DRenderer/private/renderlogging_p.h> #include <Qt3DRenderer/qgeometry.h> #include <limits> diff --git a/src/render/frontend/render-frontend.pri b/src/render/frontend/render-frontend.pri index dc6a62b08..0204ed91b 100644 --- a/src/render/frontend/render-frontend.pri +++ b/src/render/frontend/render-frontend.pri @@ -58,8 +58,6 @@ HEADERS += \ $$PWD/qalphacoverage.h \ $$PWD/qannotation.h \ $$PWD/qannotation_p.h \ - $$PWD/qabstractmesh_p.h \ - $$PWD/qabstractmesh.h \ $$PWD/qparametermapping_p.h \ $$PWD/qparametermapping.h \ $$PWD/qshaderdata.h \ @@ -80,7 +78,6 @@ HEADERS += \ $$PWD/qstencilmask.h \ $$PWD/qgeometryrenderer.h \ $$PWD/qgeometry.h \ - $$PWD/qmeshv2.h \ $$PWD/qgeometryrenderer_p.h \ $$PWD/qwindow.h \ $$PWD/qwindow_p.h @@ -123,7 +120,6 @@ SOURCES += \ $$PWD/qrendertarget.cpp \ $$PWD/qalphacoverage.cpp \ $$PWD/qannotation.cpp \ - $$PWD/qabstractmesh.cpp \ $$PWD/qparametermapping.cpp \ $$PWD/qshaderdata.cpp \ $$PWD/qpolygonoffset.cpp \ @@ -140,5 +136,4 @@ SOURCES += \ $$PWD/qstencilmask.cpp \ $$PWD/qgeometryrenderer.cpp \ $$PWD/qgeometry.cpp \ - $$PWD/qmeshv2.cpp \ $$PWD/qwindow.cpp diff --git a/src/render/io/qmeshdata.cpp b/src/render/io/qmeshdata.cpp deleted file mode 100644 index 0a689257f..000000000 --- a/src/render/io/qmeshdata.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmeshdata.h" -#include "qmeshdata_p.h" -#include <Qt3DCore/qabstractattribute.h> -#include <Qt3DCore/qabstractbuffer.h> -#include <QOpenGLVertexArrayObject> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -/*! - \class Qt3D::QMeshDataPrivate - \internal -*/ -QMeshDataPrivate::QMeshDataPrivate() - : m_indexAttr(Q_NULLPTR) - , m_verticesPerPatch(0) - , m_primitiveType(0) -{ -} - -QMeshDataPrivate::~QMeshDataPrivate() -{ - delete m_indexAttr; - qDeleteAll(m_attributes); -} - -QMeshData::QMeshData(PrimitiveType primitiveType) - : d_ptr(new QMeshDataPrivate) -{ - setPrimitiveType(primitiveType); -} - -QMeshData::~QMeshData() -{ -// delete d_ptr; -} - -// TO DO: Be careful is QMeshData is copied to not leak memory - -/*! \internal */ -QMeshData::QMeshData(QMeshDataPrivate &dd) - : d_ptr(&dd) -{ -} - -void QMeshData::addAttribute(const QString &name, QAbstractAttribute *attr) -{ - Q_D(QMeshData); - const int i = d->m_attributesNames.indexOf(name); - if (i != -1) { - d->m_attributes[i] = attr; - } else { - d->m_attributesNames.append(name); - d->m_attributes.append(attr); - } -} - -void QMeshData::setIndexAttribute(QAbstractAttribute *attr) -{ - Q_D(QMeshData); - d->m_indexAttr = attr; -} - -QStringList QMeshData::attributeNames() const -{ - Q_D(const QMeshData); - return d->m_attributesNames; -} - -QAbstractAttribute *QMeshData::attributeByName(const QString &name) const -{ - Q_D(const QMeshData); - const int i = d->m_attributesNames.indexOf(name); - if (i != -1) - return d->m_attributes[i]; - else - return Q_NULLPTR; -} - -QAbstractAttribute *QMeshData::indexAttribute() const -{ - Q_D(const QMeshData); - return d->m_indexAttr; -} - -QString QMeshData::defaultPositionAttributeName() -{ - return QStringLiteral("vertexPosition"); -} - -QString QMeshData::defaultNormalAttributeName() -{ - return QStringLiteral("vertexNormal"); -} - -QString QMeshData::defaultColorAttributeName() -{ - return QStringLiteral("vertexColor"); -} - -QString QMeshData::defaultTextureCoordinateAttributeName() -{ - return QStringLiteral("vertexTexCoord"); -} - -QString QMeshData::defaultTangentAttributeName() -{ - return QStringLiteral("vertexTangent"); -} - -void QMeshData::setVerticesPerPatch(int verticesPerPatch) -{ - Q_D(QMeshData); - d->m_verticesPerPatch = verticesPerPatch; -} - -int QMeshData::verticesPerPatch() const -{ - Q_D(const QMeshData); - return d->m_verticesPerPatch; -} - -int QMeshData::primitiveCount() const -{ - Q_D(const QMeshData); - if (d->m_indexAttr) { - return d->m_indexAttr->count(); - } else { - // assume all attribute arrays have the same size - // will break with instanced drawing, but probably per-instance - // arrays aren't coming from this code-path. - // Maybe. - return d->m_attributes.first()->count(); - } -} - -QVector<QAbstractBuffer *> QMeshData::buffers() const -{ - Q_D(const QMeshData); - QVector<QAbstractBuffer*> r; - r.reserve(d->m_attributes.count() + 1); - if (d->m_indexAttr) - r.push_back(d->m_indexAttr->buffer()); - Q_FOREACH (QAbstractAttribute *attr, d->m_attributes) - r.push_back(attr->buffer()); - - return r; -} - -void QMeshData::setBoundingBox(const QAxisAlignedBoundingBox &bbox) -{ - Q_D(QMeshData); - d->m_bbox = bbox; -} - -void QMeshData::computeBoundsFromAttribute(const QString &name) -{ - Q_D(QMeshData); - QAbstractAttribute *attr = attributeByName(name); - if (!attr) { - qWarning() << Q_FUNC_INFO << "unknown attribute:" << name; - return; - } - d->m_bbox.clear(); - d->m_bbox.update(attr->asVector3D()); -} - -QAxisAlignedBoundingBox QMeshData::boundingBox() const -{ - Q_D(const QMeshData); - return d->m_bbox; -} - -void QMeshData::setPrimitiveType(PrimitiveType primitiveType) -{ - Q_D(QMeshData); - d->m_primitiveType = primitiveType; -} - -int QMeshData::primitiveType() const -{ - Q_D(const QMeshData); - return d->m_primitiveType; -} - -} // Qt3D - -QT_END_NAMESPACE diff --git a/src/render/io/qmeshdata.h b/src/render/io/qmeshdata.h deleted file mode 100644 index 23116ec7e..000000000 --- a/src/render/io/qmeshdata.h +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_QMESHDATA_H -#define QT3D_QMESHDATA_H - -#include <Qt3DRenderer/qt3drenderer_global.h> -#include <Qt3DCore/qaxisalignedboundingbox.h> -#include <QSharedPointer> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -class QAbstractAttribute; -class QAbstractBuffer; -class QMeshDataPrivate; - -class QT3DRENDERERSHARED_EXPORT QMeshData -{ -public: - enum PrimitiveType { - Points = 0x0000, - Lines = 0x0001, - LineLoop = 0x0002, - LineStrip = 0x0003, - Triangles = 0x0004, - TriangleStrip = 0x0005, - TriangleFan = 0x0006, - LinesAdjacency = 0x000A, - TrianglesAdjacency = 0x000C, - LineStripAdjacency = 0x000B, - TriangleStripAdjacency = 0x000D, - Patches = 0x000E - }; - - explicit QMeshData(PrimitiveType primitiveType = Triangles); - virtual ~QMeshData(); - - void addAttribute(const QString &name, QAbstractAttribute *attr); - void setIndexAttribute(QAbstractAttribute *attr); - - QStringList attributeNames() const; - QAbstractAttribute *attributeByName(const QString &name) const; - QAbstractAttribute *indexAttribute() const; - - static QString defaultPositionAttributeName(); - static QString defaultNormalAttributeName(); - static QString defaultColorAttributeName(); - static QString defaultTextureCoordinateAttributeName(); - static QString defaultTangentAttributeName(); - - void setPrimitiveType(PrimitiveType primitiveType); - int primitiveType() const; - - void setVerticesPerPatch(int verticesPerPatch); - int verticesPerPatch() const; - - int primitiveCount() const; - - QVector<QAbstractBuffer *> buffers() const; - - void setBoundingBox(const QAxisAlignedBoundingBox &bbox); - void computeBoundsFromAttribute(const QString &name); - - QAxisAlignedBoundingBox boundingBox() const; - -protected: - Q_DECLARE_PRIVATE(QMeshData) - QMeshDataPrivate *d_ptr; - QMeshData(QMeshDataPrivate &dd); -}; - -typedef QSharedPointer<QMeshData> QMeshDataPtr; - -} // Qt3D - -QT_END_NAMESPACE - -#endif // QT3D_QMESHDATA_H diff --git a/src/render/io/qmeshdata_p.h b/src/render/io/qmeshdata_p.h deleted file mode 100644 index c1722396d..000000000 --- a/src/render/io/qmeshdata_p.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_QMESHDATA_P_H -#define QT3D_QMESHDATA_P_H - -#include <Qt3DCore/qt3dcore_global.h> -#include <Qt3DCore/qaxisalignedboundingbox.h> - -#include <QMap> -#include <QSharedPointer> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -class QAbstractAttribute; -class QAbstractBuffer; - -typedef QSharedPointer<QAbstractAttribute> QAbstractAttributePtr; - -class QMeshDataPrivate -{ -public: - QMeshDataPrivate(); - ~QMeshDataPrivate(); - - QStringList m_attributesNames; - QVector<QAbstractAttribute *> m_attributes; - QAbstractAttribute *m_indexAttr; - QAxisAlignedBoundingBox m_bbox; - int m_verticesPerPatch; - int m_primitiveType; -}; - -} // Qt3D - -QT_END_NAMESPACE - -#endif // QT3D_QMESHDATA_P_H diff --git a/src/render/io/render-io.pri b/src/render/io/render-io.pri index 6ac63d9c5..ababc3cd0 100644 --- a/src/render/io/render-io.pri +++ b/src/render/io/render-io.pri @@ -8,8 +8,6 @@ HEADERS += \ $$PWD/qattribute_p.h \ $$PWD/qbuffer.h \ $$PWD/qbuffer_p.h \ - $$PWD/qmeshdata_p.h \ - $$PWD/qmeshdata.h \ $$PWD/uniformbuffer_p.h \ $$PWD/qbufferfunctor.h \ $$PWD/qgeometryfunctor.h @@ -20,5 +18,4 @@ SOURCES += \ $$PWD/abstractsceneparser.cpp \ $$PWD/qattribute.cpp \ $$PWD/qbuffer.cpp \ - $$PWD/qmeshdata.cpp \ $$PWD/uniformbuffer.cpp diff --git a/tests/auto/render/meshfunctors/tst_meshfunctors.cpp b/tests/auto/render/meshfunctors/tst_meshfunctors.cpp index 702449a9f..a7d0f91a7 100644 --- a/tests/auto/render/meshfunctors/tst_meshfunctors.cpp +++ b/tests/auto/render/meshfunctors/tst_meshfunctors.cpp @@ -35,9 +35,10 @@ ****************************************************************************/ #include <QtTest/QtTest> -#include <Qt3DRenderer/QAbstractMesh> +#include <Qt3DRenderer/qgeometryfunctor.h> +#include <Qt3DRenderer/qgeometry.h> -class MeshFunctorA : public Qt3D::QAbstractMeshFunctor +class MeshFunctorA : public Qt3D::QGeometryFunctor { public: MeshFunctorA() @@ -46,12 +47,12 @@ public: ~MeshFunctorA() {} - Qt3D::QMeshDataPtr operator ()() Q_DECL_OVERRIDE + Qt3D::QGeometry *operator ()() Q_DECL_OVERRIDE { - return Qt3D::QMeshDataPtr(); + return Q_NULLPTR; } - bool operator ==(const Qt3D::QAbstractMeshFunctor &other) const Q_DECL_OVERRIDE + bool operator ==(const Qt3D::QGeometryFunctor &other) const Q_DECL_OVERRIDE { return functor_cast<MeshFunctorA>(&other); } @@ -59,7 +60,7 @@ public: QT3D_FUNCTOR(MeshFunctorA) }; -class MeshFunctorB : public Qt3D::QAbstractMeshFunctor +class MeshFunctorB : public Qt3D::QGeometryFunctor { public: MeshFunctorB() @@ -68,12 +69,12 @@ public: ~MeshFunctorB() {} - Qt3D::QMeshDataPtr operator ()() Q_DECL_OVERRIDE + Qt3D::QGeometry *operator ()() Q_DECL_OVERRIDE { - return Qt3D::QMeshDataPtr(); + return Q_NULLPTR; } - bool operator ==(const Qt3D::QAbstractMeshFunctor &other) const Q_DECL_OVERRIDE + bool operator ==(const Qt3D::QGeometryFunctor &other) const Q_DECL_OVERRIDE { return functor_cast<MeshFunctorB>(&other); } @@ -90,7 +91,7 @@ public: ~MeshFunctorASub() {} - bool operator ==(const Qt3D::QAbstractMeshFunctor &other) const Q_DECL_OVERRIDE + bool operator ==(const Qt3D::QGeometryFunctor &other) const Q_DECL_OVERRIDE { return functor_cast<MeshFunctorASub>(&other); } |