Fix deprecation warnings about Qt3DRender::QBuffer::BufferType

Remove the calls as 6158b4ae7c
states that it no longer has any effect, fixing:

gltfgeometryloader.cpp:333:18: warning: 'void Qt3DRender::QBuffer::setType(Qt3DRender::QBuffer::BufferType)' is deprecated [-Wdeprecated-declarations]
gltfgeometryloader.cpp:371:54: warning: 'Qt3DRender::QBuffer::QBuffer(Qt3DRender::QBuffer::BufferType, Qt3DCore::QNode*)' is deprecated [-Wdeprecated-declarations]
basegeometryloader.cpp:155:39: warning: 'void Qt3DRender::QBuffer::setType(Qt3DRender::QBuffer::BufferType)' is deprecated [-Wdeprecated-declarations]
basegeometryloader.cpp:202:46: warning: 'void Qt3DRender::QBuffer::setType(Qt3DRender::QBuffer::BufferType)' is deprecated [-Wdeprecated-declarations]
instancebuffer.cpp:61:39: warning: 'Qt3DRender::QBuffer::QBuffer(Qt3DRender::QBuffer::BufferType, Qt3DCore::QNode*)' is dep
tst_qbuffer.cpp:79:96: warning: ‘Qt3DRender::QBuffer::QBuffer(Qt3DRender::QBuffer::BufferType, Qt3DCore::QNode*)’ is deprecated [-Wdeprecated-declarations]
tst_qbuffer.cpp:85:100: warning: ‘Qt3DRender::QBuffer::QBuffer(Qt3DRender::QBuffer::BufferType, Qt3DCore::QNode*)’ is deprecated [-Wdeprecated-declarations]
tst_qbuffer.cpp:128:109: warning: ‘Qt3DRender::QBuffer::QBuffer(Qt3DRender::QBuffer::BufferType, Qt3DCore::QNode*)’ is deprecated [-Wdeprecated-declarations]
tst_qbuffer.cpp:132:57: warning: ‘void Qt3DRender::QBuffer::setType(Qt3DRender::QBuffer::BufferType)’ is deprecated [-Wdeprecated-declarations]
tst_attribute.cpp:56:68: warning: ‘Qt3DRender::QBuffer::QBuffer(Qt3DRender::QBuffer::BufferType, Qt3DCore::QNode*)’ is deprecated [-Wdeprecated-declarations]
tst_attribute.cpp:108:68: warning: ‘Qt3DRender::QBuffer::QBuffer(Qt3DRender::QBuffer::BufferType, Qt3DCore::QNode*)’ is deprecated [-Wdeprecated-declarations]
tst_buffer.cpp:74:68: warning: ‘Qt3DRender::QBuffer::QBuffer(Qt3DRender::QBuffer::BufferType, Qt3DCore::QNode*)’ is deprecated [-Wdeprecated-declarations]
tst_buffer.cpp:271:68: warning: ‘Qt3DRender::QBuffer::QBuffer(Qt3DRender::QBuffer::BufferType, Qt3DCore::QNode*)’ is deprecated [-Wdeprecated-declarations]
tst_buffer.cpp:297:68: warning: ‘Qt3DRender::QBuffer::QBuffer(Qt3DRender::QBuffer::BufferType, Qt3DCore::QNode*)’ is deprecated [-Wdeprecated-declarations]
tst_gltfplugins.cpp:519:95: warning: 'Qt3DRender::QBuffer::QBuffer(Qt3DRender::QBuffer::BufferType, Qt3DCore::QNode*)' is deprecated [-Wdeprecated-declarations]
tst_gltfplugins.cpp:574:95: warning: 'Qt3DRender::QBuffer::QBuffer(Qt3DRender::QBuffer::BufferType, Qt3DCore::QNode*)' is deprecated [-Wdeprecated-declarations]
tst_gltfplugins.cpp:967:83: warning: 'Qt3DRender::QBuffer::QBuffer(Qt3DRender::QBuffer::BufferType, Qt3DCore::QNode*)' is deprecated [-Wdeprecated-declarations]
tst_gltfplugins.cpp:969:82: warning: 'Qt3DRender::QBuffer::QBuffer(Qt3DRender::QBuffer::BufferType, Qt3DCore::QNode*)' is deprecated [-Wdeprecated-declarations]
tst_trianglesextractor.cpp:56:118: warning: 'Qt3DRender::QBuffer::QBuffer(Qt3DRender::QBuffer::BufferType, Qt3DCore::QNode*)' is deprecated [-Wdeprecated-declarations]
tst_trianglesextractor.cpp:57:116: warning: 'Qt3DRender::QBuffer::QBuffer(Qt3DRender::QBuffer::BufferType, Qt3DCore::QNode*)' is deprecated [-Wdeprecated-declarations]
tst_trianglesextractor.cpp:199:118: warning: 'Qt3DRender::QBuffer::QBuffer(Qt3DRender::QBuffer::BufferType, Qt3DCore::QNode*)' is deprecated [-Wdeprecated-declarations]

