How do I draw a simple line in Qt3D?

后端 未结 3 877
隐瞒了意图╮
隐瞒了意图╮ 2021-02-06 09:59

I feel like this should be pretty straightforward, but for my life I can\'t figure out how to draw a basic line using Qt 3D. The only guidance I\'ve been able to find on the sub

3条回答
  •  心在旅途
    2021-02-06 10:17

    I'd suggest looking at https://doc-snapshots.qt.io/qt5-5.9/qt3d-basicshapes-cpp-example.html , as a while ago I asked myself a similar question, namely, how to draw a circle. Well, a circle in 3D is a torus with a special proportion of its radii:

    // thin Torus = Circle in 3D
    Qt3DCore::QEntity *torusEntity0 = new Qt3DCore::QEntity(rootEntity);
    Qt3DExtras::QTorusMesh *torusMesh0 = new Qt3DExtras::QTorusMesh;
    torusMesh0->setRadius(15);
    torusMesh0->setMinorRadius(0.01f);
    torusMesh0->setRings(100);
    torusMesh0->setSlices(20);
    torusEntity0->addComponent(torusMesh0);
    torusEntity0->addComponent(material);
    

    So what would be a line in 3D? It would be a cylinder with a very small outer radius.

提交回复
热议问题