On Qt3D, an entity can have these two components:
Qt3DRender::QGeometryRenderer
component which contains the mesh geometry data like vertex positions and normals.Qt3DCore::QTransform
component which contains the rotations, translations and scalings.
I intend to export the mesh data as STL with all the transformations applied to mesh geometry. I mean, all rotations and translations need to be applied to vertex positions...
When I access the mesh geometry data, like below, the transformations are not applied to geometry.
mesh->geometry()->attributes().at(i)->buffer()->data();
How can I apply the transformations to the geometry?
The Qt3DCore::QTransform
component gives me a 4x4 Matrix, but my vertex positions are 3x1
, I don't know how to apply this 4x4 matrix into my 3x1
vertex positions.
QGenericMatrix
(i.e. [v1|v2|v3|...]) and then multiply your transformation from the left side: transform * vertMatrix. This should result in a matrix where each column is the transformed vertex. The guys at Qt probably implemented a faster matrix multiplication algorithm than simple iteration. – Leifleifer