Change-Id: I6835598a1771a0ec3a0b080911fa4cada210a01a
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
This commit is contained in:
Friedemann Kleint 2019-03-05 16:04:55 +01:00
parent fa63d206ce
commit 6f7ac29268
8 changed files with 24 additions and 40 deletions

View File

@ -57,7 +57,7 @@ static const int colCount = 20;
static const int maxInstanceCount = rowCount * colCount;
InstanceBuffer::InstanceBuffer(Qt3DCore::QNode *parent)
: Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, parent)
: Qt3DRender::QBuffer(parent)
, m_instanceCount(maxInstanceCount)
{
// Create some per instance data - position of each instance

View File

@ -152,7 +152,6 @@ void BaseGeometryLoader::generateGeometry()
} // of buffer filling loop
QBuffer *buf = new QBuffer();
buf->setType(QBuffer::VertexBuffer);
buf->setData(bufferBytes);
if (m_geometry)
@ -199,7 +198,6 @@ void BaseGeometryLoader::generateGeometry()
}
QBuffer *indexBuffer = new QBuffer();
indexBuffer->setType(QBuffer::IndexBuffer);
indexBuffer->setData(indexBytes);
QAttribute *indexAttribute = new QAttribute(indexBuffer, ty, 1, m_indices.size());
indexAttribute->setAttributeType(QAttribute::IndexAttribute);

View File

@ -303,11 +303,11 @@ void GLTFGeometryLoader::processJSONBufferView(const QString &id, const QJsonObj
const auto &bufferData = *it;
int target = json.value(KEY_TARGET).toInt();
Qt3DRender::QBuffer::BufferType ty(Qt3DRender::QBuffer::VertexBuffer);
switch (target) {
case GL_ARRAY_BUFFER: ty = Qt3DRender::QBuffer::VertexBuffer; break;
case GL_ELEMENT_ARRAY_BUFFER: ty = Qt3DRender::QBuffer::IndexBuffer; break;
case GL_ARRAY_BUFFER:
case GL_ELEMENT_ARRAY_BUFFER:
break;
default:
qCWarning(GLTFGeometryLoaderLog, "buffer %ls unsupported target: %d",
qUtf16PrintableImpl(id), target);
@ -330,7 +330,6 @@ void GLTFGeometryLoader::processJSONBufferView(const QString &id, const QJsonObj
}
Qt3DRender::QBuffer *b = new Qt3DRender::QBuffer();
b->setType(ty);
b->setData(bytes);
m_gltf1.m_buffers[id] = b;
}
@ -345,11 +344,10 @@ void GLTFGeometryLoader::processJSONBufferViewV2(const QJsonObject &json)
const auto bufferData = m_gltf2.m_bufferDatas[bufferIndex];
int target = json.value(KEY_TARGET).toInt();
Qt3DRender::QBuffer::BufferType ty(Qt3DRender::QBuffer::VertexBuffer);
switch (target) {
case GL_ARRAY_BUFFER: ty = Qt3DRender::QBuffer::VertexBuffer; break;
case GL_ELEMENT_ARRAY_BUFFER: ty = Qt3DRender::QBuffer::IndexBuffer; break;
case GL_ARRAY_BUFFER:
case GL_ELEMENT_ARRAY_BUFFER:
break;
default:
return;
}
@ -368,7 +366,7 @@ void GLTFGeometryLoader::processJSONBufferViewV2(const QJsonObject &json)
qUtf16PrintableImpl(bufferData.path));
}
Qt3DRender::QBuffer *b(new Qt3DRender::QBuffer(ty));
auto b = new Qt3DRender::QBuffer;
b->setData(bytes);
m_gltf2.m_buffers.push_back(b);
}

