How do I create a triangle mesh in Qt 3D using C++?
-
In Qt 3D using C++ I want to display a triangle mesh where I programatically provide the vertices and indices of vertices that make up the triangles.
Should I use
Qt3DRender::QGeometryRendererfor this or is there a more suitable subclass I can use?I notice that this class has a
setGeometry()so my plan is to build aQt3DRender::QGeometryand call this.However how do I set the vertices and indices of vertices on this geometry?
I have:
std::vector<float> vertices; // x1, y1, z1, x2, y2, z2, ...
std::vector<unsigned int> indices; // tri1_i1, tri1_i2, tri1_i3, tri2_i1, ...