mesh 网络
m_torus = new Qt3DExtras::QTorusMesh();
//设置外环半径
m_torus->setRadius(1.0f);
//设置内环半径
m_torus->setMinorRadius(0.4f);
//TODO
m_torus->setRings(100);
//TODO设置面片
m_torus->setSlices(20);
变换矩阵
Qt3DCore::QTransform *torusTransform = new Qt3DCore::QTransform();
torusTransform->setScale(2.0f);
torusTransform->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(0.0f, 1.0f, 0.0f), 25.0f));
torusTransform->setTranslation(QVector3D(5.0f, 4.0f, 0.0f));
材质光照颜色
Qt3DExtras::QPhongMaterial *torusMaterial = new Qt3DExtras::QPhongMaterial();
torusMaterial->setDiffuse(QColor(QRgb(0xbeb32b)));
添加到实体树中
m_torusEntity = new Qt3DCore::QEntity(m_rootEntity);
m_torusEntity->addComponent(m_torus);
m_torusEntity->addComponent(torusMaterial);
m_torusEntity->addComponent(torusTransform);
Qt 3D: Basic Shapes C++ Example