View File

@ -53,7 +53,7 @@ private Q_SLOTS:
attribute.setVertexBaseType(Qt3DRender::QAttribute::UnsignedShort);
attribute.setVertexSize(3);
Qt3DRender::QBuffer buffer(Qt3DRender::QBuffer::IndexBuffer);
Qt3DRender::QBuffer buffer;
buffer.setUsage(Qt3DRender::QBuffer::DynamicCopy);
buffer.setData(QByteArrayLiteral("Corvette"));
attribute.setBuffer(&buffer);
@ -105,7 +105,7 @@ private Q_SLOTS:
attribute.setName(QStringLiteral("C3"));
attribute.setVertexBaseType(Qt3DRender::QAttribute::Double);
attribute.setVertexSize(4);
Qt3DRender::QBuffer buffer(Qt3DRender::QBuffer::IndexBuffer);
Qt3DRender::QBuffer buffer;
buffer.setUsage(Qt3DRender::QBuffer::DynamicCopy);
buffer.setData(QByteArrayLiteral("C7"));
attribute.setBuffer(&buffer);

View File

@ -71,7 +71,7 @@ private Q_SLOTS:
{
// GIVEN
Qt3DRender::Render::Buffer renderBuffer;
Qt3DRender::QBuffer buffer(Qt3DRender::QBuffer::IndexBuffer);
Qt3DRender::QBuffer buffer;
Qt3DRender::Render::BufferManager bufferManager;
TestRenderer renderer;
@ -268,7 +268,7 @@ private Q_SLOTS:
{
// GIVEN
Qt3DRender::Render::Buffer renderBuffer;
Qt3DRender::QBuffer buffer(Qt3DRender::QBuffer::IndexBuffer);
Qt3DRender::QBuffer buffer;
Qt3DRender::Render::BufferManager bufferManager;
TestRenderer renderer;
@ -294,7 +294,7 @@ private Q_SLOTS:
{
// GIVEN
Qt3DRender::Render::Buffer renderBuffer;
Qt3DRender::QBuffer buffer(Qt3DRender::QBuffer::IndexBuffer);
Qt3DRender::QBuffer buffer;
Qt3DRender::Render::BufferManager bufferManager;
TestRenderer renderer;

View File

@ -516,7 +516,7 @@ void tst_gltfPlugins::createTestScene()
Qt3DRender::QGeometryRenderer *boxMesh = createCustomCube();
Qt3DRender::QBuffer *colorDataBuffer =
new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, boxMesh->geometry());
new Qt3DRender::QBuffer(boxMesh->geometry());
QByteArray colorBufferData;
colorBufferData.resize(8 * 4 * sizeof(float));
@ -571,7 +571,7 @@ void tst_gltfPlugins::createTestScene()
transform->setRotation(Qt3DCore::QTransform::fromAxisAndAngle(1.0f, 2.0f, 3.0f, 90.0f));
Qt3DRender::QGeometryRenderer *boxMesh = createCustomCube();
Qt3DRender::QBuffer *offsetBuffer =
new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, boxMesh->geometry());
new Qt3DRender::QBuffer(boxMesh->geometry());
QByteArray offsetBufferData;
offsetBufferData.resize(8 * 3 * sizeof(float));
@ -964,9 +964,9 @@ Qt3DRender::QGeometryRenderer *tst_gltfPlugins::createCustomCube()
Qt3DRender::QGeometryRenderer *boxMesh = new Qt3DRender::QGeometryRenderer;
Qt3DRender::QGeometry *boxGeometry = new Qt3DRender::QGeometry(boxMesh);
Qt3DRender::QBuffer *boxDataBuffer =
new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, boxGeometry);
new Qt3DRender::QBuffer(boxGeometry);
Qt3DRender::QBuffer *indexDataBuffer =
new Qt3DRender::QBuffer(Qt3DRender::QBuffer::IndexBuffer, boxGeometry);
new Qt3DRender::QBuffer(boxGeometry);
QByteArray vertexBufferData;
QByteArray indexBufferData;

