c++ - 如何获取和操作 QMesh 的顶点、面等等?

标签 c++ qt qt3d

我使用示例在屏幕上获得了任意实体 QMesh。这很棒。但我对此无能为力。 mesh->children().count = 0, mesh->primitiveCount=0, mesh->geometry()=0 等等。如何获取QMesh的内部内容?我可以通过编程方式即时更改 QMesh 顶点(几何)吗? “setSource()”似乎并不适用于所有场合。

最佳答案

Qt3DCore::QEntity * meshEntity = new Qt3DCore::QEntity( rootEntity ); 
Qt3DRender::QMesh * mesh = new Qt3DRender::QMesh(); 

QUrl url; 
url.setScheme("file"); 
url.setPath("/tmp/trefoil.obj");
mesh->setSource( url ); 

// now i print some of properties. 
qDebug() << mesh->geometry() << ", children nodes=" << mesh->childrenNodes().count(); 
// ... children... primitiveCount... and so on. I see only empty values.

关于c++ - 如何获取和操作 QMesh 的顶点、面等等?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38684414/

相关文章:

c++ - <=(或>=)运算符的日期和重载

c++ - QFuture 无法为处于不同线程中的父对象创建子对象

c++ - 使用 Qt3D 2.0 的广告牌

c++ - Qt3D 围绕网格旋转相机

c++ - OpenCV 的 Brute Force Matcher 在第二次迭代时崩溃

c++ - 从字符串文字中推导模板参数

c++ - Qt double spin box 在处理值改变时自动填充

c++ - QGLWidget 中的 makeCurrent() 在哪里使用?

c++ - 不使用 << 的带有值的 QVector 的单行实例化

c++ - 如何将 QPushButton 放入小部件中的 Qt3DWindow 中?