diff options
Diffstat (limited to 'src/render/frontend')
-rw-r--r-- | src/render/frontend/qabstractmesh.cpp | 102 | ||||
-rw-r--r-- | src/render/frontend/qabstractmesh.h | 94 | ||||
-rw-r--r-- | src/render/frontend/qabstractmesh_p.h | 72 | ||||
-rw-r--r-- | src/render/frontend/qcuboidmesh.cpp | 12 | ||||
-rw-r--r-- | src/render/frontend/qcuboidmesh.h | 2 | ||||
-rw-r--r-- | src/render/frontend/qcuboidmesh_p.h | 2 | ||||
-rw-r--r-- | src/render/frontend/qcylindermesh.cpp | 20 | ||||
-rw-r--r-- | src/render/frontend/qcylindermesh.h | 2 | ||||
-rw-r--r-- | src/render/frontend/qmesh.cpp | 4 | ||||
-rw-r--r-- | src/render/frontend/qmesh.h | 6 | ||||
-rw-r--r-- | src/render/frontend/qplanemesh.cpp | 12 | ||||
-rw-r--r-- | src/render/frontend/qplanemesh.h | 2 | ||||
-rw-r--r-- | src/render/frontend/qplanemesh_p.h | 9 | ||||
-rw-r--r-- | src/render/frontend/qspheremesh.cpp | 14 | ||||
-rw-r--r-- | src/render/frontend/qspheremesh.h | 2 | ||||
-rw-r--r-- | src/render/frontend/qtorusmesh.cpp | 18 | ||||
-rw-r--r-- | src/render/frontend/qtorusmesh.h | 2 | ||||
-rw-r--r-- | src/render/frontend/render-frontend.pri | 7 |
18 files changed, 326 insertions, 56 deletions
diff --git a/src/render/frontend/qabstractmesh.cpp b/src/render/frontend/qabstractmesh.cpp new file mode 100644 index 000000000..81f811515 --- /dev/null +++ b/src/render/frontend/qabstractmesh.cpp @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** 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:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qabstractmesh.h" +#include "qabstractmesh_p.h" +#include <Qt3DCore/qscenepropertychange.h> + +/*! + * \class QAbstractMesh + * \namespace Qt3D + * + * \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 { + +QAbstractMeshPrivate::QAbstractMeshPrivate(QAbstractMesh *qq) + : QComponentPrivate(qq) +{ +} + +void QAbstractMesh::copy(const QNode *ref) +{ + QComponent::copy(ref); + const QAbstractMesh *abstractMesh = static_cast<const QAbstractMesh*>(ref); + d_func()->m_uuid = abstractMesh->d_func()->m_uuid; +} + + +QAbstractMesh::QAbstractMesh(QNode *parent) + : QComponent(*new QAbstractMeshPrivate(this), parent) +{ +} + +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, this)); + change->setPropertyName(QByteArrayLiteral("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 new file mode 100644 index 000000000..ff0ea8ad0 --- /dev/null +++ b/src/render/frontend/qabstractmesh.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** 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:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3D_QABSTRACTMESH_H +#define QT3D_QABSTRACTMESH_H + +#include <Qt3DRenderer/qt3drenderer_global.h> +#include <Qt3DCore/qcomponent.h> +#include <QSharedPointer> +#include <QUuid> + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +class QAbstractMeshPrivate; +class QMeshData; + +typedef QSharedPointer<QMeshData> QMeshDataPtr; + +class QT3DRENDERERSHARED_EXPORT QAbstractMeshFunctor +{ +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: + QAbstractMesh(QNode *parent = 0); + + 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 new file mode 100644 index 000000000..78e220356 --- /dev/null +++ b/src/render/frontend/qabstractmesh_p.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** 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:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.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 <QUuid> +#include <QSharedPointer> + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +class QAbstractMesh; + +class QT3DRENDERERSHARED_EXPORT QAbstractMeshPrivate : public QComponentPrivate +{ +public: + QAbstractMeshPrivate(QAbstractMesh *qq); + + Q_DECLARE_PUBLIC(QAbstractMesh) + + QUuid m_uuid; +}; + +} + +QT_END_NAMESPACE + +#endif // QT3D_QABSTRACTMESH_P_H diff --git a/src/render/frontend/qcuboidmesh.cpp b/src/render/frontend/qcuboidmesh.cpp index d41448d58..03fefef5a 100644 --- a/src/render/frontend/qcuboidmesh.cpp +++ b/src/render/frontend/qcuboidmesh.cpp @@ -203,7 +203,7 @@ public: { } - QAbstractMeshDataPtr operator ()() Q_DECL_OVERRIDE + QMeshDataPtr operator ()() Q_DECL_OVERRIDE { return createCuboidMesh(m_xExtent, m_yExtent, m_zExtent, m_yzFaceResolution, @@ -498,24 +498,24 @@ QMeshDataPtr createCuboidMesh(float xExtent, QMeshDataPtr mesh(new QMeshData(GL_TRIANGLES)); quint32 offset = 0; - mesh->addAttribute(QAbstractMeshData::defaultPositionAttributeName(), + mesh->addAttribute(QMeshData::defaultPositionAttributeName(), AttributePtr(new Attribute(vertexBuffer, GL_FLOAT_VEC3, nVerts, offset, stride))); offset += 3 * sizeof(float); - mesh->addAttribute(QAbstractMeshData::defaultTextureCoordinateAttributeName(), + mesh->addAttribute(QMeshData::defaultTextureCoordinateAttributeName(), AttributePtr(new Attribute(vertexBuffer, GL_FLOAT_VEC2, nVerts, offset, stride))); offset += 2 * sizeof(float); - mesh->addAttribute(QAbstractMeshData::defaultNormalAttributeName(), + mesh->addAttribute(QMeshData::defaultNormalAttributeName(), AttributePtr(new Attribute(vertexBuffer, GL_FLOAT_VEC3, nVerts, offset, stride))); offset += 3 * sizeof(float); - mesh->addAttribute(QAbstractMeshData::defaultTangentAttributeName(), + mesh->addAttribute(QMeshData::defaultTangentAttributeName(), AttributePtr(new Attribute(vertexBuffer, GL_FLOAT_VEC4, nVerts, offset, stride))); mesh->setIndexAttribute(AttributePtr(new Attribute(indexBuffer, GL_UNSIGNED_SHORT, indexCount, 0, 0))); - mesh->computeBoundsFromAttribute(QAbstractMeshData::defaultPositionAttributeName()); + mesh->computeBoundsFromAttribute(QMeshData::defaultPositionAttributeName()); qCDebug(Render::Frontend) << "computed axis-aligned bounding box is:" << mesh->boundingBox(); return mesh; diff --git a/src/render/frontend/qcuboidmesh.h b/src/render/frontend/qcuboidmesh.h index f38cfe116..ae4189c68 100644 --- a/src/render/frontend/qcuboidmesh.h +++ b/src/render/frontend/qcuboidmesh.h @@ -43,7 +43,7 @@ #define QT3D_CUBOIDMESH_H #include <Qt3DRenderer/qt3drenderer_global.h> -#include <Qt3DCore/qabstractmesh.h> +#include <Qt3DRenderer/qabstractmesh.h> #include <QSize> QT_BEGIN_NAMESPACE diff --git a/src/render/frontend/qcuboidmesh_p.h b/src/render/frontend/qcuboidmesh_p.h index 968515c7b..c44a4215d 100644 --- a/src/render/frontend/qcuboidmesh_p.h +++ b/src/render/frontend/qcuboidmesh_p.h @@ -42,7 +42,7 @@ #ifndef QCUBOIDMESH_P_H #define QCUBOIDMESH_P_H -#include <Qt3DCore/private/qabstractmesh_p.h> +#include <Qt3DRenderer/private/qabstractmesh_p.h> #include <QtCore/qsize.h> diff --git a/src/render/frontend/qcylindermesh.cpp b/src/render/frontend/qcylindermesh.cpp index 9fd1ce71a..dc5240a3e 100644 --- a/src/render/frontend/qcylindermesh.cpp +++ b/src/render/frontend/qcylindermesh.cpp @@ -48,7 +48,7 @@ #include "qbuffer.h" #include "qattribute.h" #include "qmeshdata.h" -#include <Qt3DCore/private/qabstractmesh_p.h> +#include <Qt3DRenderer/private/qabstractmesh_p.h> #include <cmath> @@ -60,7 +60,7 @@ class CylinderMeshFunctor : public QAbstractMeshFunctor { public: CylinderMeshFunctor(int rings, int slices, float radius, float length); - QAbstractMeshDataPtr operator ()() Q_DECL_OVERRIDE; + QMeshDataPtr operator ()() Q_DECL_OVERRIDE; bool operator ==(const QAbstractMeshFunctor &other) const; private: @@ -169,26 +169,26 @@ float QCylinderMesh::length() const return d->m_length; } -QAbstractMeshDataPtr assembleMesh(const QByteArray &verticesBytes, quint32 vertexSize, int verticesCount, +QMeshDataPtr assembleMesh(const QByteArray &verticesBytes, quint32 vertexSize, int verticesCount, const QByteArray &indicesBytes, int indicesCount) { - QAbstractMeshDataPtr mesh(new QMeshData(GL_TRIANGLES)); + QMeshDataPtr mesh(new QMeshData(GL_TRIANGLES)); BufferPtr verticesBuffer(new Buffer(QOpenGLBuffer::VertexBuffer)); verticesBuffer->setUsage(QOpenGLBuffer::StaticDraw); verticesBuffer->setData(verticesBytes); - mesh->addAttribute(QAbstractMeshData::defaultPositionAttributeName(), + mesh->addAttribute(QMeshData::defaultPositionAttributeName(), QAbstractAttributePtr(new Attribute(verticesBuffer, GL_FLOAT_VEC3, verticesCount, 0, vertexSize))); quint32 offset = sizeof(float) * 3; - mesh->addAttribute(QAbstractMeshData::defaultTextureCoordinateAttributeName(), + mesh->addAttribute(QMeshData::defaultTextureCoordinateAttributeName(), QAbstractAttributePtr(new Attribute(verticesBuffer, GL_FLOAT_VEC2, verticesCount, offset, vertexSize))); offset += sizeof(float) * 2; - mesh->addAttribute(QAbstractMeshData::defaultNormalAttributeName(), + mesh->addAttribute(QMeshData::defaultNormalAttributeName(), QAbstractAttributePtr(new Attribute(verticesBuffer, GL_FLOAT_VEC3, verticesCount, offset, vertexSize))); offset += sizeof(float) * 3; @@ -198,7 +198,7 @@ QAbstractMeshDataPtr assembleMesh(const QByteArray &verticesBytes, quint32 verte indicesBuffer->setData(indicesBytes); mesh->setIndexAttribute(AttributePtr(new Attribute(indicesBuffer, GL_UNSIGNED_SHORT, indicesCount, 0, 0))); - mesh->computeBoundsFromAttribute(QAbstractMeshData::defaultPositionAttributeName()); + mesh->computeBoundsFromAttribute(QMeshData::defaultPositionAttributeName()); return mesh; } @@ -297,7 +297,7 @@ void createDisc(float *&verticesPtr, quint16 *&indicesPtr, } } -QAbstractMeshDataPtr createCylinderMesh(double radius, double length, +QMeshDataPtr createCylinderMesh(double radius, double length, int rings, int slices) { const int verticesCount = (slices + 1) * rings + 2 * (slices + 1) + 2; @@ -342,7 +342,7 @@ CylinderMeshFunctor::CylinderMeshFunctor(int rings, int slices, float radius, fl { } -QAbstractMeshDataPtr CylinderMeshFunctor::operator ()() +QMeshDataPtr CylinderMeshFunctor::operator ()() { return createCylinderMesh(m_radius, m_length, m_rings, m_slices); } diff --git a/src/render/frontend/qcylindermesh.h b/src/render/frontend/qcylindermesh.h index 05bf3ac81..57d9c2fec 100644 --- a/src/render/frontend/qcylindermesh.h +++ b/src/render/frontend/qcylindermesh.h @@ -43,7 +43,7 @@ #define QT3D_QCYLINDERMESH_H #include <Qt3DRenderer/qt3drenderer_global.h> -#include <Qt3DCore/qabstractmesh.h> +#include <Qt3DRenderer/qabstractmesh.h> QT_BEGIN_NAMESPACE diff --git a/src/render/frontend/qmesh.cpp b/src/render/frontend/qmesh.cpp index e4e5b54d8..d48a70089 100644 --- a/src/render/frontend/qmesh.cpp +++ b/src/render/frontend/qmesh.cpp @@ -59,7 +59,7 @@ class MeshFunctor : public QAbstractMeshFunctor { public : MeshFunctor(const QString &sourcePath); - QAbstractMeshDataPtr operator()() Q_DECL_OVERRIDE; + QMeshDataPtr operator()() Q_DECL_OVERRIDE; bool operator ==(const QAbstractMeshFunctor &other) const Q_DECL_OVERRIDE; private: @@ -117,7 +117,7 @@ MeshFunctor::MeshFunctor(const QString &sourcePath) { } -QAbstractMeshDataPtr MeshFunctor::operator()() +QMeshDataPtr MeshFunctor::operator()() { if (m_sourcePath.isEmpty()) { qCWarning(Render::Jobs) << Q_FUNC_INFO << "Mesh is empty, nothing to load"; diff --git a/src/render/frontend/qmesh.h b/src/render/frontend/qmesh.h index d69bb360d..3aa8d43d6 100644 --- a/src/render/frontend/qmesh.h +++ b/src/render/frontend/qmesh.h @@ -42,7 +42,7 @@ #ifndef QT3D_QMESH_H #define QT3D_QMESH_H -#include <Qt3DCore/qabstractmesh.h> +#include <Qt3DRenderer/qabstractmesh.h> #include <Qt3DRenderer/qt3drenderer_global.h> #include <Qt3DRenderer/qmeshdata.h> @@ -51,9 +51,9 @@ QT_BEGIN_NAMESPACE namespace Qt3D { class QMeshPrivate; -class QAbstractMeshData; +class QMeshData; -typedef QSharedPointer<QAbstractMeshData> QAbstractMeshDataPtr; +typedef QSharedPointer<QMeshData> QMeshDataPtr; /** * @brief Simple static mesh * diff --git a/src/render/frontend/qplanemesh.cpp b/src/render/frontend/qplanemesh.cpp index 69aa69ab0..ad473421f 100644 --- a/src/render/frontend/qplanemesh.cpp +++ b/src/render/frontend/qplanemesh.cpp @@ -141,7 +141,7 @@ public: { } - QAbstractMeshDataPtr operator ()() Q_DECL_OVERRIDE + QMeshDataPtr operator ()() Q_DECL_OVERRIDE { return createPlaneMesh(m_width, m_height, m_meshResolution); } @@ -226,19 +226,19 @@ QMeshDataPtr createPlaneMesh(float w, float h, const QSize &resolution) // Create the mesh data, specify the vertex format and data QMeshDataPtr mesh(new QMeshData(GL_TRIANGLES)); quint32 offset = 0; - mesh->addAttribute(QAbstractMeshData::defaultPositionAttributeName(), + mesh->addAttribute(QMeshData::defaultPositionAttributeName(), AttributePtr(new Attribute(buf, GL_FLOAT_VEC3, nVerts, offset, stride))); offset += 3 * sizeof(float); - mesh->addAttribute(QAbstractMeshData::defaultTextureCoordinateAttributeName(), + mesh->addAttribute(QMeshData::defaultTextureCoordinateAttributeName(), AttributePtr(new Attribute(buf, GL_FLOAT_VEC2, nVerts, offset, stride))); offset += 2 * sizeof(float); - mesh->addAttribute(QAbstractMeshData::defaultNormalAttributeName(), + mesh->addAttribute(QMeshData::defaultNormalAttributeName(), AttributePtr(new Attribute(buf, GL_FLOAT_VEC3, nVerts, offset, stride))); offset += 3 * sizeof(float); - mesh->addAttribute(QAbstractMeshData::defaultTangentAttributeName(), + mesh->addAttribute(QMeshData::defaultTangentAttributeName(), AttributePtr(new Attribute(buf, GL_FLOAT_VEC4, nVerts, offset, stride))); // Create the index data. 2 triangles per rectangular face @@ -275,7 +275,7 @@ QMeshDataPtr createPlaneMesh(float w, float h, const QSize &resolution) // Specify index data on the mesh mesh->setIndexAttribute(AttributePtr(new Attribute(indexBuffer, GL_UNSIGNED_SHORT, indices, 0, 0))); - mesh->computeBoundsFromAttribute(QAbstractMeshData::defaultPositionAttributeName()); + mesh->computeBoundsFromAttribute(QMeshData::defaultPositionAttributeName()); qCDebug(Render::Frontend) << "computed axis-aligned bounding box is:" << mesh->boundingBox(); return mesh; diff --git a/src/render/frontend/qplanemesh.h b/src/render/frontend/qplanemesh.h index f3e49d0e8..5e83a1286 100644 --- a/src/render/frontend/qplanemesh.h +++ b/src/render/frontend/qplanemesh.h @@ -43,7 +43,7 @@ #define QT3D_QPLANEMESH_H #include <Qt3DRenderer/qt3drenderer_global.h> -#include <Qt3DCore/qabstractmesh.h> +#include <Qt3DRenderer/qabstractmesh.h> #include <QSize> QT_BEGIN_NAMESPACE diff --git a/src/render/frontend/qplanemesh_p.h b/src/render/frontend/qplanemesh_p.h index 421bb1edd..42ce2e8e7 100644 --- a/src/render/frontend/qplanemesh_p.h +++ b/src/render/frontend/qplanemesh_p.h @@ -39,11 +39,10 @@ ** ****************************************************************************/ -#ifndef QPLANEMESH_P_H -#define QPLANEMESH_P_H - -#include <Qt3DCore/private/qabstractmesh_p.h> +#ifndef QT3D_QPLANEMESH_P_H +#define QT3D_QPLANEMESH_P_H +#include <private/qabstractmesh_p.h> #include <QtCore/qsize.h> QT_BEGIN_NAMESPACE @@ -68,4 +67,4 @@ public: QT_END_NAMESPACE -#endif // QPLANEMESH_P_H +#endif // QT3D_QPLANEMESH_P_H diff --git a/src/render/frontend/qspheremesh.cpp b/src/render/frontend/qspheremesh.cpp index 4cf35c2b1..bb0a3f9ce 100644 --- a/src/render/frontend/qspheremesh.cpp +++ b/src/render/frontend/qspheremesh.cpp @@ -61,7 +61,7 @@ class SphereMeshFunctor : public QAbstractMeshFunctor { public: SphereMeshFunctor(int rings, int slices, float radius, bool generateTangents); - QAbstractMeshDataPtr operator ()() Q_DECL_OVERRIDE; + QMeshDataPtr operator ()() Q_DECL_OVERRIDE; bool operator ==(const QAbstractMeshFunctor &other) const Q_DECL_OVERRIDE; private: @@ -232,17 +232,17 @@ QMeshDataPtr createSphereMesh(double radius, int rings, int slices, bool hasTang buf->setUsage(QOpenGLBuffer::StaticDraw); buf->setData(bufferBytes); - mesh->addAttribute(QAbstractMeshData::defaultPositionAttributeName(), AttributePtr(new Attribute(buf, GL_FLOAT_VEC3, nVerts, 0, stride))); + mesh->addAttribute(QMeshData::defaultPositionAttributeName(), AttributePtr(new Attribute(buf, GL_FLOAT_VEC3, nVerts, 0, stride))); quint32 offset = sizeof(float) * 3; - mesh->addAttribute(QAbstractMeshData::defaultTextureCoordinateAttributeName(), AttributePtr(new Attribute(buf, GL_FLOAT_VEC2, nVerts, offset, stride))); + mesh->addAttribute(QMeshData::defaultTextureCoordinateAttributeName(), AttributePtr(new Attribute(buf, GL_FLOAT_VEC2, nVerts, offset, stride))); offset += sizeof(float) * 2; - mesh->addAttribute(QAbstractMeshData::defaultNormalAttributeName(), AttributePtr(new Attribute(buf, GL_FLOAT_VEC3, nVerts, offset, stride))); + mesh->addAttribute(QMeshData::defaultNormalAttributeName(), AttributePtr(new Attribute(buf, GL_FLOAT_VEC3, nVerts, offset, stride))); offset += sizeof(float) * 3; if (hasTangents) { - mesh->addAttribute(QAbstractMeshData::defaultTangentAttributeName(), AttributePtr(new Attribute(buf, GL_FLOAT_VEC4, nVerts, offset, stride))); + mesh->addAttribute(QMeshData::defaultTangentAttributeName(), AttributePtr(new Attribute(buf, GL_FLOAT_VEC4, nVerts, offset, stride))); offset += sizeof(float) * 4; } @@ -300,7 +300,7 @@ QMeshDataPtr createSphereMesh(double radius, int rings, int slices, bool hasTang indexBuffer->setData(indexBytes); mesh->setIndexAttribute(AttributePtr(new Attribute(indexBuffer, GL_UNSIGNED_SHORT, indices, 0, 0))); - mesh->computeBoundsFromAttribute(QAbstractMeshData::defaultPositionAttributeName()); + mesh->computeBoundsFromAttribute(QMeshData::defaultPositionAttributeName()); qCDebug(Render::Frontend) << "computed sphere bounds is:" << mesh->boundingBox(); return mesh; @@ -315,7 +315,7 @@ SphereMeshFunctor::SphereMeshFunctor(int rings, int slices, float radius, bool g { } -QAbstractMeshDataPtr SphereMeshFunctor::operator ()() +QMeshDataPtr SphereMeshFunctor::operator ()() { return createSphereMesh(m_radius, m_rings, m_slices, m_generateTangents); } diff --git a/src/render/frontend/qspheremesh.h b/src/render/frontend/qspheremesh.h index 2b0115b5c..812b795f8 100644 --- a/src/render/frontend/qspheremesh.h +++ b/src/render/frontend/qspheremesh.h @@ -43,7 +43,7 @@ #define QT3D_QSPHEREMESH_H #include <Qt3DRenderer/qt3drenderer_global.h> -#include <Qt3DCore/qabstractmesh.h> +#include <Qt3DRenderer/qabstractmesh.h> QT_BEGIN_NAMESPACE diff --git a/src/render/frontend/qtorusmesh.cpp b/src/render/frontend/qtorusmesh.cpp index 341c58054..a8bc9b624 100644 --- a/src/render/frontend/qtorusmesh.cpp +++ b/src/render/frontend/qtorusmesh.cpp @@ -48,7 +48,7 @@ #include "qbuffer.h" #include "qattribute.h" #include "qmeshdata.h" -#include <Qt3DCore/private/qabstractmesh_p.h> +#include <Qt3DRenderer/private/qabstractmesh_p.h> #include <cmath> @@ -60,7 +60,7 @@ class TorusMeshFunctor : public QAbstractMeshFunctor { public: TorusMeshFunctor(int rings, int slices, float radius, float minorRadius); - QAbstractMeshDataPtr operator ()() Q_DECL_OVERRIDE; + QMeshDataPtr operator ()() Q_DECL_OVERRIDE; bool operator ==(const QAbstractMeshFunctor &other) const Q_DECL_OVERRIDE; private: @@ -167,10 +167,10 @@ float QTorusMesh::minorRadius() const return d->m_minorRadius; } -QAbstractMeshDataPtr createTorusMesh(double radius, double minorRadius, +QMeshDataPtr createTorusMesh(double radius, double minorRadius, int rings, int sides) { - QAbstractMeshDataPtr mesh(new QMeshData(GL_TRIANGLES)); + QMeshDataPtr mesh(new QMeshData(GL_TRIANGLES)); int nVerts = sides * ( rings + 1 ); QByteArray bufferBytes; @@ -217,13 +217,13 @@ QAbstractMeshDataPtr createTorusMesh(double radius, double minorRadius, buf->setUsage(QOpenGLBuffer::StaticDraw); buf->setData(bufferBytes); - mesh->addAttribute(QAbstractMeshData::defaultPositionAttributeName(), QAbstractAttributePtr(new Attribute(buf, GL_FLOAT_VEC3, nVerts, 0, stride))); + mesh->addAttribute(QMeshData::defaultPositionAttributeName(), QAbstractAttributePtr(new Attribute(buf, GL_FLOAT_VEC3, nVerts, 0, stride))); quint32 offset = sizeof(float) * 3; - mesh->addAttribute(QAbstractMeshData::defaultTextureCoordinateAttributeName(), QAbstractAttributePtr(new Attribute(buf, GL_FLOAT_VEC2, nVerts, offset, stride))); + mesh->addAttribute(QMeshData::defaultTextureCoordinateAttributeName(), QAbstractAttributePtr(new Attribute(buf, GL_FLOAT_VEC2, nVerts, offset, stride))); offset += sizeof(float) * 2; - mesh->addAttribute(QAbstractMeshData::defaultNormalAttributeName(), QAbstractAttributePtr(new Attribute(buf, GL_FLOAT_VEC3, nVerts, offset, stride))); + mesh->addAttribute(QMeshData::defaultNormalAttributeName(), QAbstractAttributePtr(new Attribute(buf, GL_FLOAT_VEC3, nVerts, offset, stride))); offset += sizeof(float) * 3; QByteArray indexBytes; @@ -254,7 +254,7 @@ QAbstractMeshDataPtr createTorusMesh(double radius, double minorRadius, indexBuffer->setData(indexBytes); mesh->setIndexAttribute(AttributePtr(new Attribute(indexBuffer, GL_UNSIGNED_SHORT, indices, 0, 0))); - mesh->computeBoundsFromAttribute(QAbstractMeshData::defaultPositionAttributeName()); + mesh->computeBoundsFromAttribute(QMeshData::defaultPositionAttributeName()); return mesh; } @@ -274,7 +274,7 @@ TorusMeshFunctor::TorusMeshFunctor(int rings, int slices, float radius, float mi { } -QAbstractMeshDataPtr TorusMeshFunctor::operator ()() +QMeshDataPtr TorusMeshFunctor::operator ()() { return createTorusMesh(m_radius, m_minorRadius, m_rings, m_slices); } diff --git a/src/render/frontend/qtorusmesh.h b/src/render/frontend/qtorusmesh.h index dec92a9aa..f492076c2 100644 --- a/src/render/frontend/qtorusmesh.h +++ b/src/render/frontend/qtorusmesh.h @@ -43,7 +43,7 @@ #define QT3D_QTORUSMESH_H #include <Qt3DRenderer/qt3drenderer_global.h> -#include <Qt3DCore/qabstractmesh.h> +#include <Qt3DRenderer/qabstractmesh.h> QT_BEGIN_NAMESPACE diff --git a/src/render/frontend/render-frontend.pri b/src/render/frontend/render-frontend.pri index 9eeab15c0..7f2efe0f3 100644 --- a/src/render/frontend/render-frontend.pri +++ b/src/render/frontend/render-frontend.pri @@ -61,7 +61,9 @@ HEADERS += \ $$PWD/qrenderstate_p.h \ $$PWD/qalphacoverage.h \ $$PWD/qannotation.h \ - $$PWD/qannotation_p.h + $$PWD/qannotation_p.h \ + $$PWD/qabstractmesh_p.h \ + $$PWD/qabstractmesh.h SOURCES += \ $$PWD/qmaterial.cpp \ @@ -102,4 +104,5 @@ SOURCES += \ $$PWD/qrenderattachment.cpp \ $$PWD/qrendertarget.cpp \ $$PWD/qalphacoverage.cpp \ - $$PWD/qannotation.cpp + $$PWD/qannotation.cpp \ + $$PWD/qabstractmesh.cpp |