summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2016-02-25 15:54:36 +0100
committerPaul Lemire <paul.lemire@kdab.com>2016-02-29 14:51:33 +0000
commitc3f21b4e2834fd257157728e306aef11f06e01d8 (patch)
tree77eb89e5906a8a076345a7b4825cd1ee0c8c852a
parent7994e86c0e6fd14954cc4a6092509132251cb006 (diff)
QAttribute API changes
- rename dataType to vertexBaseType - rename dataSize to vertexSize Change-Id: I0eca7054dd69e8aac69bc1d7d5023a7ca6ca9da2 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--examples/qt3d/compute-particles/ParticlesScene.qml8
-rw-r--r--examples/qt3d/custom-mesh-qml/main.qml16
-rw-r--r--examples/qt3d/instanced-arrays-qml/main.qml4
-rw-r--r--src/plugins/sceneparsers/assimp/assimpparser.cpp2
-rw-r--r--src/plugins/sceneparsers/gltf/gltfparser.cpp2
-rw-r--r--src/plugins/sceneparsers/gltf/gltfparser.h4
-rw-r--r--src/render/backend/renderer.cpp2
-rw-r--r--src/render/backend/trianglesvisitor.cpp14
-rw-r--r--src/render/frontend/qitemmodelbuffer.cpp4
-rw-r--r--src/render/geometry/attribute.cpp20
-rw-r--r--src/render/geometry/attribute_p.h8
-rw-r--r--src/render/geometry/qattribute.cpp10
-rw-r--r--src/render/geometry/qattribute.h22
-rw-r--r--src/render/geometry/qattribute_p.h2
-rw-r--r--src/render/graphicshelpers/graphicscontext.cpp6
-rw-r--r--src/render/graphicshelpers/graphicscontext_p.h2
-rw-r--r--src/render/io/objloader.cpp2
-rw-r--r--src/render/jobs/calcboundingvolumejob.cpp8
-rw-r--r--tests/auto/render/attribute/tst_attribute.cpp20
-rw-r--r--tests/auto/render/qattribute/tst_qattribute.cpp8
20 files changed, 82 insertions, 82 deletions
diff --git a/examples/qt3d/compute-particles/ParticlesScene.qml b/examples/qt3d/compute-particles/ParticlesScene.qml
index aaaa25114..4ba9896f0 100644
--- a/examples/qt3d/compute-particles/ParticlesScene.qml
+++ b/examples/qt3d/compute-particles/ParticlesScene.qml
@@ -129,8 +129,8 @@ Entity {
id: particlePositionDataAttribute
name: "particlePosition"
attributeType: Attribute.VertexAttribute
- dataType: Attribute.Float
- dataSize: 3
+ vertexBaseType: Attribute.Float
+ vertexSize: 3
divisor: 1
byteStride: 12 * floatSize
buffer: particleBuffer
@@ -140,8 +140,8 @@ Entity {
id: particleColorDataAttribute
name: "particleColor"
attributeType: Attribute.VertexAttribute
- dataType: Attribute.Float
- dataSize: 3
+ vertexBaseType: Attribute.Float
+ vertexSize: 3
divisor: 1
byteOffset: 8 * floatSize
byteStride: 12 * floatSize
diff --git a/examples/qt3d/custom-mesh-qml/main.qml b/examples/qt3d/custom-mesh-qml/main.qml
index 6c27de460..033be0e67 100644
--- a/examples/qt3d/custom-mesh-qml/main.qml
+++ b/examples/qt3d/custom-mesh-qml/main.qml
@@ -177,8 +177,8 @@ Entity {
geometry: Geometry {
Attribute {
attributeType: Attribute.VertexAttribute
- dataType: Attribute.Float
- dataSize: 3
+ vertexBaseType: Attribute.Float
+ vertexSize: 3
byteOffset: 0
byteStride: 9 * 4
count: 4
@@ -188,8 +188,8 @@ Entity {
Attribute {
attributeType: Attribute.VertexAttribute
- dataType: Attribute.Float
- dataSize: 3
+ vertexBaseType: Attribute.Float
+ vertexSize: 3
byteOffset: 3 * 4
byteStride: 9 * 4
count: 4
@@ -199,8 +199,8 @@ Entity {
Attribute {
attributeType: Attribute.VertexAttribute
- dataType: Attribute.Float
- dataSize: 3
+ vertexBaseType: Attribute.Float
+ vertexSize: 3
byteOffset: 6 * 4
byteStride: 9 * 4
count: 4
@@ -210,8 +210,8 @@ Entity {
Attribute {
attributeType: Attribute.IndexAttribute
- dataType: Attribute.UnsignedShort
- dataSize: 1
+ vertexBaseType: Attribute.UnsignedShort
+ vertexSize: 1
byteOffset: 0
byteStride: 0
count: 12
diff --git a/examples/qt3d/instanced-arrays-qml/main.qml b/examples/qt3d/instanced-arrays-qml/main.qml
index 96a258da4..b2a8577ac 100644
--- a/examples/qt3d/instanced-arrays-qml/main.qml
+++ b/examples/qt3d/instanced-arrays-qml/main.qml
@@ -154,8 +154,8 @@ Entity {
id: instanceDataAttribute
name: "pos"
attributeType: Attribute.VertexAttribute
- dataType: Attribute.Float
- dataSize: 3
+ vertexBaseType: Attribute.Float
+ vertexSize: 3
divisor: 1
buffer: _instanceBuffer
}
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;
diff --git a/tests/auto/render/attribute/tst_attribute.cpp b/tests/auto/render/attribute/tst_attribute.cpp
index 2a7874b44..cce07bd55 100644
--- a/tests/auto/render/attribute/tst_attribute.cpp
+++ b/tests/auto/render/attribute/tst_attribute.cpp
@@ -63,8 +63,8 @@ private Q_SLOTS:
// THEN
QCOMPARE(renderAttribute.peerUuid(), attribute.id());
QCOMPARE(renderAttribute.isDirty(), true);
- QCOMPARE(renderAttribute.dataType(), attribute.dataType());
- QCOMPARE(renderAttribute.dataSize(), attribute.dataSize());
+ QCOMPARE(renderAttribute.vertexBaseType(), attribute.vertexBaseType());
+ QCOMPARE(renderAttribute.vertexSize(), attribute.vertexSize());
QCOMPARE(renderAttribute.attributeType(), attribute.attributeType());
QCOMPARE(renderAttribute.byteOffset(), attribute.byteOffset());
QCOMPARE(renderAttribute.byteStride(), attribute.byteStride());
@@ -86,8 +86,8 @@ private Q_SLOTS:
QVERIFY(renderAttribute.bufferId().isNull());
QVERIFY(renderAttribute.name().isEmpty());
QCOMPARE(renderAttribute.isDirty(), false);
- QCOMPARE(renderAttribute.dataType(), Qt3DRender::QAttribute::Float);
- QCOMPARE(renderAttribute.dataSize(), 1U);
+ QCOMPARE(renderAttribute.vertexBaseType(), Qt3DRender::QAttribute::Float);
+ QCOMPARE(renderAttribute.vertexSize(), 1U);
QCOMPARE(renderAttribute.attributeType(), Qt3DRender::QAttribute::VertexAttribute);
QCOMPARE(renderAttribute.byteOffset(), 0U);
QCOMPARE(renderAttribute.byteStride(), 0U);
@@ -118,8 +118,8 @@ private Q_SLOTS:
QVERIFY(renderAttribute.bufferId().isNull());
QVERIFY(renderAttribute.name().isEmpty());
QCOMPARE(renderAttribute.isDirty(), false);
- QCOMPARE(renderAttribute.dataType(), Qt3DRender::QAttribute::Float);
- QCOMPARE(renderAttribute.dataSize(), 1U);
+ QCOMPARE(renderAttribute.vertexBaseType(), Qt3DRender::QAttribute::Float);
+ QCOMPARE(renderAttribute.vertexSize(), 1U);
QCOMPARE(renderAttribute.attributeType(), Qt3DRender::QAttribute::VertexAttribute);
QCOMPARE(renderAttribute.byteOffset(), 0U);
QCOMPARE(renderAttribute.byteStride(), 0U);
@@ -139,11 +139,11 @@ private Q_SLOTS:
// WHEN
Qt3DCore::QScenePropertyChangePtr updateChange(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
updateChange->setValue(static_cast<int>(Qt3DRender::QAttribute::Int));
- updateChange->setPropertyName("dataType");
+ updateChange->setPropertyName("vertexBaseType");
renderAttribute.sceneChangeEvent(updateChange);
// THEN
- QCOMPARE(renderAttribute.dataType(), Qt3DRender::QAttribute::Int);
+ QCOMPARE(renderAttribute.vertexBaseType(), Qt3DRender::QAttribute::Int);
QVERIFY(renderAttribute.isDirty());
QVERIFY(renderer.dirtyBits() != 0);
@@ -155,11 +155,11 @@ private Q_SLOTS:
// WHEN
updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
updateChange->setValue(3);
- updateChange->setPropertyName("dataSize");
+ updateChange->setPropertyName("vertexSize");
renderAttribute.sceneChangeEvent(updateChange);
// THEN
- QCOMPARE(renderAttribute.dataSize(), 3U);
+ QCOMPARE(renderAttribute.vertexSize(), 3U);
QVERIFY(renderAttribute.isDirty());
QVERIFY(renderer.dirtyBits() != 0);
diff --git a/tests/auto/render/qattribute/tst_qattribute.cpp b/tests/auto/render/qattribute/tst_qattribute.cpp
index 7230334ee..ba7371e0d 100644
--- a/tests/auto/render/qattribute/tst_qattribute.cpp
+++ b/tests/auto/render/qattribute/tst_qattribute.cpp
@@ -105,8 +105,8 @@ private Q_SLOTS:
QCOMPARE(attribute->byteStride(), clone->byteStride());
QCOMPARE(attribute->byteOffset(), clone->byteOffset());
QCOMPARE(attribute->divisor(), clone->divisor());
- QCOMPARE(attribute->dataType(), clone->dataType());
- QCOMPARE(attribute->dataSize(), clone->dataSize());
+ QCOMPARE(attribute->vertexBaseType(), clone->vertexBaseType());
+ QCOMPARE(attribute->vertexSize(), clone->vertexSize());
QVERIFY(attribute->attributeType() == clone->attributeType());
if (attribute->buffer() != Q_NULLPTR) {
@@ -129,7 +129,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "dataType");
+ QCOMPARE(change->propertyName(), "vertexBaseType");
QCOMPARE(change->value().value<int>(), static_cast<int>(Qt3DRender::QAttribute::Double));
QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
@@ -142,7 +142,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "dataSize");
+ QCOMPARE(change->propertyName(), "vertexSize");
QCOMPARE(change->value().value<uint>(), 4U);
QCOMPARE(change->type(), Qt3DCore::NodeUpdated);