Skip to content
This repository was archived by the owner on Jan 14, 2023. It is now read-only.

Commit d2ec51a

Browse files
monsieurgustavcbentejac
authored andcommitted
[qt6] fix misc. changes and incompatibilities
1 parent a41dae9 commit d2ec51a

File tree

2 files changed

+28
-26
lines changed

2 files changed

+28
-26
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ set(CMAKE_AUTOMOC ON)
3232
set(CMAKE_INCLUDE_CURRENT_DIR ON) # needed for automoc
3333

3434
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
35+
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui REQUIRED)
3536
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
3637

3738

src/depthMapEntity/DepthMapEntity.cpp

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
#include <Qt3DRender/QRenderPass>
1111
#include <Qt3DRender/QShaderProgram>
1212

13-
#include <Qt3DRender/QAttribute>
14-
#include <Qt3DRender/QBuffer>
13+
#include <Qt3DCore/QAttribute>
14+
#include <Qt3DCore/QBuffer>
1515
#include <Qt3DCore/QTransform>
16+
#include <Qt3DCore/QGeometry>
1617

1718
#include <QDebug>
1819

@@ -338,7 +339,7 @@ void DepthMapEntity::loadDepthMap()
338339
point3d p = CArr + (iCamArr * point2d((double)x, (double)y)).normalize() * depthValue;
339340
Vec3f position(p.x, -p.y, -p.z);
340341

341-
indexPerPixel[y * inSpec.width + x] = positions.size();
342+
indexPerPixel[y * inSpec.width + x] = (int)positions.size();
342343
positions.push_back(position);
343344

344345
if(validSimMap)
@@ -361,7 +362,7 @@ void DepthMapEntity::loadDepthMap()
361362
qDebug() << "[DepthMapEntity] Valid Depth Values: " << positions.size();
362363

363364
// create geometry
364-
QGeometry* customGeometry = new QGeometry;
365+
auto* customGeometry = new Qt3DCore::QGeometry;
365366

366367
// vertices buffer
367368
std::vector<int> trianglesIndexes;
@@ -411,33 +412,33 @@ void DepthMapEntity::loadDepthMap()
411412
normals[i+t] = normal;
412413
}
413414

414-
QBuffer* vertexBuffer = new QBuffer(QBuffer::VertexBuffer);
415+
Qt3DCore::QBuffer* vertexBuffer = new Qt3DCore::QBuffer;
415416
QByteArray trianglesData((const char*)&triangles[0], triangles.size() * sizeof(Vec3f));
416417
vertexBuffer->setData(trianglesData);
417418

418-
QBuffer* normalBuffer = new QBuffer(QBuffer::VertexBuffer);
419+
Qt3DCore::QBuffer* normalBuffer = new Qt3DCore::QBuffer;
419420
QByteArray normalsData((const char*)&normals[0], normals.size() * sizeof(Vec3f));
420421
normalBuffer->setData(normalsData);
421422

422-
QAttribute* positionAttribute = new QAttribute(this);
423-
positionAttribute->setName(QAttribute::defaultPositionAttributeName());
424-
positionAttribute->setAttributeType(QAttribute::VertexAttribute);
423+
Qt3DCore::QAttribute* positionAttribute = new Qt3DCore::QAttribute(this);
424+
positionAttribute->setName(Qt3DCore::QAttribute::defaultPositionAttributeName());
425+
positionAttribute->setAttributeType(Qt3DCore::QAttribute::VertexAttribute);
425426
positionAttribute->setBuffer(vertexBuffer);
426-
positionAttribute->setDataType(QAttribute::Float);
427-
positionAttribute->setDataSize(3);
427+
positionAttribute->setVertexBaseType(Qt3DCore::QAttribute::Float);
428+
positionAttribute->setVertexSize(3);
428429
positionAttribute->setByteOffset(0);
429430
positionAttribute->setByteStride(sizeof(Vec3f));
430-
positionAttribute->setCount(triangles.size());
431+
positionAttribute->setCount((uint)triangles.size());
431432

432-
QAttribute* normalAttribute = new QAttribute(this);
433-
normalAttribute->setName(QAttribute::defaultNormalAttributeName());
434-
normalAttribute->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
433+
Qt3DCore::QAttribute* normalAttribute = new Qt3DCore::QAttribute(this);
434+
normalAttribute->setName(Qt3DCore::QAttribute::defaultNormalAttributeName());
435+
normalAttribute->setAttributeType(Qt3DCore::QAttribute::VertexAttribute);
435436
normalAttribute->setBuffer(normalBuffer);
436-
normalAttribute->setDataType(QAttribute::Float);
437-
normalAttribute->setDataSize(3);
437+
normalAttribute->setVertexBaseType(Qt3DCore::QAttribute::Float);
438+
normalAttribute->setVertexSize(3);
438439
normalAttribute->setByteOffset(0);
439440
normalAttribute->setByteStride(sizeof(Vec3f));
440-
normalAttribute->setCount(normals.size());
441+
normalAttribute->setCount((uint)normals.size());
441442

442443
customGeometry->addAttribute(positionAttribute);
443444
customGeometry->addAttribute(normalAttribute);
@@ -452,20 +453,20 @@ void DepthMapEntity::loadDepthMap()
452453
}
453454

454455
// read color data
455-
QBuffer* colorDataBuffer = new QBuffer(QBuffer::VertexBuffer);
456+
Qt3DCore::QBuffer* colorDataBuffer = new Qt3DCore::QBuffer;
456457
QByteArray colorData((const char*)colorsFlat[0].m, colorsFlat.size() * 3 * sizeof(float));
457458
colorDataBuffer->setData(colorData);
458459

459-
QAttribute* colorAttribute = new QAttribute;
460-
qDebug() << "Qt3DRender::QAttribute::defaultColorAttributeName(): " << Qt3DRender::QAttribute::defaultColorAttributeName();
461-
colorAttribute->setName(Qt3DRender::QAttribute::defaultColorAttributeName());
462-
colorAttribute->setAttributeType(QAttribute::VertexAttribute);
460+
Qt3DCore::QAttribute* colorAttribute = new Qt3DCore::QAttribute;
461+
qDebug() << "Qt3DRender::QAttribute::defaultColorAttributeName(): " << Qt3DCore::QAttribute::defaultColorAttributeName();
462+
colorAttribute->setName(Qt3DCore::QAttribute::defaultColorAttributeName());
463+
colorAttribute->setAttributeType(Qt3DCore::QAttribute::VertexAttribute);
463464
colorAttribute->setBuffer(colorDataBuffer);
464-
colorAttribute->setDataType(QAttribute::Float);
465-
colorAttribute->setDataSize(3);
465+
colorAttribute->setVertexBaseType(Qt3DCore::QAttribute::Float);
466+
colorAttribute->setVertexSize(3);
466467
colorAttribute->setByteOffset(0);
467468
colorAttribute->setByteStride(3 * sizeof(float));
468-
colorAttribute->setCount(colorsFlat.size());
469+
colorAttribute->setCount((uint)colorsFlat.size());
469470
customGeometry->addAttribute(colorAttribute);
470471

471472
// create the geometry renderer

0 commit comments

Comments
 (0)