diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2016-02-25 15:54:36 +0100 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2016-02-29 14:51:33 +0000 |
commit | c3f21b4e2834fd257157728e306aef11f06e01d8 (patch) | |
tree | 77eb89e5906a8a076345a7b4825cd1ee0c8c852a /src | |
parent | 7994e86c0e6fd14954cc4a6092509132251cb006 (diff) |
QAttribute API changes
- rename dataType to vertexBaseType
- rename dataSize to vertexSize
Change-Id: I0eca7054dd69e8aac69bc1d7d5023a7ca6ca9da2
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/sceneparsers/assimp/assimpparser.cpp | 2 | ||||
-rw-r--r-- | src/plugins/sceneparsers/gltf/gltfparser.cpp | 2 | ||||
-rw-r--r-- | src/plugins/sceneparsers/gltf/gltfparser.h | 4 | ||||
-rw-r--r-- | src/render/backend/renderer.cpp | 2 | ||||
-rw-r--r-- | src/render/backend/trianglesvisitor.cpp | 14 | ||||
-rw-r--r-- | src/render/frontend/qitemmodelbuffer.cpp | 4 | ||||
-rw-r--r-- | src/render/geometry/attribute.cpp | 20 | ||||
-rw-r--r-- | src/render/geometry/attribute_p.h | 8 | ||||
-rw-r--r-- | src/render/geometry/qattribute.cpp | 10 | ||||
-rw-r--r-- | src/render/geometry/qattribute.h | 22 | ||||
-rw-r--r-- | src/render/geometry/qattribute_p.h | 2 | ||||
-rw-r--r-- | src/render/graphicshelpers/graphicscontext.cpp | 6 | ||||
-rw-r--r-- | src/render/graphicshelpers/graphicscontext_p.h | 2 | ||||
-rw-r--r-- | src/render/io/objloader.cpp | 2 | ||||
-rw-r--r-- | src/render/jobs/calcboundingvolumejob.cpp | 8 |
15 files changed, 54 insertions, 54 deletions
diff --git a/src/plugins/sceneparsers/assimp/assimpparser.cpp b/src/plugins/sceneparsers/assimp/assimpparser.cpp index 5cf65251b..e506372e9 100644 --- a/src/plugins/sceneparsers/assimp/assimpparser.cpp +++ b/src/plugins/sceneparsers/assimp/assimpparser.cpp @@ -627,7 +627,7 @@ void AssimpParser::loadMesh(uint meshIndex) meshGeometry->addAttribute(colorAttribute); } - QAttribute::DataType indiceType; + QAttribute::VertexBaseType indiceType; QByteArray ibufferContent; uint indices = mesh->mNumFaces * 3; // If there are less than 65535 indices, indices can then fit in ushort diff --git a/src/plugins/sceneparsers/gltf/gltfparser.cpp b/src/plugins/sceneparsers/gltf/gltfparser.cpp index 6edb8a7c2..5a6c10025 100644 --- a/src/plugins/sceneparsers/gltf/gltfparser.cpp +++ b/src/plugins/sceneparsers/gltf/gltfparser.cpp @@ -1380,7 +1380,7 @@ QVariant GLTFParser::parameterValueFromJSON(int type, const QJsonValue &value) c return QVariant(); } -QAttribute::DataType GLTFParser::accessorTypeFromJSON(int componentType) +QAttribute::VertexBaseType GLTFParser::accessorTypeFromJSON(int componentType) { if (componentType == GL_BYTE) { return QAttribute::Byte; diff --git a/src/plugins/sceneparsers/gltf/gltfparser.h b/src/plugins/sceneparsers/gltf/gltfparser.h index 68fd839e5..ff2a9baec 100644 --- a/src/plugins/sceneparsers/gltf/gltfparser.h +++ b/src/plugins/sceneparsers/gltf/gltfparser.h @@ -130,7 +130,7 @@ private: AccessorData(const QJsonObject& json); QString bufferViewName; - QAttribute::DataType type; + QAttribute::VertexBaseType type; uint dataSize; int count; int offset; @@ -166,7 +166,7 @@ private: QFile* resolveLocalData(QString path) const; QVariant parameterValueFromJSON(int type, const QJsonValue &value) const; - static QAttribute::DataType accessorTypeFromJSON(int componentType); + static QAttribute::VertexBaseType accessorTypeFromJSON(int componentType); static uint accessorDataSizeFromJson(const QString &type); static QRenderState *buildStateEnable(int state); diff --git a/src/render/backend/renderer.cpp b/src/render/backend/renderer.cpp index a519db502..570560feb 100644 --- a/src/render/backend/renderer.cpp +++ b/src/render/backend/renderer.cpp @@ -797,7 +797,7 @@ void Renderer::performDraw(Geometry *rGeometry, GeometryRenderer *rGeometryRende { const GLint primType = rGeometryRenderer->primitiveType(); const bool drawIndexed = indexAttribute != Q_NULLPTR; - const GLint indexType = drawIndexed ? GraphicsContext::glDataTypeFromAttributeDataType(indexAttribute->dataType()) : 0; + const GLint indexType = drawIndexed ? GraphicsContext::glDataTypeFromAttributeDataType(indexAttribute->vertexBaseType()) : 0; if (rGeometryRenderer->primitiveType() == QGeometryRenderer::Patches) m_graphicsContext->setVerticesPerPatch(rGeometry->verticesPerPatch()); diff --git a/src/render/backend/trianglesvisitor.cpp b/src/render/backend/trianglesvisitor.cpp index 4465e501d..701b4a566 100644 --- a/src/render/backend/trianglesvisitor.cpp +++ b/src/render/backend/trianglesvisitor.cpp @@ -74,7 +74,7 @@ bool isTriangleBased(Qt3DRender::QGeometryRenderer::PrimitiveType type) Q_DECL_N struct BufferInfo { BufferInfo() - : type(QAttribute::DataType::Float) + : type(QAttribute::VertexBaseType::Float) , dataSize(0) , count(0) , byteStride(0) @@ -82,7 +82,7 @@ struct BufferInfo {} QByteArray data; - QAttribute::DataType type; + QAttribute::VertexBaseType type; uint dataSize; uint count; uint byteStride; @@ -314,7 +314,7 @@ void traverseTriangleAdjacency(Vertex *vertices, } -template <QAttribute::DataType> struct EnumToType; +template <QAttribute::VertexBaseType> struct EnumToType; template <> struct EnumToType<QAttribute::Byte> { typedef const char type; }; template <> struct EnumToType<QAttribute::UnsignedByte> { typedef const uchar type; }; template <> struct EnumToType<QAttribute::Short> { typedef const short type; }; @@ -324,7 +324,7 @@ template <> struct EnumToType<QAttribute::UnsignedInt> { typedef const uint type template <> struct EnumToType<QAttribute::Float> { typedef const float type; }; template <> struct EnumToType<QAttribute::Double> { typedef const double type; }; -template<QAttribute::DataType v> +template<QAttribute::VertexBaseType v> typename EnumToType<v>::type *castToType(const QByteArray &u, uint byteOffset) { return reinterpret_cast< typename EnumToType<v>::type *>(u.constData() + byteOffset); @@ -478,17 +478,17 @@ void TrianglesVisitor::apply(const GeometryRenderer *renderer, const Qt3DCore::Q BufferInfo vertexBufferInfo; vertexBufferInfo.data = positionBuffer->data(); - vertexBufferInfo.type = positionAttribute->dataType(); + vertexBufferInfo.type = positionAttribute->vertexBaseType(); vertexBufferInfo.byteOffset = positionAttribute->byteOffset(); vertexBufferInfo.byteStride = positionAttribute->byteStride(); - vertexBufferInfo.dataSize = positionAttribute->dataSize(); + vertexBufferInfo.dataSize = positionAttribute->vertexSize(); vertexBufferInfo.count = positionAttribute->count(); if (indexBuffer) { // Indexed BufferInfo indexBufferInfo; indexBufferInfo.data = indexBuffer->data(); - indexBufferInfo.type = indexAttribute->dataType(); + indexBufferInfo.type = indexAttribute->vertexBaseType(); indexBufferInfo.byteOffset = indexAttribute->byteOffset(); indexBufferInfo.byteStride = indexAttribute->byteStride(); indexBufferInfo.count = indexAttribute->count(); diff --git a/src/render/frontend/qitemmodelbuffer.cpp b/src/render/frontend/qitemmodelbuffer.cpp index 95d904aad..d21e0d66b 100644 --- a/src/render/frontend/qitemmodelbuffer.cpp +++ b/src/render/frontend/qitemmodelbuffer.cpp @@ -114,7 +114,7 @@ void variantToBytes(void* dest, const QVariant& v, GLint type) namespace { -QAttribute::DataType typeFromGLType(GLint dataType, uint &dataCount) +QAttribute::VertexBaseType typeFromGLType(GLint dataType, uint &dataCount) { switch (dataType) { @@ -236,7 +236,7 @@ QBuffer *QItemModelBuffer::buffer() for (int m=0; m<mappingCount; ++m) { const RoleMapping mapping(m_mappings.at(m)); uint dataSize = 0; - QAttribute::DataType dataType = typeFromGLType(mapping.type, dataSize); + QAttribute::VertexBaseType dataType = typeFromGLType(mapping.type, dataSize); QAttribute *attr(new QAttribute(m_buffer, dataType, dataSize, rowCount, offset, m_itemStride)); diff --git a/src/render/geometry/attribute.cpp b/src/render/geometry/attribute.cpp index c49757d22..30a8c377f 100644 --- a/src/render/geometry/attribute.cpp +++ b/src/render/geometry/attribute.cpp @@ -52,8 +52,8 @@ namespace Render { Attribute::Attribute() : BackendNode(ReadOnly) , m_nameId(0) - , m_dataType(QAttribute::Float) - , m_dataSize(1) + , m_vertexDataType(QAttribute::Float) + , m_vertexSize(1) , m_count(0) , m_byteStride(0) , m_byteOffset(0) @@ -69,8 +69,8 @@ Attribute::~Attribute() void Attribute::cleanup() { - m_dataType = QAttribute::Float; - m_dataSize = 1; + m_vertexDataType = QAttribute::Float; + m_vertexSize = 1; m_count = 0; m_byteStride = 0; m_byteOffset = 0; @@ -86,8 +86,8 @@ void Attribute::updateFromPeer(Qt3DCore::QNode *peer) { QAttribute *attribute = static_cast<QAttribute *>(peer); if (attribute) { - m_dataType = attribute->dataType(); - m_dataSize = attribute->dataSize(); + m_vertexDataType = attribute->vertexBaseType(); + m_vertexSize = attribute->vertexSize(); m_count = attribute->count(); m_byteOffset = attribute->byteOffset(); m_byteStride = attribute->byteStride(); @@ -113,11 +113,11 @@ void Attribute::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) m_name = propertyChange->value().value<QString>(); m_nameId = StringToInt::lookupId(m_name); m_attributeDirty = true; - } else if (propertyName == QByteArrayLiteral("dataType")) { - m_dataType = static_cast<QAttribute::DataType>(propertyChange->value().value<int>()); + } else if (propertyName == QByteArrayLiteral("vertexBaseType")) { + m_vertexDataType = static_cast<QAttribute::VertexBaseType>(propertyChange->value().value<int>()); m_attributeDirty = true; - } else if (propertyName == QByteArrayLiteral("dataSize")) { - m_dataSize = propertyChange->value().value<uint>(); + } else if (propertyName == QByteArrayLiteral("vertexSize")) { + m_vertexSize = propertyChange->value().value<uint>(); m_attributeDirty = true; } else if (propertyName == QByteArrayLiteral("count")) { m_count = propertyChange->value().value<uint>(); diff --git a/src/render/geometry/attribute_p.h b/src/render/geometry/attribute_p.h index 10fda4542..881754197 100644 --- a/src/render/geometry/attribute_p.h +++ b/src/render/geometry/attribute_p.h @@ -74,8 +74,8 @@ 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::DataType dataType() const { return m_dataType; } - inline uint dataSize() const { return m_dataSize; } + inline QAttribute::VertexBaseType vertexBaseType() const { return m_vertexDataType; } + 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; } @@ -88,8 +88,8 @@ private: Qt3DCore::QNodeId m_bufferId; QString m_name; int m_nameId; - QAttribute::DataType m_dataType; - uint m_dataSize; + QAttribute::VertexBaseType m_vertexDataType; + uint m_vertexSize; uint m_count; uint m_byteStride; uint m_byteOffset; diff --git a/src/render/geometry/qattribute.cpp b/src/render/geometry/qattribute.cpp index 944cf85fe..3f94bff52 100644 --- a/src/render/geometry/qattribute.cpp +++ b/src/render/geometry/qattribute.cpp @@ -126,7 +126,7 @@ QAttribute::~QAttribute() * 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, DataType type, uint dataSize, uint count, uint offset, uint stride, QNode *parent) +QAttribute::QAttribute(QBuffer *buf, VertexBaseType type, uint dataSize, uint count, uint offset, uint stride, QNode *parent) : QNode(*new QAttributePrivate(), parent) { Q_D(QAttribute); @@ -143,7 +143,7 @@ QAttribute::QAttribute(QBuffer *buf, DataType type, uint dataSize, uint count, u * 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, DataType type, uint dataSize, uint count, uint offset, uint stride, QNode *parent) +QAttribute::QAttribute(QBuffer *buf, const QString &name, VertexBaseType type, uint dataSize, uint count, uint offset, uint stride, QNode *parent) : QNode(*new QAttributePrivate(), parent) { Q_D(QAttribute); @@ -202,7 +202,7 @@ QString QAttribute::name() const * * Holds the data size. */ -uint QAttribute::dataSize() const +uint QAttribute::vertexSize() const { Q_D(const QAttribute); return d->m_dataSize; @@ -213,7 +213,7 @@ uint QAttribute::dataSize() const * * Holds the data type. */ -QAttribute::DataType QAttribute::dataType() const +QAttribute::VertexBaseType QAttribute::vertexBaseType() const { Q_D(const QAttribute); return d->m_dataType; @@ -301,7 +301,7 @@ void QAttribute::setName(const QString &name) emit nameChanged(name); } -void QAttribute::setDataType(DataType type) +void QAttribute::setDataType(VertexBaseType type) { Q_D(QAttribute); diff --git a/src/render/geometry/qattribute.h b/src/render/geometry/qattribute.h index bcc2cc4b4..6209225d0 100644 --- a/src/render/geometry/qattribute.h +++ b/src/render/geometry/qattribute.h @@ -58,8 +58,8 @@ class QT3DRENDERSHARED_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(DataType dataType READ dataType WRITE setDataType NOTIFY dataTypeChanged) - Q_PROPERTY(uint dataSize READ dataSize WRITE setDataSize NOTIFY dataSizeChanged) + Q_PROPERTY(VertexBaseType vertexBaseType READ vertexBaseType WRITE setDataType NOTIFY dataTypeChanged) + Q_PROPERTY(uint vertexSize READ vertexSize 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) @@ -74,7 +74,7 @@ public: Q_ENUM(AttributeType) - enum DataType { + enum VertexBaseType { Byte = 0, UnsignedByte, Short, @@ -85,17 +85,17 @@ public: Float, Double }; - Q_ENUM(DataType) + Q_ENUM(VertexBaseType) explicit QAttribute(QNode *parent = 0); - explicit QAttribute(QBuffer *buf, DataType dataType, uint dataSize, uint count, uint offset = 0, uint stride = 0, QNode *parent = 0); - explicit QAttribute(QBuffer *buf, const QString &name, DataType dataType, uint dataSize, uint count, uint offset = 0, uint stride = 0, QNode *parent = 0); + explicit QAttribute(QBuffer *buf, VertexBaseType vertexBaseType, uint vertexSize, uint count, uint offset = 0, uint stride = 0, QNode *parent = 0); + explicit QAttribute(QBuffer *buf, const QString &name, VertexBaseType vertexBaseType, uint vertexSize, uint count, uint offset = 0, uint stride = 0, QNode *parent = 0); ~QAttribute(); QBuffer *buffer() const; QString name() const; - DataType dataType() const; - uint dataSize() const; + VertexBaseType vertexBaseType() const; + uint vertexSize() const; uint count() const; uint byteStride() const; uint byteOffset() const; @@ -111,7 +111,7 @@ public: public Q_SLOTS: void setBuffer(QBuffer *buffer); void setName(const QString &name); - void setDataType(DataType type); + void setDataType(VertexBaseType type); void setDataSize(uint size); void setCount(uint count); void setByteStride(uint byteStride); @@ -122,8 +122,8 @@ public Q_SLOTS: Q_SIGNALS: void bufferChanged(QBuffer *buffer); void nameChanged(const QString &name); - void dataTypeChanged(DataType dataType); - void dataSizeChanged(uint dataSize); + void dataTypeChanged(VertexBaseType vertexBaseType); + void dataSizeChanged(uint vertexSize); void countChanged(uint count); void byteStrideChanged(uint byteStride); void byteOffsetChanged(uint byteOffset); diff --git a/src/render/geometry/qattribute_p.h b/src/render/geometry/qattribute_p.h index a5a7f00b8..02b03987d 100644 --- a/src/render/geometry/qattribute_p.h +++ b/src/render/geometry/qattribute_p.h @@ -71,7 +71,7 @@ public: QBuffer *m_buffer; QString m_name; - QAttribute::DataType m_dataType; + QAttribute::VertexBaseType m_dataType; uint m_dataSize; uint m_count; uint m_byteStride; diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp index 1f70a426b..daa1d1e02 100644 --- a/src/render/graphicshelpers/graphicscontext.cpp +++ b/src/render/graphicshelpers/graphicscontext.cpp @@ -1051,9 +1051,9 @@ void GraphicsContext::specifyAttribute(const Attribute *attribute, Buffer *buffe } prog->enableAttributeArray(location); prog->setAttributeBuffer(location, - glDataTypeFromAttributeDataType(attribute->dataType()), + glDataTypeFromAttributeDataType(attribute->vertexBaseType()), attribute->byteOffset(), - attribute->dataSize(), + attribute->vertexSize(), attribute->byteStride()); if (attribute->divisor() != 0) { @@ -1202,7 +1202,7 @@ GLuint GraphicsContext::byteSizeFromType(GLint type) return 0; } -GLint GraphicsContext::glDataTypeFromAttributeDataType(QAttribute::DataType dataType) +GLint GraphicsContext::glDataTypeFromAttributeDataType(QAttribute::VertexBaseType dataType) { switch (dataType) { case QAttribute::Byte: diff --git a/src/render/graphicshelpers/graphicscontext_p.h b/src/render/graphicshelpers/graphicscontext_p.h index 169553241..4795bfb73 100644 --- a/src/render/graphicshelpers/graphicscontext_p.h +++ b/src/render/graphicshelpers/graphicscontext_p.h @@ -212,7 +212,7 @@ public: static GLint elementType(GLint type); static GLint tupleSizeFromType(GLint type); static GLuint byteSizeFromType(GLint type); - static GLint glDataTypeFromAttributeDataType(QAttribute::DataType dataType); + static GLint glDataTypeFromAttributeDataType(QAttribute::VertexBaseType dataType); bool supportsDrawBuffersBlend() const; bool supportsVAO() const { return m_supportsVAO; } diff --git a/src/render/io/objloader.cpp b/src/render/io/objloader.cpp index f0b79fda1..1026afd10 100644 --- a/src/render/io/objloader.cpp +++ b/src/render/io/objloader.cpp @@ -412,7 +412,7 @@ QGeometry *ObjLoader::geometry() const } QByteArray indexBytes; - QAttribute::DataType ty; + QAttribute::VertexBaseType ty; if (m_indices.size() < 65536) { // we can use USHORT ty = QAttribute::UnsignedShort; diff --git a/src/render/jobs/calcboundingvolumejob.cpp b/src/render/jobs/calcboundingvolumejob.cpp index f876e2d0d..7bc67f25a 100644 --- a/src/render/jobs/calcboundingvolumejob.cpp +++ b/src/render/jobs/calcboundingvolumejob.cpp @@ -97,8 +97,8 @@ void calculateLocalBoundingVolume(NodeManagers *manager, Entity *node) if (pickVolumeAttribute) { if (!pickVolumeAttribute || pickVolumeAttribute->attributeType() != QAttribute::VertexAttribute - || pickVolumeAttribute->dataType() != QAttribute::Float - || pickVolumeAttribute->dataSize() < 3) { + || pickVolumeAttribute->vertexBaseType() != QAttribute::Float + || pickVolumeAttribute->vertexSize() < 3) { qWarning() << "QBoundingVolumeSpecifier pickVolume Attribute not suited for bounding volume computation"; return; } @@ -123,7 +123,7 @@ void calculateLocalBoundingVolume(NodeManagers *manager, Entity *node) const QByteArray buffer = buf->data(); const char *rawBuffer = buffer.constData(); rawBuffer += pickVolumeAttribute->byteOffset(); - const int stride = pickVolumeAttribute->byteStride() ? pickVolumeAttribute->byteStride() : sizeof(float) * pickVolumeAttribute->dataSize(); + const int stride = pickVolumeAttribute->byteStride() ? pickVolumeAttribute->byteStride() : sizeof(float) * pickVolumeAttribute->vertexSize(); QVector<QVector3D> vertices(pickVolumeAttribute->count()); // TODO avoid copying the vertices @@ -131,7 +131,7 @@ void calculateLocalBoundingVolume(NodeManagers *manager, Entity *node) QVector3D v; const float *fptr = reinterpret_cast<const float*>(rawBuffer); // TODO unwrap loop (switch?) - for (uint i = 0, m = qMin(pickVolumeAttribute->dataSize(), 3U); i < m; ++i) + for (uint i = 0, m = qMin(pickVolumeAttribute->vertexSize(), 3U); i < m; ++i) v[i] = fptr[i]; vertices[c] = v; rawBuffer += stride; |