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

Commit 7e8df21

Browse files
[qt6] fix misc. changes and incompatibilities
1 parent a940e33 commit 7e8df21

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

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

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

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

362363
// create geometry
363-
QGeometry* customGeometry = new QGeometry;
364+
auto* customGeometry = new Qt3DCore::QGeometry;
364365

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

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

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

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

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

441442
customGeometry->addAttribute(positionAttribute);
442443
customGeometry->addAttribute(normalAttribute);
@@ -451,20 +452,20 @@ void DepthMapEntity::loadDepthMap()
451452
}
452453

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

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

470471
// create the geometry renderer

0 commit comments

Comments
 (0)