summaryrefslogtreecommitdiffstats
path: root/src/render/geometry
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@kdab.com>2015-12-02 15:53:04 +0100
committerSean Harmer <sean.harmer@kdab.com>2015-12-02 22:06:36 +0000
commitc45b47e99eaf0bcecec606a304b338424d58561b (patch)
tree501e8e77c7f1462a44969c8b3c17acf72bdd645f /src/render/geometry
parent4ab78c9a125abc667a4166c58f9be2d72bdef5a7 (diff)
Move core/io content to render/geometry and io
Change-Id: I79e0b0d62e07a269ebfce99edff56d30da28494c Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/geometry')
-rw-r--r--src/render/geometry/attribute.cpp8
-rw-r--r--src/render/geometry/attribute_p.h8
-rw-r--r--src/render/geometry/geometry.cpp2
-rw-r--r--src/render/geometry/geometry.pri6
-rw-r--r--src/render/geometry/qabstractattribute.cpp274
-rw-r--r--src/render/geometry/qabstractattribute.h141
-rw-r--r--src/render/geometry/qabstractattribute_p.h84
-rw-r--r--src/render/geometry/qabstractbuffer.cpp95
-rw-r--r--src/render/geometry/qabstractbuffer.h75
-rw-r--r--src/render/geometry/qabstractbuffer_p.h75
-rw-r--r--src/render/geometry/qattribute.h4
-rw-r--r--src/render/geometry/qattribute_p.h2
-rw-r--r--src/render/geometry/qboundingvolumespecifier.cpp8
-rw-r--r--src/render/geometry/qboundingvolumespecifier.h11
-rw-r--r--src/render/geometry/qbuffer.h4
-rw-r--r--src/render/geometry/qbuffer_p.h2
-rw-r--r--src/render/geometry/qgeometry.cpp6
-rw-r--r--src/render/geometry/qgeometry.h11
-rw-r--r--src/render/geometry/qmesh.cpp4
19 files changed, 782 insertions, 38 deletions
diff --git a/src/render/geometry/attribute.cpp b/src/render/geometry/attribute.cpp
index bb568678f..fa7cfa444 100644
--- a/src/render/geometry/attribute.cpp
+++ b/src/render/geometry/attribute.cpp
@@ -47,13 +47,13 @@ namespace Render {
Attribute::Attribute()
: QBackendNode(ReadOnly)
- , m_dataType(Qt3DCore::QAbstractAttribute::Float)
+ , m_dataType(QAbstractAttribute::Float)
, m_dataSize(1)
, m_count(0)
, m_byteStride(0)
, m_byteOffset(0)
, m_divisor(0)
- , m_attributeType(Qt3DCore::QAbstractAttribute::VertexAttribute)
+ , m_attributeType(QAbstractAttribute::VertexAttribute)
, m_attributeDirty(false)
{
}
@@ -64,13 +64,13 @@ Attribute::~Attribute()
void Attribute::cleanup()
{
- m_dataType = Qt3DCore::QAbstractAttribute::Float;
+ m_dataType = QAbstractAttribute::Float;
m_dataSize = 1;
m_count = 0;
m_byteStride = 0;
m_byteOffset = 0;
m_divisor = 0;
- m_attributeType = Qt3DCore::QAbstractAttribute::VertexAttribute;
+ m_attributeType = QAbstractAttribute::VertexAttribute;
m_bufferId = Qt3DCore::QNodeId();
m_name.clear();
m_attributeDirty = false;
diff --git a/src/render/geometry/attribute_p.h b/src/render/geometry/attribute_p.h
index 8791d98a2..2320e97b0 100644
--- a/src/render/geometry/attribute_p.h
+++ b/src/render/geometry/attribute_p.h
@@ -70,26 +70,26 @@ public:
inline Qt3DCore::QNodeId bufferId() const { return m_bufferId; }
inline QString name() const { return m_name; }
- inline Qt3DCore::QAbstractAttribute::DataType dataType() const { return m_dataType; }
+ inline QAbstractAttribute::DataType dataType() const { return m_dataType; }
inline uint dataSize() const { return m_dataSize; }
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 Qt3DCore::QAbstractAttribute::AttributeType attributeType() const { return m_attributeType; }
+ inline QAbstractAttribute::AttributeType attributeType() const { return m_attributeType; }
inline bool isDirty() const { return m_attributeDirty; }
void unsetDirty();
private:
Qt3DCore::QNodeId m_bufferId;
QString m_name;
- Qt3DCore::QAbstractAttribute::DataType m_dataType;
+ QAbstractAttribute::DataType m_dataType;
uint m_dataSize;
uint m_count;
uint m_byteStride;
uint m_byteOffset;
uint m_divisor;
- Qt3DCore::QAbstractAttribute::AttributeType m_attributeType;
+ QAbstractAttribute::AttributeType m_attributeType;
bool m_attributeDirty;
};
diff --git a/src/render/geometry/geometry.cpp b/src/render/geometry/geometry.cpp
index 5209d9d26..02f7b0582 100644
--- a/src/render/geometry/geometry.cpp
+++ b/src/render/geometry/geometry.cpp
@@ -36,7 +36,7 @@
#include "geometry_p.h"
#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DCore/qabstractattribute.h>
+#include <Qt3DRender/qabstractattribute.h>
#include <Qt3DRender/qgeometry.h>
#include <Qt3DRender/qboundingvolumespecifier.h>
diff --git a/src/render/geometry/geometry.pri b/src/render/geometry/geometry.pri
index 81ee39c81..acc53474f 100644
--- a/src/render/geometry/geometry.pri
+++ b/src/render/geometry/geometry.pri
@@ -7,6 +7,10 @@ HEADERS += \
$$PWD/geometry_p.h \
$$PWD/geometryrenderer_p.h \
$$PWD/geometryrenderermanager_p.h \
+ $$PWD/qabstractattribute.h \
+ $$PWD/qabstractattribute_p.h \
+ $$PWD/qabstractbuffer.h \
+ $$PWD/qabstractbuffer_p.h \
$$PWD/qattribute.h \
$$PWD/qattribute_p.h \
$$PWD/qbuffer.h \
@@ -43,6 +47,8 @@ SOURCES += \
$$PWD/geometry.cpp \
$$PWD/geometryrenderer.cpp \
$$PWD/geometryrenderermanager.cpp \
+ $$PWD/qabstractattribute.cpp \
+ $$PWD/qabstractbuffer.cpp \
$$PWD/qattribute.cpp \
$$PWD/qbuffer.cpp \
$$PWD/qcuboidmesh.cpp \
diff --git a/src/render/geometry/qabstractattribute.cpp b/src/render/geometry/qabstractattribute.cpp
new file mode 100644
index 000000000..da3f413fd
--- /dev/null
+++ b/src/render/geometry/qabstractattribute.cpp
@@ -0,0 +1,274 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qabstractattribute.h"
+#include "qabstractattribute_p.h"
+#include "qabstractbuffer.h"
+
+#include <Qt3DCore/qscenepropertychange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3DRender::QAbstractAttributePrivate
+ \internal
+*/
+QAbstractAttributePrivate::QAbstractAttributePrivate()
+ : QNodePrivate()
+ , m_buffer(Q_NULLPTR)
+ , m_name()
+ , m_dataType(QAbstractAttribute::Float)
+ , m_dataSize(1)
+ , m_count(0)
+ , m_byteStride(0)
+ , m_byteOffset(0)
+ , m_divisor(0)
+ , m_attributeType(QAbstractAttribute::VertexAttribute)
+{
+}
+
+QAbstractAttribute::QAbstractAttribute(QNode *parent)
+ : QNode(*new QAbstractAttributePrivate(), parent)
+{
+}
+
+QAbstractAttribute::~QAbstractAttribute()
+{
+ Q_ASSERT_X(Qt3DCore::QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DRender::QAbstractAttribute subclass didn't call QNode::cleanup in its destructor");
+}
+
+QAbstractAttribute::QAbstractAttribute(QAbstractBuffer *buf, DataType type, uint dataSize, uint count, uint offset, uint stride, QNode *parent)
+ : QNode(*new QAbstractAttributePrivate(), parent)
+{
+ Q_D(QAbstractAttribute);
+ setBuffer(buf);
+ d->m_count = count;
+ d->m_byteOffset = offset;
+ d->m_dataType = type;
+ d->m_dataSize = dataSize;
+ d->m_byteStride = stride;
+}
+
+QAbstractAttribute::QAbstractAttribute(QAbstractAttributePrivate &dd, QNode *parent)
+ : QNode(dd, parent)
+{
+}
+
+QAbstractAttribute::QAbstractAttribute(QAbstractAttributePrivate &dd, QAbstractBuffer *buf, const QString &name, DataType dataType, uint dataSize, uint count, uint offset, uint stride, QNode *parent)
+ : QNode(dd, parent)
+{
+ Q_D(QAbstractAttribute);
+ setBuffer(buf);
+ d->m_name = name;
+ d->m_count = count;
+ d->m_byteOffset = offset;
+ d->m_dataType = dataType;
+ d->m_dataSize = dataSize;
+ d->m_byteStride = stride;
+}
+
+void QAbstractAttribute::copy(const QNode *ref)
+{
+ QNode::copy(ref);
+ const QAbstractAttribute *attribute = static_cast<const QAbstractAttribute *>(ref);
+ d_func()->m_buffer = qobject_cast<QAbstractBuffer *>(QNode::clone(attribute->d_func()->m_buffer));
+ d_func()->m_name = attribute->d_func()->m_name;
+ d_func()->m_count = attribute->d_func()->m_count;
+ d_func()->m_divisor = attribute->d_func()->m_divisor;
+ d_func()->m_byteOffset = attribute->d_func()->m_byteOffset;
+ d_func()->m_dataType = attribute->d_func()->m_dataType;
+ d_func()->m_dataSize = attribute->d_func()->m_dataSize;
+ d_func()->m_byteStride = attribute->d_func()->m_byteStride;
+ d_func()->m_attributeType = attribute->d_func()->m_attributeType;
+}
+
+QAbstractBuffer *QAbstractAttribute::buffer() const
+{
+ Q_D(const QAbstractAttribute);
+ return d->m_buffer;
+}
+
+QString QAbstractAttribute::name() const
+{
+ Q_D(const QAbstractAttribute);
+ return d->m_name;
+}
+
+uint QAbstractAttribute::dataSize() const
+{
+ Q_D(const QAbstractAttribute);
+ return d->m_dataSize;
+}
+
+QAbstractAttribute::DataType QAbstractAttribute::dataType() const
+{
+ Q_D(const QAbstractAttribute);
+ return d->m_dataType;
+}
+
+uint QAbstractAttribute::count() const
+{
+ Q_D(const QAbstractAttribute);
+ return d->m_count;
+}
+
+uint QAbstractAttribute::byteStride() const
+{
+ Q_D(const QAbstractAttribute);
+ return d->m_byteStride;
+}
+
+uint QAbstractAttribute::byteOffset() const
+{
+ Q_D(const QAbstractAttribute);
+ return d->m_byteOffset;
+}
+
+uint QAbstractAttribute::divisor() const
+{
+ Q_D(const QAbstractAttribute);
+ return d->m_divisor;
+}
+
+QAbstractAttribute::AttributeType QAbstractAttribute::attributeType() const
+{
+ Q_D(const QAbstractAttribute);
+ return d->m_attributeType;
+}
+
+void QAbstractAttribute::setBuffer(QAbstractBuffer *buffer)
+{
+ Q_D(QAbstractAttribute);
+ if (d->m_buffer == buffer)
+ return;
+
+ // 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;
+ emit bufferChanged();
+}
+
+void QAbstractAttribute::setName(const QString &name)
+{
+ Q_D(QAbstractAttribute);
+ if (d->m_name == name)
+ return;
+
+ d->m_name = name;
+ emit nameChanged();
+}
+
+void QAbstractAttribute::setDataType(DataType type)
+{
+ Q_D(QAbstractAttribute);
+
+ if (d->m_dataType == type)
+ return;
+
+ d->m_dataType = type;
+ emit dataTypeChanged();
+}
+
+void QAbstractAttribute::setDataSize(uint size)
+{
+ Q_D(QAbstractAttribute);
+ if (d->m_dataSize == size)
+ return;
+ Q_ASSERT(size >= 1 && size <= 4);
+ d->m_dataSize = size;
+ emit dataSizeChanged();
+}
+
+void QAbstractAttribute::setCount(uint count)
+{
+ Q_D(QAbstractAttribute);
+ if (d->m_count == count)
+ return;
+
+ d->m_count = count;
+ emit countChanged();
+}
+
+void QAbstractAttribute::setByteStride(uint byteStride)
+{
+ Q_D(QAbstractAttribute);
+ if (d->m_byteStride == byteStride)
+ return;
+
+ d->m_byteStride = byteStride;
+ emit byteStrideChanged();
+}
+
+void QAbstractAttribute::setByteOffset(uint byteOffset)
+{
+ Q_D(QAbstractAttribute);
+ if (d->m_byteOffset == byteOffset)
+ return;
+
+ d->m_byteOffset = byteOffset;
+ emit byteOffsetChanged();
+}
+
+void QAbstractAttribute::setDivisor(uint divisor)
+{
+ Q_D(QAbstractAttribute);
+ if (d->m_divisor == divisor)
+ return;
+
+ d->m_divisor = divisor;
+ emit divisorChanged();
+}
+
+void QAbstractAttribute::setAttributeType(AttributeType attributeType)
+{
+ Q_D(QAbstractAttribute);
+ if (d->m_attributeType == attributeType)
+ return;
+
+ d->m_attributeType = attributeType;
+ emit attributeTypeChanged();
+}
+
+} // Qt3D
+
+QT_END_NAMESPACE
diff --git a/src/render/geometry/qabstractattribute.h b/src/render/geometry/qabstractattribute.h
new file mode 100644
index 000000000..62ebdc0a5
--- /dev/null
+++ b/src/render/geometry/qabstractattribute.h
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QABSTRACTATTRIBUTE_H
+#define QT3DRENDER_QABSTRACTATTRIBUTE_H
+
+#include <Qt3DRender/qt3drender_global.h>
+#include <Qt3DCore/QNode>
+#include <QtCore/QSharedPointer>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAbstractBuffer;
+class QAbstractAttributePrivate;
+
+typedef QSharedPointer<QAbstractBuffer> QAbstractBufferPtr;
+
+class QT3DRENDERSHARED_EXPORT QAbstractAttribute : public Qt3DCore::QNode
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt3DRender::QAbstractBuffer *buffer READ buffer WRITE setBuffer NOTIFY bufferChanged)
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+ Q_PROPERTY(DataType dataType READ dataType WRITE setDataType NOTIFY dataTypeChanged)
+ Q_PROPERTY(uint dataSize READ dataSize WRITE setDataSize NOTIFY dataSizeChanged)
+ 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)
+
+public:
+ enum AttributeType {
+ VertexAttribute,
+ IndexAttribute
+ };
+
+ Q_ENUM(AttributeType)
+
+ enum DataType {
+ Byte = 0,
+ UnsignedByte,
+ Short,
+ UnsignedShort,
+ Int,
+ UnsignedInt,
+ HalfFloat,
+ Float,
+ Double
+ };
+ Q_ENUM(DataType)
+
+ explicit QAbstractAttribute(QNode *parent = 0);
+ ~QAbstractAttribute();
+ QAbstractAttribute(QAbstractBuffer *buf, DataType dataType, uint dataSize, uint count, uint offset = 0, uint stride = 0, QNode *parent = 0);
+
+ QAbstractBuffer *buffer() const;
+ QString name() const;
+ DataType dataType() const;
+ uint dataSize() const;
+ uint count() const;
+ uint byteStride() const;
+ uint byteOffset() const;
+ uint divisor() const;
+ AttributeType attributeType() const;
+
+ virtual QVector<QVector4D> asVector4D() const = 0;
+ virtual QVector<QVector3D> asVector3D() const = 0;
+ virtual QVector<QVector2D> asVector2D() const = 0;
+ virtual void dump(int count) = 0;
+
+ void setBuffer(QAbstractBuffer *buffer);
+ void setName(const QString &name);
+ void setDataType(DataType type);
+ void setDataSize(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();
+ void nameChanged();
+ void dataTypeChanged();
+ void dataSizeChanged();
+ void countChanged();
+ void byteStrideChanged();
+ void byteOffsetChanged();
+ void divisorChanged();
+ void attributeTypeChanged();
+
+protected:
+ QAbstractAttribute(QAbstractAttributePrivate &dd, QNode *parent = 0);
+ QAbstractAttribute(QAbstractAttributePrivate &dd, QAbstractBuffer *buf, const QString &name, DataType dataType, uint dataSize, uint count, uint offset = 0, uint stride = 0, QNode *parent = 0);
+
+ void copy(const QNode *ref) Q_DECL_OVERRIDE;
+
+private:
+ Q_DECLARE_PRIVATE(QAbstractAttribute)
+};
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QABSTRACTATTRIBUTE_H
diff --git a/src/render/geometry/qabstractattribute_p.h b/src/render/geometry/qabstractattribute_p.h
new file mode 100644
index 000000000..a9a2127ae
--- /dev/null
+++ b/src/render/geometry/qabstractattribute_p.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QABSTRACTATTRIBUTE_P_H
+#define QT3DRENDER_QABSTRACTATTRIBUTE_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/QAbstractAttribute>
+#include <Qt3DRender/QAbstractBuffer>
+#include <private/qnode_p.h>
+#include <private/qt3drender_global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAbstractAttribute;
+
+class QT3DRENDERSHARED_PRIVATE_EXPORT QAbstractAttributePrivate : public Qt3DCore::QNodePrivate
+{
+public:
+ Q_DECLARE_PUBLIC(QAbstractAttribute)
+
+ QAbstractAttributePrivate();
+
+ QAbstractBuffer *m_buffer;
+ QString m_name;
+ QAbstractAttribute::DataType m_dataType;
+ uint m_dataSize;
+ uint m_count;
+ uint m_byteStride;
+ uint m_byteOffset;
+ uint m_divisor;
+ QAbstractAttribute::AttributeType m_attributeType;
+};
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QABSTRACTATTRIBUTE_P_H
diff --git a/src/render/geometry/qabstractbuffer.cpp b/src/render/geometry/qabstractbuffer.cpp
new file mode 100644
index 000000000..815740aee
--- /dev/null
+++ b/src/render/geometry/qabstractbuffer.cpp
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qabstractbuffer.h"
+#include "qabstractbuffer_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3DCore::QAbstractBufferPrivate
+ \internal
+*/
+
+QAbstractBufferPrivate::QAbstractBufferPrivate()
+ : QNodePrivate()
+{
+}
+
+QAbstractBuffer::QAbstractBuffer(QNode *parent)
+ : QNode(*new QAbstractBufferPrivate(), parent)
+{
+}
+
+QAbstractBuffer::~QAbstractBuffer()
+{
+ Q_ASSERT_X(Qt3DCore::QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DRender::QAbstractBuffer subclass didn't call QNode::cleanup in its destructor");
+}
+
+/*! \internal */
+QAbstractBuffer::QAbstractBuffer(QAbstractBufferPrivate &dd, QNode *parent)
+ : QNode(dd, parent)
+{
+}
+
+void QAbstractBuffer::copy(const QNode *ref)
+{
+ QNode::copy(ref);
+ const QAbstractBuffer *buffer = static_cast<const QAbstractBuffer *>(ref);
+ d_func()->m_data = buffer->d_func()->m_data;
+}
+
+void QAbstractBuffer::setData(const QByteArray &bytes)
+{
+ Q_D(QAbstractBuffer);
+ if (bytes != d->m_data) {
+ d->m_data = bytes;
+ Qt3DCore::QNodePrivate::get(this)->notifyPropertyChange("data", QVariant::fromValue(d->m_data));
+ emit dataChanged();
+ }
+}
+
+QByteArray QAbstractBuffer::data() const
+{
+ Q_D(const QAbstractBuffer);
+ return d->m_data;
+}
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/geometry/qabstractbuffer.h b/src/render/geometry/qabstractbuffer.h
new file mode 100644
index 000000000..60609da99
--- /dev/null
+++ b/src/render/geometry/qabstractbuffer.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QABSTRACTBUFFER_H
+#define QT3DRENDER_QABSTRACTBUFFER_H
+
+#include <Qt3DRender/qt3drender_global.h>
+#include <Qt3DCore/QNode>
+#include <QtCore/QSharedPointer>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAbstractBufferPrivate;
+
+class QT3DRENDERSHARED_EXPORT QAbstractBuffer : public Qt3DCore::QNode
+{
+ Q_OBJECT
+public:
+ QAbstractBuffer(QNode *parent = 0);
+ virtual ~QAbstractBuffer();
+
+ void setData(const QByteArray &bytes);
+ QByteArray data() const;
+
+protected:
+ QAbstractBuffer(QAbstractBufferPrivate &dd, QNode *parent = 0);
+ void copy(const QNode *ref) Q_DECL_OVERRIDE;
+
+Q_SIGNALS:
+ void dataChanged();
+
+private:
+ Q_DECLARE_PRIVATE(QAbstractBuffer)
+};
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QABSTRACTBUFFER_H
diff --git a/src/render/geometry/qabstractbuffer_p.h b/src/render/geometry/qabstractbuffer_p.h
new file mode 100644
index 000000000..67ef0bb74
--- /dev/null
+++ b/src/render/geometry/qabstractbuffer_p.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QABSTRACTBUFFER_P_H
+#define QT3DRENDER_QABSTRACTBUFFER_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 <private/qnode_p.h>
+#include <private/qt3drender_global_p.h>
+
+#include <QByteArray>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAbstractBuffer;
+
+class QT3DRENDERSHARED_PRIVATE_EXPORT QAbstractBufferPrivate : public Qt3DCore::QNodePrivate
+{
+public:
+ Q_DECLARE_PUBLIC(QAbstractBuffer)
+
+ QAbstractBufferPrivate();
+ QByteArray m_data;
+};
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QABSTRACTBUFFER_P_H
diff --git a/src/render/geometry/qattribute.h b/src/render/geometry/qattribute.h
index 7634ddae5..005beb1fb 100644
--- a/src/render/geometry/qattribute.h
+++ b/src/render/geometry/qattribute.h
@@ -37,7 +37,7 @@
#ifndef QT3DRENDER_QATTRIBUTE_H
#define QT3DRENDER_QATTRIBUTE_H
-#include <Qt3DCore/qabstractattribute.h>
+#include <Qt3DRender/qabstractattribute.h>
#include <Qt3DRender/qt3drender_global.h>
#include <QtCore/QSharedPointer>
@@ -48,7 +48,7 @@ namespace Qt3DRender {
class QAttributePrivate;
class QBuffer;
-class QT3DRENDERSHARED_EXPORT QAttribute : public Qt3DCore::QAbstractAttribute
+class QT3DRENDERSHARED_EXPORT QAttribute : public QAbstractAttribute
{
Q_OBJECT
diff --git a/src/render/geometry/qattribute_p.h b/src/render/geometry/qattribute_p.h
index 3d481e467..a64adfd8b 100644
--- a/src/render/geometry/qattribute_p.h
+++ b/src/render/geometry/qattribute_p.h
@@ -57,7 +57,7 @@ namespace Qt3DRender {
class QAttribute;
-class QT3DRENDERSHARED_EXPORT QAttributePrivate : public Qt3DCore::QAbstractAttributePrivate
+class QT3DRENDERSHARED_EXPORT QAttributePrivate : public QAbstractAttributePrivate
{
public:
QAttributePrivate();
diff --git a/src/render/geometry/qboundingvolumespecifier.cpp b/src/render/geometry/qboundingvolumespecifier.cpp
index 2c6662eee..b1900aa12 100644
--- a/src/render/geometry/qboundingvolumespecifier.cpp
+++ b/src/render/geometry/qboundingvolumespecifier.cpp
@@ -36,7 +36,7 @@
#include "qboundingvolumespecifier.h"
#include <private/qobject_p.h>
-#include <Qt3DCore/qabstractattribute.h>
+#include <Qt3DRender/qabstractattribute.h>
QT_BEGIN_NAMESPACE
@@ -50,7 +50,7 @@ public:
, m_positionAttribute(Q_NULLPTR)
{}
- Qt3DCore::QAbstractAttribute *m_positionAttribute;
+ QAbstractAttribute *m_positionAttribute;
};
QBoundingVolumeSpecifier::QBoundingVolumeSpecifier(QObject *parent)
@@ -58,13 +58,13 @@ QBoundingVolumeSpecifier::QBoundingVolumeSpecifier(QObject *parent)
{
}
-Qt3DCore::QAbstractAttribute *QBoundingVolumeSpecifier::positionAttribute() const
+QAbstractAttribute *QBoundingVolumeSpecifier::positionAttribute() const
{
Q_D(const QBoundingVolumeSpecifier);
return d->m_positionAttribute;
}
-void QBoundingVolumeSpecifier::setPositionAttribute(Qt3DCore::QAbstractAttribute *positionAttribute)
+void QBoundingVolumeSpecifier::setPositionAttribute(QAbstractAttribute *positionAttribute)
{
Q_D(QBoundingVolumeSpecifier);
if (positionAttribute != d->m_positionAttribute) {
diff --git a/src/render/geometry/qboundingvolumespecifier.h b/src/render/geometry/qboundingvolumespecifier.h
index 3ff43a262..42dc0aacb 100644
--- a/src/render/geometry/qboundingvolumespecifier.h
+++ b/src/render/geometry/qboundingvolumespecifier.h
@@ -42,23 +42,20 @@
QT_BEGIN_NAMESPACE
-namespace Qt3DCore {
-class QAbstractAttribute;
-}
-
namespace Qt3DRender {
+class QAbstractAttribute;
class QBoundingVolumeSpecifierPrivate;
class QT3DRENDERSHARED_EXPORT QBoundingVolumeSpecifier : public QObject
{
Q_OBJECT
- Q_PROPERTY(Qt3DCore::QAbstractAttribute *positionAttribute READ positionAttribute WRITE setPositionAttribute NOTIFY positionAttributeChanged)
+ Q_PROPERTY(Qt3DRender::QAbstractAttribute *positionAttribute READ positionAttribute WRITE setPositionAttribute NOTIFY positionAttributeChanged)
public:
explicit QBoundingVolumeSpecifier(QObject *parent = 0);
- Qt3DCore::QAbstractAttribute *positionAttribute() const;
- void setPositionAttribute(Qt3DCore::QAbstractAttribute *positionAttribute);
+ QAbstractAttribute *positionAttribute() const;
+ void setPositionAttribute(QAbstractAttribute *positionAttribute);
Q_SIGNALS:
void positionAttributeChanged();
diff --git a/src/render/geometry/qbuffer.h b/src/render/geometry/qbuffer.h
index b73eae34d..4c205cb95 100644
--- a/src/render/geometry/qbuffer.h
+++ b/src/render/geometry/qbuffer.h
@@ -37,7 +37,7 @@
#ifndef QT3DRENDER_QBUFFER_H
#define QT3DRENDER_QBUFFER_H
-#include <Qt3DCore/qabstractbuffer.h>
+#include <Qt3DRender/qabstractbuffer.h>
#include <Qt3DRender/qt3drender_global.h>
#include <QSharedPointer>
@@ -49,7 +49,7 @@ class QBufferPrivate;
class QBufferFunctor;
typedef QSharedPointer<QBufferFunctor> QBufferFunctorPtr;
-class QT3DRENDERSHARED_EXPORT QBuffer : public Qt3DCore::QAbstractBuffer
+class QT3DRENDERSHARED_EXPORT QBuffer : public QAbstractBuffer
{
Q_OBJECT
Q_PROPERTY(BufferType type READ type WRITE setType NOTIFY typeChanged)
diff --git a/src/render/geometry/qbuffer_p.h b/src/render/geometry/qbuffer_p.h
index f1f0c1e8e..31d66c744 100644
--- a/src/render/geometry/qbuffer_p.h
+++ b/src/render/geometry/qbuffer_p.h
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_EXPORT QBufferPrivate : public Qt3DCore::QAbstractBufferPrivate
+class QT3DRENDERSHARED_EXPORT QBufferPrivate : public QAbstractBufferPrivate
{
public:
QBufferPrivate();
diff --git a/src/render/geometry/qgeometry.cpp b/src/render/geometry/qgeometry.cpp
index af76a6b5f..0dca93336 100644
--- a/src/render/geometry/qgeometry.cpp
+++ b/src/render/geometry/qgeometry.cpp
@@ -37,8 +37,8 @@
#include "qgeometry.h"
#include "qgeometry_p.h"
#include <private/qnode_p.h>
-#include <Qt3DCore/qabstractattribute.h>
#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRender/qabstractattribute.h>
#include <Qt3DRender/qboundingvolumespecifier.h>
QT_BEGIN_NAMESPACE
@@ -81,7 +81,7 @@ QGeometry::~QGeometry()
QNode::cleanup();
}
-void QGeometry::addAttribute(Qt3DCore::QAbstractAttribute *attribute)
+void QGeometry::addAttribute(QAbstractAttribute *attribute)
{
Q_D(QGeometry);
if (!d->m_attributes.contains(attribute)) {
@@ -103,7 +103,7 @@ void QGeometry::addAttribute(Qt3DCore::QAbstractAttribute *attribute)
}
}
-void QGeometry::removeAttribute(Qt3DCore::QAbstractAttribute *attribute)
+void QGeometry::removeAttribute(QAbstractAttribute *attribute)
{
Q_D(QGeometry);
if (d->m_changeArbiter != Q_NULLPTR) {
diff --git a/src/render/geometry/qgeometry.h b/src/render/geometry/qgeometry.h
index 434bdcb78..f2ba6575e 100644
--- a/src/render/geometry/qgeometry.h
+++ b/src/render/geometry/qgeometry.h
@@ -42,16 +42,13 @@
QT_BEGIN_NAMESPACE
-namespace Qt3DCore {
-class QAbstractAttribute;
-}
-
namespace Qt3DRender {
+class QAbstractAttribute;
class QGeometryPrivate;
class QBoundingVolumeSpecifier;
-typedef QVector<Qt3DCore::QAbstractAttribute *> QAttributeList;
+typedef QVector<QAbstractAttribute *> QAttributeList;
class QT3DRENDERSHARED_EXPORT QGeometry : public Qt3DCore::QNode
{
@@ -63,8 +60,8 @@ public:
~QGeometry();
QAttributeList attributes() const;
- void addAttribute(Qt3DCore::QAbstractAttribute *attribute);
- void removeAttribute(Qt3DCore::QAbstractAttribute *attribute);
+ void addAttribute(QAbstractAttribute *attribute);
+ void removeAttribute(QAbstractAttribute *attribute);
void setVerticesPerPatch(int verticesPerPatch);
int verticesPerPatch() const;
diff --git a/src/render/geometry/qmesh.cpp b/src/render/geometry/qmesh.cpp
index e0d3629a9..bb45b61a7 100644
--- a/src/render/geometry/qmesh.cpp
+++ b/src/render/geometry/qmesh.cpp
@@ -43,7 +43,7 @@
#include <Qt3DRender/private/objloader_p.h>
#include <Qt3DCore/qscenepropertychange.h>
#include <Qt3DRender/private/renderlogging_p.h>
-#include <Qt3DCore/private/qurlhelper_p.h>
+#include <Qt3DRender/private/qurlhelper_p.h>
QT_BEGIN_NAMESPACE
@@ -144,7 +144,7 @@ QGeometry *MeshFunctor::operator()()
// TO DO: Handle file download if remote url
- QString filePath = Qt3DCore::QUrlHelper::urlToLocalFileOrQrc(m_sourcePath);
+ QString filePath = Qt3DRender::QUrlHelper::urlToLocalFileOrQrc(m_sourcePath);
if (loader.load(filePath, m_subMesh))
return loader.geometry();