I’m trying to access vertex data of QGeometry objects for computing the
bounding box of the object.
This works fine for QMesh, but for QCuboidMesh, QSphereMesh, etc… vertex
data seems invalid.
Is there some method to call to make vertex data actual?
This is my code:
QVector entityBoundingBox(Qt3D
You might want to do this:
Qt3DRender::QGeometryRenderer *mesh = ...
Qt3DRender::QGeometry *meshGeometry = mesh->geometry();
for (Qt3DRender::QAttribute *attribute : meshGeometry->attributes()) {
Qt3DRender::QBuffer *buf = attribute->buffer();
if (buf) {
I added your fix (just after the line const QByteArray &data =
buf->data();) but the problem persists (Cuboid mesh):
geometryBoundingBox: Qt3DExtras::QCuboidGeometry(0x7ff299c87ba0)
geometryBoundingBox: setData
geometryBoundingBox: scanning vertex 0 0 0
geometryBoundingBox: scanning vertex 0 0
Nevermind, I was keeping the previous result of Qt3DRender::QBuffer::data()
which was invalid.
Calling buf->data() again after setData/setSyncData gave thew correct
result.
On 9 March 2020 at 13:35:40, Federico Ferri (federico.ferri...@gmail.com)
wrote:
I added your fix (just after the line con