diff options
Diffstat (limited to 'src/render/geometry')
25 files changed, 71 insertions, 1867 deletions
diff --git a/src/render/geometry/attribute.cpp b/src/render/geometry/attribute.cpp index de44c5fe3..b9e53b483 100644 --- a/src/render/geometry/attribute.cpp +++ b/src/render/geometry/attribute.cpp @@ -38,8 +38,7 @@ ****************************************************************************/ #include "attribute_p.h" -#include <Qt3DRender/qbuffer.h> -#include <Qt3DRender/private/qattribute_p.h> +#include <Qt3DCore/private/qattribute_p.h> #include <Qt3DRender/private/stringtoint_p.h> QT_BEGIN_NAMESPACE diff --git a/src/render/geometry/attribute_p.h b/src/render/geometry/attribute_p.h index 87b3cbb4f..af776ae2c 100644 --- a/src/render/geometry/attribute_p.h +++ b/src/render/geometry/attribute_p.h @@ -52,7 +52,7 @@ // #include <Qt3DRender/private/backendnode_p.h> -#include <Qt3DRender/qattribute.h> +#include <Qt3DCore/qattribute.h> QT_BEGIN_NAMESPACE @@ -73,13 +73,13 @@ public: inline Qt3DCore::QNodeId bufferId() const { return m_bufferId; } inline QString name() const { return m_name; } inline int nameId() const { return m_nameId; } - inline QAttribute::VertexBaseType vertexBaseType() const { return m_vertexBaseType; } + inline Qt3DCore::QAttribute::VertexBaseType vertexBaseType() const { return m_vertexBaseType; } inline uint vertexSize() const { return m_vertexSize; } inline uint count() const { return m_count; } inline uint byteStride() const { return m_byteStride; } inline uint byteOffset() const { return m_byteOffset; } inline uint divisor() const { return m_divisor; } - inline QAttribute::AttributeType attributeType() const { return m_attributeType; } + inline Qt3DCore::QAttribute::AttributeType attributeType() const { return m_attributeType; } inline bool isDirty() const { return m_attributeDirty; } void unsetDirty(); @@ -87,13 +87,13 @@ private: Qt3DCore::QNodeId m_bufferId; QString m_name; int m_nameId; - QAttribute::VertexBaseType m_vertexBaseType; + Qt3DCore::QAttribute::VertexBaseType m_vertexBaseType; uint m_vertexSize; uint m_count; uint m_byteStride; uint m_byteOffset; uint m_divisor; - QAttribute::AttributeType m_attributeType; + Qt3DCore::QAttribute::AttributeType m_attributeType; bool m_attributeDirty; }; diff --git a/src/render/geometry/buffer.cpp b/src/render/geometry/buffer.cpp index 5b577b546..f7a1f376c 100644 --- a/src/render/geometry/buffer.cpp +++ b/src/render/geometry/buffer.cpp @@ -38,21 +38,19 @@ ****************************************************************************/ #include "buffer_p.h" +#include <Qt3DCore/private/qbuffer_p.h> #include <Qt3DRender/private/buffermanager_p.h> -#include <Qt3DRender/private/qbuffer_p.h> QT_BEGIN_NAMESPACE -using namespace Qt3DCore; - namespace Qt3DRender { namespace Render { Buffer::Buffer() : BackendNode(QBackendNode::ReadWrite) - , m_usage(QBuffer::StaticDraw) + , m_usage(Qt3DCore::QBuffer::StaticDraw) , m_bufferDirty(false) - , m_access(QBuffer::Write) + , m_access(Qt3DCore::QBuffer::Write) , m_manager(nullptr) { // Maybe it could become read write if we want to inform @@ -65,11 +63,11 @@ Buffer::~Buffer() void Buffer::cleanup() { - m_usage = QBuffer::StaticDraw; + m_usage = Qt3DCore::QBuffer::StaticDraw; m_data.clear(); m_bufferUpdates.clear(); m_bufferDirty = false; - m_access = QBuffer::Write; + m_access = Qt3DCore::QBuffer::Write; } @@ -90,16 +88,16 @@ void Buffer::forceDataUpload() { // We push back an update with offset = -1 // As this is the way to force data to be loaded - QBufferUpdate updateNewData; + Qt3DCore::QBufferUpdate updateNewData; updateNewData.offset = -1; m_bufferUpdates.clear(); //previous updates are pointless m_bufferUpdates.push_back(updateNewData); } -void Buffer::syncFromFrontEnd(const QNode *frontEnd, bool firstTime) +void Buffer::syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) { BackendNode::syncFromFrontEnd(frontEnd, firstTime); - const QBuffer *node = qobject_cast<const QBuffer *>(frontEnd); + const Qt3DCore::QBuffer *node = qobject_cast<const Qt3DCore::QBuffer *>(frontEnd); if (!node) return; @@ -128,17 +126,17 @@ void Buffer::syncFromFrontEnd(const QNode *frontEnd, bool firstTime) // if we enter this code block, there's no problem in actually // ignoring the partial updates if (v.isValid()) - const_cast<QBuffer *>(node)->setProperty("QT3D_updateData", {}); + const_cast<Qt3DCore::QBuffer *>(node)->setProperty("QT3D_updateData", {}); if (dirty && !m_data.isEmpty()) forceDataUpload(); } else if (v.isValid()) { // Apply partial updates and record them to allow partial upload to the GPU - Qt3DRender::QBufferUpdate updateData = v.value<Qt3DRender::QBufferUpdate>(); + Qt3DCore::QBufferUpdate updateData = v.value<Qt3DCore::QBufferUpdate>(); m_data.replace(updateData.offset, updateData.data.size(), updateData.data); m_bufferUpdates.push_back(updateData); m_bufferDirty = true; - const_cast<QBuffer *>(node)->setProperty("QT3D_updateData", {}); + const_cast<Qt3DCore::QBuffer *>(node)->setProperty("QT3D_updateData", {}); } } markDirty(AbstractRenderer::BuffersDirty); diff --git a/src/render/geometry/buffer_p.h b/src/render/geometry/buffer_p.h index c2e40ed88..28600581d 100644 --- a/src/render/geometry/buffer_p.h +++ b/src/render/geometry/buffer_p.h @@ -53,14 +53,15 @@ #include <QtCore> #include <Qt3DRender/private/backendnode_p.h> -#include <Qt3DRender/qbuffer.h> +#include <Qt3DCore/qbuffer.h> QT_BEGIN_NAMESPACE -namespace Qt3DRender { - -struct QBufferUpdate; +namespace Qt3DCore { + struct QBufferUpdate; +} +namespace Qt3DRender { namespace Render { class BufferManager; @@ -76,21 +77,21 @@ public: void setManager(BufferManager *manager); void updateDataFromGPUToCPU(QByteArray data); - inline QBuffer::UsageType usage() const { return m_usage; } + inline Qt3DCore::QBuffer::UsageType usage() const { return m_usage; } inline QByteArray data() const { return m_data; } - inline QVector<Qt3DRender::QBufferUpdate> &pendingBufferUpdates() { return m_bufferUpdates; } + inline QVector<Qt3DCore::QBufferUpdate> &pendingBufferUpdates() { return m_bufferUpdates; } inline bool isDirty() const { return m_bufferDirty; } - inline QBuffer::AccessType access() const { return m_access; } + inline Qt3DCore::QBuffer::AccessType access() const { return m_access; } void unsetDirty(); private: void forceDataUpload(); - QBuffer::UsageType m_usage; + Qt3DCore::QBuffer::UsageType m_usage; QByteArray m_data; - QVector<Qt3DRender::QBufferUpdate> m_bufferUpdates; + QVector<Qt3DCore::QBufferUpdate> m_bufferUpdates; bool m_bufferDirty; - QBuffer::AccessType m_access; + Qt3DCore::QBuffer::AccessType m_access; BufferManager *m_manager; }; @@ -107,7 +108,6 @@ private: }; } // namespace Render - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/geometry/geometry.cpp b/src/render/geometry/geometry.cpp index c70195ee0..22154e4f5 100644 --- a/src/render/geometry/geometry.cpp +++ b/src/render/geometry/geometry.cpp @@ -38,9 +38,9 @@ ****************************************************************************/ #include "geometry_p.h" -#include <Qt3DRender/qattribute.h> -#include <Qt3DRender/qgeometry.h> -#include <Qt3DRender/private/qgeometry_p.h> +#include <Qt3DCore/private/qgeometry_p.h> +#include <Qt3DCore/qattribute.h> +#include <Qt3DCore/qgeometry.h> #include <algorithm> diff --git a/src/render/geometry/geometry.pri b/src/render/geometry/geometry.pri index 88cc81b51..475f406d5 100644 --- a/src/render/geometry/geometry.pri +++ b/src/render/geometry/geometry.pri @@ -7,17 +7,10 @@ HEADERS += \ $$PWD/geometry_p.h \ $$PWD/geometryrenderer_p.h \ $$PWD/geometryrenderermanager_p.h \ - $$PWD/qbuffer.h \ - $$PWD/qbuffer_p.h \ - $$PWD/qgeometry.h \ - $$PWD/qgeometry_p.h \ - $$PWD/qgeometryfactory_p.h \ $$PWD/qgeometryrenderer.h \ $$PWD/qgeometryrenderer_p.h \ $$PWD/qmesh.h \ $$PWD/qmesh_p.h \ - $$PWD/qattribute_p.h \ - $$PWD/qattribute.h \ $$PWD/armature_p.h \ $$PWD/skeleton_p.h \ $$PWD/gltfskeletonloader_p.h \ @@ -31,11 +24,8 @@ SOURCES += \ $$PWD/geometry.cpp \ $$PWD/geometryrenderer.cpp \ $$PWD/geometryrenderermanager.cpp \ - $$PWD/qbuffer.cpp \ - $$PWD/qgeometry.cpp \ $$PWD/qgeometryrenderer.cpp \ $$PWD/qmesh.cpp \ - $$PWD/qattribute.cpp \ $$PWD/armature.cpp \ $$PWD/skeleton.cpp \ $$PWD/gltfskeletonloader.cpp \ diff --git a/src/render/geometry/geometryrenderer.cpp b/src/render/geometry/geometryrenderer.cpp index 7a726e03f..6f6227ba7 100644 --- a/src/render/geometry/geometryrenderer.cpp +++ b/src/render/geometry/geometryrenderer.cpp @@ -142,7 +142,7 @@ void GeometryRenderer::syncFromFrontEnd(const QNode *frontEnd, bool firstTime) if (m_geometryFactory && m_manager != nullptr) { m_manager->addDirtyGeometryRenderer(peerId()); - const bool isQMeshFunctor = m_geometryFactory->id() == Qt3DRender::functorTypeId<MeshLoaderFunctor>(); + const bool isQMeshFunctor = m_geometryFactory->id() == Qt3DCore::functorTypeId<MeshLoaderFunctor>(); if (isQMeshFunctor) { const QMesh *meshNode = static_cast<const QMesh *>(node); QMeshPrivate *dmeshNode = QMeshPrivate::get(const_cast<QMesh *>(meshNode)); @@ -159,7 +159,7 @@ GeometryFunctorResult GeometryRenderer::executeFunctor() Q_ASSERT(m_geometryFactory); // What kind of functor are we dealing with? - const bool isQMeshFunctor = m_geometryFactory->id() == Qt3DRender::functorTypeId<MeshLoaderFunctor>(); + const bool isQMeshFunctor = m_geometryFactory->id() == Qt3DCore::functorTypeId<MeshLoaderFunctor>(); if (isQMeshFunctor) { QSharedPointer<MeshLoaderFunctor> meshLoader = qSharedPointerCast<MeshLoaderFunctor>(m_geometryFactory); @@ -171,7 +171,7 @@ GeometryFunctorResult GeometryRenderer::executeFunctor() if (meshLoader->downloaderService() == nullptr) { Qt3DCore::QServiceLocator *services = m_renderer->services(); meshLoader->setDownloaderService(services->service<Qt3DCore::QDownloadHelperService>(Qt3DCore::QServiceLocator::DownloadHelperService)); - }; + } } // Load geometry diff --git a/src/render/geometry/geometryrenderer_p.h b/src/render/geometry/geometryrenderer_p.h index c5908ca01..87a289f7d 100644 --- a/src/render/geometry/geometryrenderer_p.h +++ b/src/render/geometry/geometryrenderer_p.h @@ -51,8 +51,8 @@ // We mean it. // +#include <Qt3DCore/private/qgeometryfactory_p.h> #include <Qt3DRender/private/backendnode_p.h> -#include <Qt3DRender/private/qgeometryfactory_p.h> #include <Qt3DRender/qgeometryrenderer.h> #include <Qt3DRender/qmesh.h> @@ -69,7 +69,7 @@ class GeometryRendererManager; struct GeometryFunctorResult { - QGeometry *geometry; + Qt3DCore::QGeometry *geometry; QMesh::Status status; }; @@ -96,7 +96,7 @@ public: inline bool primitiveRestartEnabled() const { return m_primitiveRestartEnabled; } inline QGeometryRenderer::PrimitiveType primitiveType() const { return m_primitiveType; } inline bool isDirty() const { return m_dirty; } - inline QGeometryFactoryPtr geometryFactory() const { return m_geometryFactory; } + inline Qt3DCore::QGeometryFactoryPtr geometryFactory() const { return m_geometryFactory; } void unsetDirty(); // Build triangle data Job thread @@ -117,7 +117,7 @@ private: bool m_primitiveRestartEnabled; QGeometryRenderer::PrimitiveType m_primitiveType; bool m_dirty; - QGeometryFactoryPtr m_geometryFactory; + Qt3DCore::QGeometryFactoryPtr m_geometryFactory; GeometryRendererManager *m_manager; QVector<RayCasting::QBoundingVolume *> m_triangleVolumes; }; diff --git a/src/render/geometry/gltfskeletonloader.cpp b/src/render/geometry/gltfskeletonloader.cpp index d5d344ce1..ce3b3a5f2 100644 --- a/src/render/geometry/gltfskeletonloader.cpp +++ b/src/render/geometry/gltfskeletonloader.cpp @@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt3DCore; + namespace { void jsonArrayToSqt(const QJsonArray &jsonArray, Qt3DCore::Sqt &sqt) diff --git a/src/render/geometry/gltfskeletonloader_p.h b/src/render/geometry/gltfskeletonloader_p.h index b2a175ecb..b3e86a86c 100644 --- a/src/render/geometry/gltfskeletonloader_p.h +++ b/src/render/geometry/gltfskeletonloader_p.h @@ -49,7 +49,7 @@ // #include <QtGlobal> -#include <Qt3DRender/qattribute.h> +#include <Qt3DCore/qattribute.h> #include <QtGui/qmatrix4x4.h> #include <QtCore/qjsondocument.h> @@ -96,7 +96,7 @@ class GLTFSkeletonLoader explicit AccessorData(const QJsonObject &json); int bufferViewIndex; - QAttribute::VertexBaseType type; + Qt3DCore::QAttribute::VertexBaseType type; uint dataSize; int count; int byteOffset; @@ -139,8 +139,8 @@ public: SkeletonData createSkeleton(const QString &skeletonName); private: - static QAttribute::VertexBaseType accessorTypeFromJSON(int componentType); - static uint accessorTypeSize(QAttribute::VertexBaseType componentType); + static Qt3DCore::QAttribute::VertexBaseType accessorTypeFromJSON(int componentType); + static uint accessorTypeSize(Qt3DCore::QAttribute::VertexBaseType componentType); static uint accessorDataSizeFromJson(const QString &type); struct RawData diff --git a/src/render/geometry/qattribute.cpp b/src/render/geometry/qattribute.cpp deleted file mode 100644 index 348695e45..000000000 --- a/src/render/geometry/qattribute.cpp +++ /dev/null @@ -1,493 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qattribute.h" -#include "qattribute_p.h" -#include <Qt3DRender/qbuffer.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -QAttributePrivate::QAttributePrivate() - : QNodePrivate() - , m_buffer(nullptr) - , m_name() - , m_vertexBaseType(QAttribute::Float) - , m_vertexSize(1) - , m_count(0) - , m_byteStride(0) - , m_byteOffset(0) - , m_divisor(0) - , m_attributeType(QAttribute::VertexAttribute) -{ -} - -/*! - * \qmltype Attribute - * \instantiates Qt3DRender::QAttribute - * \inqmlmodule Qt3D.Render - * \brief Defines an attribute and how data should be read from a Buffer. - * - * There are 3 types of attributes. - * \list - * \li VertexAttribute: used to define data to be read on a per vertex basis - * \li IndexAttribute: used to define vertex indices when indexed draw calls are - * to be used - *\li DrawIndirectAttribute: used to specify the DrawIndirect buffer to be used - * when indirect draw calls are to be used - * \endlist - * - * \note when an attribute is of type DrawIndirectAttribute, only count, stride - * and offset are relevant. - * - * When providing your own attributes, it may make sense to name your attribute - * using helpers such as QAttribute::defaultPositionAttributeName() as that - * will ensure your geometry will be compatible with picking and the various - * materials provided in the Qt3DExtras module. - */ - -/*! - * \class Qt3DRender::QAttribute - * \inheaderfile Qt3DRender/QAttribute - * \inmodule Qt3DRender - * - * \inherits Qt3DCore::QNode - * - * \brief Defines an attribute and how data should be read from a QBuffer. - * - * There are 3 types of attributes. - * \list - * \li VertexAttribute: used to define data to be read on a per vertex basis - * \li IndexAttribute: used to define vertex indices when indexed draw calls are - * to be used - *\li DrawIndirectAttribute: used to specify the DrawIndirect buffer to be used - * when indirect draw calls are to be used - * \endlist - * - * \note when an attribute is of type DrawIndirectAttribute, only count, stride - * and offset are relevant. - * - * When providing your own attributes, it may make sense to name your attribute - * using helpers such as QAttribute::defaultPositionAttributeName() as that - * will ensure your geometry will be compatible with picking and the various - * materials provided in the Qt3DExtras module. - * - * \sa QBuffer - */ - -/*! - * \typedef Qt3DRender::QBufferPtr - * \relates Qt3DRender::QAttribute - */ - -/*! - * \enum QAttribute::AttributeType - * - * The type of the attribute. - * - * \value VertexAttribute - * \value IndexAttribute - * \value DrawIndirectAttribute - */ - -/*! - * \enum QAttribute::VertexBaseType - * - * The type of the data. - * - * \value Byte - * \value UnsignedByte - * \value Short - * \value UnsignedShort - * \value Int - * \value UnsignedInt - * \value HalfFloat - * \value Float - * \value Double - */ - -/*! - * Constructs a new QAttribute with \a parent. - */ -QAttribute::QAttribute(QNode *parent) - : QNode(*new QAttributePrivate(), parent) -{ -} - -/*! - * Constructs a new QAttribute from \a buf of \a type, \a dataSize, \a count, \a offset, - * and \a stride with \a parent. - */ -QAttribute::QAttribute(QBuffer *buf, VertexBaseType type, uint dataSize, uint count, uint offset, uint stride, QNode *parent) - : QAttribute(parent) -{ - Q_D(QAttribute); - setBuffer(buf); - d->m_count = count; - d->m_byteOffset = offset; - d->m_vertexBaseType = type; - d->m_vertexSize = dataSize; - d->m_byteStride = stride; -} - - -/*! - * Constructs a new QAttribute named \a name from \a buf of \a type, \a - * dataSize, \a count, \a offset, and \a stride with \a parent. - */ -QAttribute::QAttribute(QBuffer *buf, const QString &name, VertexBaseType type, uint dataSize, uint count, uint offset, uint stride, QNode *parent) - : QAttribute(parent) -{ - Q_D(QAttribute); - setBuffer(buf); - d->m_name = name; - d->m_count = count; - d->m_byteOffset = offset; - d->m_vertexBaseType = type; - d->m_vertexSize = dataSize; - d->m_byteStride = stride; -} - -/*! \internal */ -QAttribute::~QAttribute() -{ -} - -/*! - * \property QAttribute::buffer - * - * Holds the buffer. - */ -QBuffer *QAttribute::buffer() const -{ - Q_D(const QAttribute); - return d->m_buffer; -} - -/*! - * \property QAttribute::name - * - * Holds the name. - */ -QString QAttribute::name() const -{ - Q_D(const QAttribute); - return d->m_name; -} - -/*! - * \property QAttribute::vertexSize - * - * Holds the data size, it can only be 1 to 4 units (scalars and vectors), - * 9 units (3x3 matrices) or 16 units (4x4 matrices). - */ -uint QAttribute::vertexSize() const -{ - Q_D(const QAttribute); - return d->m_vertexSize; -} - -/*! - * \property QAttribute::vertexBaseType - * - * Holds the data type. - */ -QAttribute::VertexBaseType QAttribute::vertexBaseType() const -{ - Q_D(const QAttribute); - return d->m_vertexBaseType; -} - -/*! - * \property QAttribute::count - * - * Holds the count. - */ -uint QAttribute::count() const -{ - Q_D(const QAttribute); - return d->m_count; -} - -/*! - * \property QAttribute::byteStride - * - * Holds the byte stride. - */ -uint QAttribute::byteStride() const -{ - Q_D(const QAttribute); - return d->m_byteStride; -} - -/*! - * \property QAttribute::byteOffset - * - * Holds the byte offset. - */ -uint QAttribute::byteOffset() const -{ - Q_D(const QAttribute); - return d->m_byteOffset; -} - -/*! - * \property QAttribute::divisor - * - * Holds the divisor. - */ -uint QAttribute::divisor() const -{ - Q_D(const QAttribute); - return d->m_divisor; -} - -/*! - * \property QAttribute::attributeType - * - * Holds the attribute type. - */ -QAttribute::AttributeType QAttribute::attributeType() const -{ - Q_D(const QAttribute); - return d->m_attributeType; -} - -void QAttribute::setBuffer(QBuffer *buffer) -{ - Q_D(QAttribute); - if (d->m_buffer == buffer) - return; - - if (d->m_buffer) - d->unregisterDestructionHelper(d->m_buffer); - - // We need to add it as a child of the current node if it has been declared inline - // Or not previously added as a child of the current node so that - // 1) The backend gets notified about it's creation - // 2) When the current node is destroyed, it gets destroyed as well - if (buffer && !buffer->parent()) - buffer->setParent(this); - - d->m_buffer = buffer; - - // Ensures proper bookkeeping - if (d->m_buffer) - d->registerDestructionHelper(d->m_buffer, &QAttribute::setBuffer, d->m_buffer); - - emit bufferChanged(buffer); -} - -void QAttribute::setName(const QString &name) -{ - Q_D(QAttribute); - if (d->m_name == name) - return; - - d->m_name = name; - emit nameChanged(name); -} - -void QAttribute::setVertexBaseType(VertexBaseType type) -{ - Q_D(QAttribute); - - if (d->m_vertexBaseType == type) - return; - - d->m_vertexBaseType = type; - emit vertexBaseTypeChanged(type); - emit dataTypeChanged(type); -} - -void QAttribute::setVertexSize(uint size) -{ - Q_D(QAttribute); - if (d->m_vertexSize == size) - return; - Q_ASSERT((size >= 1 && size <= 4) || (size == 9) || (size == 16)); - d->m_vertexSize = size; - emit vertexSizeChanged(size); - emit dataSizeChanged(size); -} - -void QAttribute::setCount(uint count) -{ - Q_D(QAttribute); - if (d->m_count == count) - return; - - d->m_count = count; - emit countChanged(count); -} - -void QAttribute::setByteStride(uint byteStride) -{ - Q_D(QAttribute); - if (d->m_byteStride == byteStride) - return; - - d->m_byteStride = byteStride; - emit byteStrideChanged(byteStride); -} - -void QAttribute::setByteOffset(uint byteOffset) -{ - Q_D(QAttribute); - if (d->m_byteOffset == byteOffset) - return; - - d->m_byteOffset = byteOffset; - emit byteOffsetChanged(byteOffset); -} - -void QAttribute::setDivisor(uint divisor) -{ - Q_D(QAttribute); - if (d->m_divisor == divisor) - return; - - d->m_divisor = divisor; - emit divisorChanged(divisor); -} - -void QAttribute::setAttributeType(AttributeType attributeType) -{ - Q_D(QAttribute); - if (d->m_attributeType == attributeType) - return; - - d->m_attributeType = attributeType; - emit attributeTypeChanged(attributeType); -} -/*! - * \brief QAttribute::defaultPositionAttributeName - * \return the name of the default position attribute - */ -QString QAttribute::defaultPositionAttributeName() -{ - return QStringLiteral("vertexPosition"); -} -/*! - * \brief QAttribute::defaultNormalAttributeName - * \return the name of the default normal attribute - */ -QString QAttribute::defaultNormalAttributeName() -{ - return QStringLiteral("vertexNormal"); -} -/*! - * \brief QAttribute::defaultColorAttributeName - * \return the name of the default color attribute - */ -QString QAttribute::defaultColorAttributeName() -{ - return QStringLiteral("vertexColor"); -} -/*! - * \brief QAttribute::defaultTextureCoordinateAttributeName - * \return the name of the default texture coordinate attribute - */ -QString QAttribute::defaultTextureCoordinateAttributeName() -{ - return QStringLiteral("vertexTexCoord"); -} -/*! - * \brief QAttribute::defaultTangentAttributeName - * \return the name of the default tangent attribute - */ -QString QAttribute::defaultTangentAttributeName() -{ - return QStringLiteral("vertexTangent"); -} - -/*! - * \brief QAttribute::defaultJointIndicesAttributeName - * \return the name of the default joint indices attribute - */ -QString QAttribute::defaultJointIndicesAttributeName() -{ - return QStringLiteral("vertexJointIndices"); -} - -/*! - * \brief QAttribute::defaultJointIndicesAttributeName - * \return the name of the default joint weights attribute - */ -QString QAttribute::defaultJointWeightsAttributeName() -{ - return QStringLiteral("vertexJointWeights"); -} - -/*! - * \brief QAttribute::defaultTextureCoordinate1AttributeName - * \return the name of the default attribute for the second layer of texture - * coordinates - */ -QString QAttribute::defaultTextureCoordinate1AttributeName() -{ - return QStringLiteral("vertexTexCoord1"); -} - -/*! - * \brief QAttribute::defaultTextureCoordinate2AttributeName - * \return the name of the default attribute for the third layer of texture - * coordinates - */ -QString QAttribute::defaultTextureCoordinate2AttributeName() -{ - return QStringLiteral("vertexTexCoord2"); -} - -/*! -\fn Qt3DRender::QAttribute::dataSizeChanged(uint vertexSize) - -The signal is emitted with \a vertexSize when the dataSize changes. -*/ -/*! -\fn Qt3DRender::QAttribute::dataTypeChanged(Qt3DRender::QAttribute::VertexBaseType vertexBaseType) - -The signal is emitted with \a vertexBaseType when the dataType changed. -*/ - - -} // Qt3DRender - -QT_END_NAMESPACE diff --git a/src/render/geometry/qattribute.h b/src/render/geometry/qattribute.h deleted file mode 100644 index ec3b65f32..000000000 --- a/src/render/geometry/qattribute.h +++ /dev/null @@ -1,157 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_QATTRIBUTE_H -#define QT3DRENDER_QATTRIBUTE_H - -#include <Qt3DRender/qt3drender_global.h> -#include <Qt3DCore/qnode.h> -#include <QtCore/QSharedPointer> - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -class QBuffer; -class QAttributePrivate; - -typedef QSharedPointer<QBuffer> QBufferPtr; - -class Q_3DRENDERSHARED_EXPORT QAttribute : public Qt3DCore::QNode -{ - Q_OBJECT - Q_PROPERTY(Qt3DRender::QBuffer *buffer READ buffer WRITE setBuffer NOTIFY bufferChanged) - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(VertexBaseType vertexBaseType READ vertexBaseType WRITE setVertexBaseType NOTIFY vertexBaseTypeChanged) - Q_PROPERTY(uint vertexSize READ vertexSize WRITE setVertexSize NOTIFY vertexSizeChanged) - Q_PROPERTY(uint count READ count WRITE setCount NOTIFY countChanged) - Q_PROPERTY(uint byteStride READ byteStride WRITE setByteStride NOTIFY byteStrideChanged) - Q_PROPERTY(uint byteOffset READ byteOffset WRITE setByteOffset NOTIFY byteOffsetChanged) - Q_PROPERTY(uint divisor READ divisor WRITE setDivisor NOTIFY divisorChanged) - Q_PROPERTY(AttributeType attributeType READ attributeType WRITE setAttributeType NOTIFY attributeTypeChanged) - Q_PROPERTY(QString defaultPositionAttributeName READ defaultPositionAttributeName CONSTANT) - Q_PROPERTY(QString defaultNormalAttributeName READ defaultNormalAttributeName CONSTANT) - Q_PROPERTY(QString defaultColorAttributeName READ defaultColorAttributeName CONSTANT) - Q_PROPERTY(QString defaultTextureCoordinateAttributeName READ defaultTextureCoordinateAttributeName CONSTANT) - Q_PROPERTY(QString defaultTextureCoordinate1AttributeName READ defaultTextureCoordinate1AttributeName CONSTANT REVISION 11) - Q_PROPERTY(QString defaultTextureCoordinate2AttributeName READ defaultTextureCoordinate2AttributeName CONSTANT REVISION 11) - Q_PROPERTY(QString defaultTangentAttributeName READ defaultTangentAttributeName CONSTANT) - Q_PROPERTY(QString defaultJointIndicesAttributeName READ defaultJointIndicesAttributeName CONSTANT REVISION 10) - Q_PROPERTY(QString defaultJointWeightsAttributeName READ defaultJointWeightsAttributeName CONSTANT REVISION 10) - -public: - enum AttributeType { - VertexAttribute, - IndexAttribute, - DrawIndirectAttribute - }; - - Q_ENUM(AttributeType) // LCOV_EXCL_LINE - - enum VertexBaseType { - Byte = 0, - UnsignedByte, - Short, - UnsignedShort, - Int, - UnsignedInt, - HalfFloat, - Float, - Double - }; - Q_ENUM(VertexBaseType) // LCOV_EXCL_LINE - - explicit QAttribute(QNode *parent = nullptr); - explicit QAttribute(QBuffer *buf, VertexBaseType vertexBaseType, uint vertexSize, uint count, uint offset = 0, uint stride = 0, QNode *parent = nullptr); - explicit QAttribute(QBuffer *buf, const QString &name, VertexBaseType vertexBaseType, uint vertexSize, uint count, uint offset = 0, uint stride = 0, QNode *parent = nullptr); - ~QAttribute(); - - QBuffer *buffer() const; - QString name() const; - VertexBaseType vertexBaseType() const; - uint vertexSize() const; - uint count() const; - uint byteStride() const; - uint byteOffset() const; - uint divisor() const; - AttributeType attributeType() const; - - Q_INVOKABLE static QString defaultPositionAttributeName(); - Q_INVOKABLE static QString defaultNormalAttributeName(); - Q_INVOKABLE static QString defaultColorAttributeName(); - Q_INVOKABLE static QString defaultTextureCoordinateAttributeName(); - Q_INVOKABLE static QString defaultTangentAttributeName(); - static QString defaultJointIndicesAttributeName(); - static QString defaultJointWeightsAttributeName(); - static QString defaultTextureCoordinate1AttributeName(); - static QString defaultTextureCoordinate2AttributeName(); - -public Q_SLOTS: - void setBuffer(QBuffer *buffer); - void setName(const QString &name); - void setVertexBaseType(VertexBaseType type); - void setVertexSize(uint size); - void setCount(uint count); - void setByteStride(uint byteStride); - void setByteOffset(uint byteOffset); - void setDivisor(uint divisor); - void setAttributeType(AttributeType attributeType); - -Q_SIGNALS: - void bufferChanged(QBuffer *buffer); - void nameChanged(const QString &name); - void vertexBaseTypeChanged(VertexBaseType vertexBaseType); - void vertexSizeChanged(uint vertexSize); - void dataTypeChanged(VertexBaseType vertexBaseType); - void dataSizeChanged(uint vertexSize); - void countChanged(uint count); - void byteStrideChanged(uint byteStride); - void byteOffsetChanged(uint byteOffset); - void divisorChanged(uint divisor); - void attributeTypeChanged(AttributeType attributeType); - -private: - Q_DECLARE_PRIVATE(QAttribute) -}; - -} // Qt3DRender - -QT_END_NAMESPACE - -#endif // QT3DRENDER_QATTRIBUTE_H diff --git a/src/render/geometry/qattribute_p.h b/src/render/geometry/qattribute_p.h deleted file mode 100644 index fd6936e0d..000000000 --- a/src/render/geometry/qattribute_p.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_QATTRIBUTE_P_H -#define QT3DRENDER_QATTRIBUTE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DRender/QAttribute> -#include <Qt3DRender/QBuffer> -#include <private/qnode_p.h> -#include <private/qt3drender_global_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -class QAttribute; - -class Q_3DRENDERSHARED_PRIVATE_EXPORT QAttributePrivate : public Qt3DCore::QNodePrivate -{ -public: - Q_DECLARE_PUBLIC(QAttribute) - - QAttributePrivate(); - - QBuffer *m_buffer; - QString m_name; - QAttribute::VertexBaseType m_vertexBaseType; - uint m_vertexSize; - uint m_count; - uint m_byteStride; - uint m_byteOffset; - uint m_divisor; - QAttribute::AttributeType m_attributeType; -}; - -} // Qt3DRender - -QT_END_NAMESPACE - -#endif // QT3DRENDER_QATTRIBUTE_P_H diff --git a/src/render/geometry/qbuffer.cpp b/src/render/geometry/qbuffer.cpp deleted file mode 100644 index 58ff304a0..000000000 --- a/src/render/geometry/qbuffer.cpp +++ /dev/null @@ -1,314 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qbuffer.h" -#include "qbuffer_p.h" -#include <Qt3DRender/private/renderlogging_p.h> - -QT_BEGIN_NAMESPACE - -using namespace Qt3DCore; - -namespace Qt3DRender { - -QBufferPrivate::QBufferPrivate() - : QNodePrivate() - , m_type(QBuffer::VertexBuffer) - , m_usage(QBuffer::StaticDraw) - , m_access(QBuffer::Write) -{ -} - -void QBufferPrivate::setData(const QByteArray &data) -{ - Q_Q(QBuffer); - const bool blocked = q->blockNotifications(true); - m_data = data; - emit q->dataChanged(data); - q->blockNotifications(blocked); -} - -/*! - * \qmltype Buffer - * \instantiates Qt3DRender::QBuffer - * \inqmlmodule Qt3D.Render - * - * \brief Provides a data store for raw data to later be used as vertices or - * uniforms. - */ - -/*! - * \qmlproperty QBuffer::UsageType Buffer::usage - * - * Holds the buffer usage. - */ - -/*! - * \qmlproperty QBuffer::BufferType Buffer::type - * - * Holds the buffer type. - * - * \deprecated - */ - -/*! - * \class Qt3DRender::QBuffer - * \inheaderfile Qt3DRender/QBuffer - * \inmodule Qt3DRender - * - * \inherits Qt3DCore::QNode - * - * \brief Provides a data store for raw data to later be used as vertices or - * uniforms. - * - * Data can be provided directly using QBuffer::setData(). - */ - -/*! - * \fn void Qt3DRender::QBuffer::dataChanged(const QByteArray &bytes) - * - * This signal is emitted with \a bytes when data changes. - */ - -/*! - * \fn void Qt3DRender::QBuffer::dataAvailable() - * - * This signal is emitted when data becomes available. - */ - -/*! - * \enum QBuffer::BufferType - * - * The type of the buffer. - * - * \value VertexBuffer - * GL_ARRAY_BUFFER - * \value IndexBuffer - * GL_ELEMENT_ARRAY_BUFFER - * \value PixelPackBuffer - * GL_PIXEL_PACK_BUFFER - * \value PixelUnpackBuffer - * GL_PIXEL_UNPACK_BUFFER - * \value UniformBuffer - * GL_UNIFORM_BUFFER - * \value ShaderStorageBuffer - * GL_SHADER_STORAGE_BUFFER - * \value DrawIndirectBuffer - * GL_DRAW_INDIRECT_BUFFER - * - * \deprecated - */ - -/*! - * \enum QBuffer::UsageType - * - * The type of the usage. - * - * \value StreamDraw - * GL_STREAM_DRAW - * \value StreamRead - * GL_STREAM_READ - * \value StreamCopy - * GL_STREAM_COPY - * \value StaticDraw - * GL_STATIC_DRAW - * \value StaticRead - * GL_STATIC_READ - * \value StaticCopy - * GL_STATIC_COPY - * \value DynamicDraw - * GL_DYNAMIC_DRAW - * \value DynamicRead - * GL_DYNAMIC_READ - * \value DynamicCopy - * GL_DYNAMIC_COPY - */ - -/*! - * \enum QBuffer::AccessType - * - * \value Write - * Write access - * \value Read - * Read access - * \value ReadWrite - * Write|Read - */ - -/*! - * \typedef Qt3DRender::QBufferDataGeneratorPtr - * \relates Qt3DRender::QBuffer - */ - -/*! - * Constructs a new QBuffer with \a parent. - */ -QBuffer::QBuffer(QNode *parent) - : QNode(*new QBufferPrivate(), parent) -{ -} - -/*! - * Constructs a new QBuffer of buffer type \a ty with \a parent. - * - * \deprecated - */ -QBuffer::QBuffer(QBuffer::BufferType ty, QNode *parent) - : QNode(*new QBufferPrivate(), parent) -{ - Q_D(QBuffer); - d->m_type = ty; -} - -/*! - * \internal - */ -QBuffer::~QBuffer() -{ -} - -/*! - * Sets \a bytes as data. - */ -void QBuffer::setData(const QByteArray &bytes) -{ - Q_D(QBuffer); - if (bytes != d->m_data) { - d->setData(bytes); - d->update(); - } -} - -/*! - * Updates the data by replacing it with \a bytes at \a offset. - */ -void QBuffer::updateData(int offset, const QByteArray &bytes) -{ - Q_D(QBuffer); - Q_ASSERT(offset >= 0 && (offset + bytes.size()) <= d->m_data.size()); - - // Update data - d->m_data.replace(offset, bytes.size(), bytes); - const bool blocked = blockNotifications(true); - emit dataChanged(d->m_data); - blockNotifications(blocked); - - QBufferUpdate updateData; - updateData.offset = offset; - updateData.data = bytes; - setProperty("QT3D_updateData", QVariant::fromValue(updateData)); - d->update(); -} - -/*! - * \return the data. - */ -QByteArray QBuffer::data() const -{ - Q_D(const QBuffer); - return d->m_data; -} - -/*! - * \property QBuffer::usage - * - * Holds the buffer usage. - */ -QBuffer::UsageType QBuffer::usage() const -{ - Q_D(const QBuffer); - return d->m_usage; -} - -void QBuffer::setUsage(QBuffer::UsageType usage) -{ - Q_D(QBuffer); - if (usage != d->m_usage) { - d->m_usage = usage; - emit usageChanged(usage); - } -} - -/*! - * \property QBuffer::type - * - * Holds the buffer type. - * - * \deprecated - */ -QBuffer::BufferType QBuffer::type() const -{ - Q_D(const QBuffer); - return d->m_type; -} - -void QBuffer::setAccessType(QBuffer::AccessType access) -{ - Q_D(QBuffer); - if (d->m_access != access) { - d->m_access = access; - Q_EMIT accessTypeChanged(access); - } -} - -/*! - * \property Qt3DRender::QBuffer::accessType - * - * Returns the \l {QBuffer::}{AccessType} of the buffer. - * - * \sa QBuffer::AccessType - */ -QBuffer::AccessType QBuffer::accessType() const -{ - Q_D(const QBuffer); - return d->m_access; -} - -void QBuffer::setType(QBuffer::BufferType type) -{ - Q_D(QBuffer); - if (type != d->m_type) { - d->m_type = type; - emit typeChanged(type); - } -} - -} // namespace Qt3DRender - -QT_END_NAMESPACE diff --git a/src/render/geometry/qbuffer.h b/src/render/geometry/qbuffer.h deleted file mode 100644 index fceeea2dc..000000000 --- a/src/render/geometry/qbuffer.h +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_QBUFFER_H -#define QT3DRENDER_QBUFFER_H - -#include <Qt3DCore/qnode.h> -#include <Qt3DRender/qt3drender_global.h> -#include <QtCore/QSharedPointer> - - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -class QBufferPrivate; - -class Q_3DRENDERSHARED_EXPORT QBuffer : public Qt3DCore::QNode -{ - Q_OBJECT - Q_PROPERTY(BufferType type READ type WRITE setType NOTIFY typeChanged) - Q_PROPERTY(UsageType usage READ usage WRITE setUsage NOTIFY usageChanged) - Q_PROPERTY(AccessType accessType READ accessType WRITE setAccessType NOTIFY accessTypeChanged REVISION 9) - -public: - enum BufferType - { - VertexBuffer = 0x8892, // GL_ARRAY_BUFFER - IndexBuffer = 0x8893, // GL_ELEMENT_ARRAY_BUFFER - PixelPackBuffer = 0x88EB, // GL_PIXEL_PACK_BUFFER - PixelUnpackBuffer = 0x88EC, // GL_PIXEL_UNPACK_BUFFER - UniformBuffer = 0x8A11, // GL_UNIFORM_BUFFER - ShaderStorageBuffer = 0x90D2, // GL_SHADER_STORAGE_BUFFER - DrawIndirectBuffer = 0x8F3F // GL_DRAW_INDIRECT_BUFFER - }; - Q_ENUM(BufferType) // LCOV_EXCL_LINE - - enum UsageType - { - StreamDraw = 0x88E0, // GL_STREAM_DRAW - StreamRead = 0x88E1, // GL_STREAM_READ - StreamCopy = 0x88E2, // GL_STREAM_COPY - StaticDraw = 0x88E4, // GL_STATIC_DRAW - StaticRead = 0x88E5, // GL_STATIC_READ - StaticCopy = 0x88E6, // GL_STATIC_COPY - DynamicDraw = 0x88E8, // GL_DYNAMIC_DRAW - DynamicRead = 0x88E9, // GL_DYNAMIC_READ - DynamicCopy = 0x88EA // GL_DYNAMIC_COPY - }; - Q_ENUM(UsageType) // LCOV_EXCL_LINE - - enum AccessType { - Write = 0x1, - Read = 0x2, - ReadWrite = Write|Read - }; - Q_ENUM(AccessType) // LCOV_EXCL_LINE - - explicit QBuffer(Qt3DCore::QNode *parent = nullptr); - QT_DEPRECATED explicit QBuffer(BufferType ty, Qt3DCore::QNode *parent = nullptr); - ~QBuffer(); - - UsageType usage() const; - QT_DEPRECATED BufferType type() const; - AccessType accessType() const; - - void setData(const QByteArray &bytes); - QByteArray data() const; - - Q_INVOKABLE void updateData(int offset, const QByteArray &bytes); - -public Q_SLOTS: - QT_DEPRECATED void setType(BufferType type); - void setUsage(UsageType usage); - void setAccessType(AccessType access); - -Q_SIGNALS: - void dataChanged(const QByteArray &bytes); - void typeChanged(BufferType type); - void usageChanged(UsageType usage); - void accessTypeChanged(AccessType access); - void dataAvailable(); - -private: - Q_DECLARE_PRIVATE(QBuffer) -}; - -} // namespace Qt3DRender - -QT_END_NAMESPACE - -#endif // QT3DRENDER_QBUFFER_H diff --git a/src/render/geometry/qbuffer_p.h b/src/render/geometry/qbuffer_p.h deleted file mode 100644 index b6d6318b4..000000000 --- a/src/render/geometry/qbuffer_p.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_QBUFFER_P_H -#define QT3DRENDER_QBUFFER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/private/qnode_p.h> -#include <Qt3DRender/qbuffer.h> -#include <Qt3DRender/qt3drender_global.h> -#include <private/qnode_p.h> -#include <QByteArray> - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -class Q_3DRENDERSHARED_EXPORT QBufferPrivate : public Qt3DCore::QNodePrivate -{ -public: - Q_DECLARE_PUBLIC(QBuffer) - - QBufferPrivate(); - - QByteArray m_data; - QBuffer::BufferType m_type; - QBuffer::UsageType m_usage; - QBuffer::AccessType m_access; - - void setData(const QByteArray &data); -}; - -struct QBufferUpdate -{ - int offset; - QByteArray data; -}; - -} // namespace Qt3DRender - -QT_END_NAMESPACE -Q_DECLARE_METATYPE(Qt3DRender::QBufferUpdate) // LCOV_EXCL_LINE - -#endif // QT3DRENDER_QBUFFER_P_H diff --git a/src/render/geometry/qgeometry.cpp b/src/render/geometry/qgeometry.cpp deleted file mode 100644 index b3992b0aa..000000000 --- a/src/render/geometry/qgeometry.cpp +++ /dev/null @@ -1,268 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgeometry.h" -#include "qgeometryfactory_p.h" -#include "qgeometry_p.h" -#include <private/qnode_p.h> -#include <Qt3DRender/qattribute.h> - -QT_BEGIN_NAMESPACE - -using namespace Qt3DCore; - -namespace Qt3DRender { - -QGeometryFactory::~QGeometryFactory() -{ -} - -QGeometryPrivate::QGeometryPrivate() - : QNodePrivate(), - m_boundingVolumePositionAttribute(nullptr) -{ -} - -QGeometryPrivate::~QGeometryPrivate() -{ -} - -void QGeometryPrivate::setExtent(const QVector3D &minExtent, const QVector3D &maxExtent) -{ - Q_Q(QGeometry); - if (m_minExtent != minExtent) { - m_minExtent = minExtent; - emit q->minExtentChanged(minExtent); - } - - if (m_maxExtent != maxExtent) { - m_maxExtent = maxExtent; - emit q->maxExtentChanged(maxExtent); - } -} - -/*! - \qmltype Geometry - \instantiates Qt3DRender::QGeometry - \inqmlmodule Qt3D.Render - \inherits Node - \since 5.7 - \brief Encapsulates geometry. - - A Geometry type is used to group a list of Attribute objects together - to form a geometric shape Qt3D is able to render using GeometryRenderer. - Special attribute can be set in order to calculate bounding volume of the shape. - */ - -/*! - \class Qt3DRender::QGeometry - \inmodule Qt3DRender - \since 5.7 - \brief Encapsulates geometry. - - A Qt3DRender::QGeometry class is used to group a list of Qt3DRender::QAttribute - objects together to form a geometric shape Qt3D is able to render using - Qt3DRender::QGeometryRenderer. Special attribute can be set in order to calculate - bounding volume of the shape. - */ - -/*! - \qmlproperty Attribute Geometry::boundingVolumePositionAttribute - - Holds the attribute used to compute the bounding volume. The bounding volume is used internally - for picking and view frustum culling. - - If unspecified, the system will look for the attribute using the name returned by - QAttribute::defaultPositionAttributeName. - - \sa Attribute - */ -/*! - \qmlproperty list<Attribute> Geometry::attributes - - Holds the list of attributes the geometry comprises of. - */ - -/*! - \property QGeometry::boundingVolumePositionAttribute - - Holds the attribute used to compute the bounding volume. The bounding volume is used internally - for picking and view frustum culling. - - If unspecified, the system will look for the attribute using the name returned by - QAttribute::defaultPositionAttributeName. - - \sa Qt3DRender::QAttribute - */ - - -/*! - Constructs a new QGeometry with \a parent. - */ -QGeometry::QGeometry(QNode *parent) - : QGeometry(*new QGeometryPrivate(), parent) {} - -/*! - \fn Qt3DRender::QGeometryFactory::operator()() - - Returns the generated geometry. -*/ -/*! - \fn bool Qt3DRender::QGeometryFactory::operator==(const QGeometryFactory &other) const = 0 - - Compares the factory with the factory specified in \a other. - Returns true if they are equal. -*/ -/*! - \internal - */ -QGeometry::~QGeometry() -{ -} - -/*! - \internal - */ -QGeometry::QGeometry(QGeometryPrivate &dd, QNode *parent) - : QNode(dd, parent) -{ -} - -/*! - \fn void Qt3DRender::QGeometry::addAttribute(Qt3DRender::QAttribute *attribute) - Adds an \a attribute to this geometry. - */ -void QGeometry::addAttribute(QAttribute *attribute) -{ - Q_ASSERT(attribute); - Q_D(QGeometry); - if (!d->m_attributes.contains(attribute)) { - d->m_attributes.append(attribute); - - // Ensures proper bookkeeping - d->registerDestructionHelper(attribute, &QGeometry::removeAttribute, d->m_attributes); - - // We need to add it as a child of the current node if it has been declared inline - // Or not previously added as a child of the current node so that - // 1) The backend gets notified about it's creation - // 2) When the current node is destroyed, it gets destroyed as well - if (!attribute->parent()) - attribute->setParent(this); - - d->update(); - } -} - -/*! - \fn void Qt3DRender::QGeometry::removeAttribute(Qt3DRender::QAttribute *attribute) - Removes the given \a attribute from this geometry. - */ -void QGeometry::removeAttribute(QAttribute *attribute) -{ - Q_ASSERT(attribute); - Q_D(QGeometry); - d->m_attributes.removeOne(attribute); - // Remove bookkeeping connection - d->unregisterDestructionHelper(attribute); - d->update(); -} - -void QGeometry::setBoundingVolumePositionAttribute(QAttribute *boundingVolumePositionAttribute) -{ - Q_D(QGeometry); - if (d->m_boundingVolumePositionAttribute != boundingVolumePositionAttribute) { - d->m_boundingVolumePositionAttribute = boundingVolumePositionAttribute; - emit boundingVolumePositionAttributeChanged(boundingVolumePositionAttribute); - } -} - -QAttribute *QGeometry::boundingVolumePositionAttribute() const -{ - Q_D(const QGeometry); - return d->m_boundingVolumePositionAttribute; -} - -/*! - \qmlproperty vector3d Geometry::minExtent - - Holds the vertex with the lowest x, y, z position values. - */ - -/*! - \property QGeometry::minExtent - - Holds the vertex with the lowest x, y, z position values. - */ -QVector3D QGeometry::minExtent() const -{ - Q_D(const QGeometry); - return d->m_minExtent; -} - -/*! - \qmlproperty vector3d Geometry::maxExtent - - Holds the vertex with the highest x, y, z position values. - */ - -/*! - \property QGeometry::maxExtent - - Holds the vertex with the highest x, y, z position values. - */ -QVector3D QGeometry::maxExtent() const -{ - Q_D(const QGeometry); - return d->m_maxExtent; -} - -/*! - Returns the list of attributes in this geometry. - */ -QVector<QAttribute *> QGeometry::attributes() const -{ - Q_D(const QGeometry); - return d->m_attributes; -} - -} // namespace Qt3DRender - -QT_END_NAMESPACE - -#include "moc_qgeometry.cpp" diff --git a/src/render/geometry/qgeometry.h b/src/render/geometry/qgeometry.h deleted file mode 100644 index 442ec7d7a..000000000 --- a/src/render/geometry/qgeometry.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_QGEOMETRY_H -#define QT3DRENDER_QGEOMETRY_H - -#include <Qt3DCore/qnode.h> -#include <Qt3DRender/qt3drender_global.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -class QAttribute; -class QGeometryPrivate; - -class Q_3DRENDERSHARED_EXPORT QGeometry : public Qt3DCore::QNode -{ - Q_OBJECT - Q_PROPERTY(Qt3DRender::QAttribute *boundingVolumePositionAttribute READ boundingVolumePositionAttribute WRITE setBoundingVolumePositionAttribute NOTIFY boundingVolumePositionAttributeChanged) - Q_PROPERTY(QVector3D minExtent READ minExtent NOTIFY minExtentChanged REVISION 13) - Q_PROPERTY(QVector3D maxExtent READ maxExtent NOTIFY maxExtentChanged REVISION 13) -public: - explicit QGeometry(Qt3DCore::QNode *parent = nullptr); - ~QGeometry(); - - QVector<QAttribute *> attributes() const; - Q_INVOKABLE void addAttribute(Qt3DRender::QAttribute *attribute); - Q_INVOKABLE void removeAttribute(Qt3DRender::QAttribute *attribute); - - QAttribute *boundingVolumePositionAttribute() const; - QVector3D minExtent() const; - QVector3D maxExtent() const; - -public Q_SLOTS: - void setBoundingVolumePositionAttribute(QAttribute *boundingVolumePositionAttribute); - -Q_SIGNALS: - void boundingVolumePositionAttributeChanged(QAttribute *boundingVolumePositionAttribute); - Q_REVISION(13) void minExtentChanged(const QVector3D &minExtent); - Q_REVISION(13) void maxExtentChanged(const QVector3D &maxExtent); -protected: - explicit QGeometry(QGeometryPrivate &dd, Qt3DCore::QNode *parent = nullptr); - -private: - Q_DECLARE_PRIVATE(QGeometry) -}; - -} // namespace Qt3DRender - -QT_END_NAMESPACE - -#endif // QT3DRENDER_QGEOMETRY_H diff --git a/src/render/geometry/qgeometry_p.h b/src/render/geometry/qgeometry_p.h deleted file mode 100644 index 2b271292d..000000000 --- a/src/render/geometry/qgeometry_p.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_QGEOMETRY_P_H -#define QT3D_QGEOMETRY_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DRender/private/qt3drender_global_p.h> -#include <Qt3DCore/private/qnode_p.h> -#include <QVector3D> - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -class Q_3DRENDERSHARED_PRIVATE_EXPORT QGeometryPrivate : public Qt3DCore::QNodePrivate -{ -public: - Q_DECLARE_PUBLIC(QGeometry) - QGeometryPrivate(); - ~QGeometryPrivate(); - - void setExtent(const QVector3D &minExtent, const QVector3D &maxExtent); - - - QVector<QAttribute *> m_attributes; - QAttribute *m_boundingVolumePositionAttribute; - QVector3D m_minExtent; - QVector3D m_maxExtent; -}; - -} // namespace Qt3DRender - -QT_END_NAMESPACE - -#endif // QT3D_QGEOMETRY_P_H - diff --git a/src/render/geometry/qgeometryfactory_p.h b/src/render/geometry/qgeometryfactory_p.h deleted file mode 100644 index ac7900dba..000000000 --- a/src/render/geometry/qgeometryfactory_p.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_QGEOMETRYFACTORY -#define QT3DRENDER_QGEOMETRYFACTORY - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DRender/qt3drender_global.h> -#include <Qt3DRender/qabstractfunctor.h> -#include <QtCore/QSharedPointer> - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -class QGeometry; - -class Q_3DRENDERSHARED_EXPORT QGeometryFactory : public QAbstractFunctor -{ -public: - virtual ~QGeometryFactory(); - virtual QGeometry *operator()() = 0; - virtual bool operator ==(const QGeometryFactory &other) const = 0; -}; - -typedef QSharedPointer<QGeometryFactory> QGeometryFactoryPtr; - -} // namespace Qt3DRender - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(Qt3DRender::QGeometryFactoryPtr) // LCOV_EXCL_LINE - -#endif // QT3DRENDER_QGEOMETRYFACTORY - diff --git a/src/render/geometry/qgeometryrenderer.cpp b/src/render/geometry/qgeometryrenderer.cpp index 75e9b3a6a..11a5460d0 100644 --- a/src/render/geometry/qgeometryrenderer.cpp +++ b/src/render/geometry/qgeometryrenderer.cpp @@ -88,7 +88,7 @@ QGeometryRendererPrivate::~QGeometryRendererPrivate() \brief Encapsulates geometry rendering. A Qt3DRender::QGeometryRenderer holds all the information necessary to draw - a Qt3DRender::QGeometry. A QGeometry holds the coordinates of the geometry data - + a Qt3DCore::QGeometry. A QGeometry holds the coordinates of the geometry data - QGeometryRenderer specifies how to interpret that data. */ diff --git a/src/render/geometry/qgeometryrenderer.h b/src/render/geometry/qgeometryrenderer.h index 5a98329f6..435a315ad 100644 --- a/src/render/geometry/qgeometryrenderer.h +++ b/src/render/geometry/qgeometryrenderer.h @@ -41,11 +41,17 @@ #define QT3DRENDER_QGEOMETRYRENDERER_H #include <Qt3DCore/qcomponent.h> -#include <Qt3DRender/qgeometry.h> +#include <Qt3DCore/qgeometry.h> #include <Qt3DRender/qt3drender_global.h> QT_BEGIN_NAMESPACE +namespace Qt3DCore { +class QGeometryFactory; + +typedef QSharedPointer<QGeometryFactory> QGeometryFactoryPtr; +} + namespace Qt3DRender { class QGeometryRendererPrivate; @@ -62,7 +68,7 @@ class Q_3DRENDERSHARED_EXPORT QGeometryRenderer : public Qt3DCore::QComponent Q_PROPERTY(int restartIndexValue READ restartIndexValue WRITE setRestartIndexValue NOTIFY restartIndexValueChanged) Q_PROPERTY(int verticesPerPatch READ verticesPerPatch WRITE setVerticesPerPatch NOTIFY verticesPerPatchChanged) Q_PROPERTY(bool primitiveRestartEnabled READ primitiveRestartEnabled WRITE setPrimitiveRestartEnabled NOTIFY primitiveRestartEnabledChanged) - Q_PROPERTY(Qt3DRender::QGeometry* geometry READ geometry WRITE setGeometry NOTIFY geometryChanged) + Q_PROPERTY(Qt3DCore::QGeometry* geometry READ geometry WRITE setGeometry NOTIFY geometryChanged) Q_PROPERTY(PrimitiveType primitiveType READ primitiveType WRITE setPrimitiveType NOTIFY primitiveTypeChanged) public: @@ -97,7 +103,7 @@ public: int restartIndexValue() const; int verticesPerPatch() const; bool primitiveRestartEnabled() const; - QGeometry *geometry() const; + Qt3DCore::QGeometry *geometry() const; PrimitiveType primitiveType() const; public Q_SLOTS: @@ -110,7 +116,7 @@ public Q_SLOTS: void setRestartIndexValue(int index); void setVerticesPerPatch(int verticesPerPatch); void setPrimitiveRestartEnabled(bool enabled); - void setGeometry(QGeometry *geometry); + void setGeometry(Qt3DCore::QGeometry *geometry); void setPrimitiveType(PrimitiveType primitiveType); Q_SIGNALS: @@ -123,7 +129,7 @@ Q_SIGNALS: void restartIndexValueChanged(int restartIndexValue); void verticesPerPatchChanged(int verticesPerPatch); void primitiveRestartEnabledChanged(bool primitiveRestartEnabled); - void geometryChanged(QGeometry *geometry); + void geometryChanged(Qt3DCore::QGeometry *geometry); void primitiveTypeChanged(PrimitiveType primitiveType); protected: diff --git a/src/render/geometry/qgeometryrenderer_p.h b/src/render/geometry/qgeometryrenderer_p.h index 926eb24f7..ab2a3f0f8 100644 --- a/src/render/geometry/qgeometryrenderer_p.h +++ b/src/render/geometry/qgeometryrenderer_p.h @@ -51,9 +51,9 @@ // We mean it. // +#include <Qt3DCore/private/qgeometryfactory_p.h> #include <Qt3DCore/private/qcomponent_p.h> #include <Qt3DRender/qgeometryrenderer.h> -#include <Qt3DRender/private/qgeometryfactory_p.h> #include <Qt3DRender/private/qt3drender_global_p.h> #include <memory> @@ -78,9 +78,9 @@ public: int m_restartIndexValue; int m_verticesPerPatch; bool m_primitiveRestart; - QGeometry *m_geometry; + Qt3DCore::QGeometry *m_geometry; QGeometryRenderer::PrimitiveType m_primitiveType; - QGeometryFactoryPtr m_geometryFactory; + Qt3DCore::QGeometryFactoryPtr m_geometryFactory; }; } // namespace Qt3DRender diff --git a/src/render/geometry/qmesh.cpp b/src/render/geometry/qmesh.cpp index 531312fb1..1180380b0 100644 --- a/src/render/geometry/qmesh.cpp +++ b/src/render/geometry/qmesh.cpp @@ -52,11 +52,11 @@ #include <Qt3DCore/QAspectEngine> #include <Qt3DCore/private/qscene_p.h> #include <Qt3DCore/private/qdownloadhelperservice_p.h> +#include <Qt3DCore/private/qurlhelper_p.h> #include <Qt3DRender/private/qrenderaspect_p.h> #include <Qt3DRender/private/nodemanagers_p.h> #include <Qt3DRender/private/qgeometryloaderinterface_p.h> #include <Qt3DRender/private/renderlogging_p.h> -#include <Qt3DRender/private/qurlhelper_p.h> #include <Qt3DRender/private/qgeometryloaderfactory_p.h> #include <Qt3DRender/private/geometryrenderermanager_p.h> @@ -64,6 +64,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt3DCore; + namespace Qt3DRender { Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, geometryLoader, (QGeometryLoaderFactory_iid, QLatin1String("/geometryloaders"), Qt::CaseInsensitive)) @@ -291,7 +293,7 @@ MeshLoaderFunctor::MeshLoaderFunctor(QMesh *mesh, const QByteArray &sourceData) /*! * \internal */ -QGeometry *MeshLoaderFunctor::operator()() +Qt3DCore::QGeometry *MeshLoaderFunctor::operator()() { m_status = QMesh::Loading; @@ -329,7 +331,7 @@ QGeometry *MeshLoaderFunctor::operator()() if (!ext.contains(QLatin1String("obj"))) ext << QLatin1String("obj"); } else { - QString filePath = Qt3DRender::QUrlHelper::urlToLocalFileOrQrc(m_sourcePath); + QString filePath = Qt3DCore::QUrlHelper::urlToLocalFileOrQrc(m_sourcePath); QFileInfo finfo(filePath); if (finfo.suffix().isEmpty()) ext << QLatin1String("obj"); @@ -350,7 +352,7 @@ QGeometry *MeshLoaderFunctor::operator()() } if (m_sourceData.isEmpty()) { - QString filePath = Qt3DRender::QUrlHelper::urlToLocalFileOrQrc(m_sourcePath); + QString filePath = Qt3DCore::QUrlHelper::urlToLocalFileOrQrc(m_sourcePath); QFile file(filePath); if (!file.open(QIODevice::ReadOnly)) { qCDebug(Render::Jobs) << "Could not open file" << filePath << "for reading"; @@ -359,7 +361,7 @@ QGeometry *MeshLoaderFunctor::operator()() } if (loader->load(&file, m_meshName)) { - Qt3DRender::QGeometry *geometry = loader->geometry(); + Qt3DCore::QGeometry *geometry = loader->geometry(); m_status = geometry != nullptr ? QMesh::Ready : QMesh::Error; return geometry; } @@ -372,7 +374,7 @@ QGeometry *MeshLoaderFunctor::operator()() } if (loader->load(&buffer, m_meshName)) { - Qt3DRender::QGeometry *geometry = loader->geometry(); + Qt3DCore::QGeometry *geometry = loader->geometry(); m_status = geometry != nullptr ? QMesh::Ready : QMesh::Error; return geometry; } @@ -423,7 +425,7 @@ void MeshDownloadRequest::onCompleted() return; QGeometryFactoryPtr geometryFactory = renderer->geometryFactory(); - if (!geometryFactory.isNull() && geometryFactory->id() == Qt3DRender::functorTypeId<MeshLoaderFunctor>()) { + if (!geometryFactory.isNull() && geometryFactory->id() == Qt3DCore::functorTypeId<MeshLoaderFunctor>()) { QSharedPointer<MeshLoaderFunctor> functor = qSharedPointerCast<MeshLoaderFunctor>(geometryFactory); // We make sure we are setting the result for the right request diff --git a/src/render/geometry/qmesh_p.h b/src/render/geometry/qmesh_p.h index c80c930c5..9d34a6ae6 100644 --- a/src/render/geometry/qmesh_p.h +++ b/src/render/geometry/qmesh_p.h @@ -98,7 +98,7 @@ private: Render::NodeManagers *m_nodeManagers; }; -class Q_AUTOTEST_EXPORT MeshLoaderFunctor : public QGeometryFactory +class Q_AUTOTEST_EXPORT MeshLoaderFunctor : public Qt3DCore::QGeometryFactory { public : MeshLoaderFunctor(QMesh *mesh, const QByteArray &sourceData = QByteArray()); @@ -118,12 +118,9 @@ public : QMesh::Status status() const { return m_status; } - QGeometry *operator()() override; - bool operator ==(const QGeometryFactory &other) const override; - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED + Qt3DCore::QGeometry *operator()() override; + bool operator ==(const Qt3DCore::QGeometryFactory &other) const override; QT3D_FUNCTOR(MeshLoaderFunctor) - QT_WARNING_POP private: Qt3DCore::QNodeId m_mesh; |