Retrieving the amount of vertices/edges/faces in a QMesh (QT6)
-
Hi,
I'm having trouble to count the cells (vertices/edges/faces) of a QMesh, using Qt3DRender in QT6.
Goal : given a
Qt3DRender::QMesh
, retrieve its amount of vertices, edges and faces.Example : For a simple cube, I'd like to retrieve 8/12/6
It seems that the
vertexCount
method of theQt3DRender::QGeometryRenderer
class function is designed for this.From the documentation, a
Qt3DRender::QMesh
is aQt3DRender::QGeometryRenderer
so I decided to usevertexCount
. Here comes the problem => it always returns 0.Context when calling
vertexCount
:-
The loading state of the QMesh on which I'm calling
vertexCount
isQt3DRender::QMesh::Ready
-
I tried to parse the vertices positions of the
Qt3DCore::QGeometry
associated to the QMesh to count its vertices => it works (that is, the geometry is loaded too)
Questions :
-
What is a "primitive" in the
Qt3DRender::QGeometryRenderer
terminology? The functionvertexCount
definition is "holds the primitive count". I assumed that a "primitive" is either a vertex, an edge or a face (since this is what theQt3DRender::QGeometryRenderer::PrimitiveType
enumeration is). -
Is there any example using this function? I found nothing on the Internet nor in the Qt examples bank.
Thanks for your help !
-