View File

@ -76,13 +76,13 @@ private Q_SLOTS:
Qt3DRender::QBuffer *defaultConstructed = new Qt3DRender::QBuffer();
QTest::newRow("defaultConstructed") << defaultConstructed;
Qt3DRender::QBuffer *buffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer);
auto buffer = new Qt3DRender::QBuffer;
buffer->setUsage(Qt3DRender::QBuffer::DynamicRead);
buffer->setData(QByteArrayLiteral("There's no replacement"));
buffer->setDataGenerator(Qt3DRender::QBufferDataGeneratorPtr(new TestFunctor(883)));
QTest::newRow("vertex") << buffer;
Qt3DRender::QBuffer *indexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::IndexBuffer);
auto indexBuffer = new Qt3DRender::QBuffer;
indexBuffer->setUsage(Qt3DRender::QBuffer::StaticCopy);
indexBuffer->setData(QByteArrayLiteral("For displacement"));
indexBuffer->setDataGenerator(Qt3DRender::QBufferDataGeneratorPtr(new TestFunctor(1340)));
@ -125,28 +125,16 @@ private Q_SLOTS:
{
// GIVEN
TestArbiter arbiter;
QScopedPointer<Qt3DRender::QBuffer> buffer(new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer));
QScopedPointer<Qt3DRender::QBuffer> buffer(new Qt3DRender::QBuffer);
arbiter.setArbiterOnNode(buffer.data());
// WHEN
buffer->setType(Qt3DRender::QBuffer::IndexBuffer);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "type");
QCOMPARE(change->value().value<int>(), static_cast<int>(Qt3DRender::QBuffer::IndexBuffer));
arbiter.events.clear();
// WHEN
buffer->setUsage(Qt3DRender::QBuffer::DynamicCopy);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "usage");
QCOMPARE(change->value().value<int>(), static_cast<int>(Qt3DRender::QBuffer::DynamicCopy));

View File

@ -53,8 +53,8 @@ Qt3DRender::QGeometryRenderer *customIndexedGeometryRenderer()
Qt3DRender::QGeometryRenderer *customMeshRenderer = new Qt3DRender::QGeometryRenderer;
Qt3DRender::QGeometry *customGeometry = new Qt3DRender::QGeometry(customMeshRenderer);
Qt3DRender::QBuffer *vertexDataBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, customGeometry);
Qt3DRender::QBuffer *indexDataBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::IndexBuffer, customGeometry);
auto vertexDataBuffer = new Qt3DRender::QBuffer(customGeometry);
auto indexDataBuffer = new Qt3DRender::QBuffer(customGeometry);
// vec3 for position
// vec3 for colors
@ -196,7 +196,7 @@ Qt3DRender::QGeometryRenderer *customNonIndexedGeometryRenderer()
Qt3DRender::QGeometryRenderer *customMeshRenderer = new Qt3DRender::QGeometryRenderer;
Qt3DRender::QGeometry *customGeometry = new Qt3DRender::QGeometry(customMeshRenderer);
Qt3DRender::QBuffer *vertexDataBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, customGeometry);
auto vertexDataBuffer = new Qt3DRender::QBuffer(customGeometry);
// vec3 for position
// vec3 for colors