2016-04-06 10 views
1

Iは          0.5、              0、
-0.5、            0、      0、QTのQTorusMeshのようなMeshオブジェクトにQMatrix4x4を適用するには?

0.866ようなオブジェクトのための4×4変換行列を有します、          0.866、    0、
0、                  -1、          0、                    0、
0、         この構成に4x4の行列を適用する方法          0、(Qt Transform matrix

よう          0、                 

またはMatrix:

Qt3D::QScaleTransform *torusScale = new Qt3D::QScaleTransform(); 
Qt3D::QTranslateTransform *torusTranslation = new Qt3D::QTranslateTransform(); 
Qt3D::QRotateTransform *torusRotation = new Qt3D::QRotateTransform(); 
Qt3D::QTransform *torusTransforms = new Qt3D::QTransform(); 

torusScale->setScale3D(QVector3D(2.0f, 2.0f, 2.0f)); 
torusTranslation->setTranslation(QVector3D(1.7f, 1.7f, 0.0f)); 
torusRotation->setAngleDeg(25.0f); 
torusRotation->setAxis(QVector3D(0, 1, 0)); 

torusTransforms->addTransform(torusRotation); 
torusTransforms->addTransform(torusTranslation); 
torusTransforms->addTransform(torusScale); 

答えて

0
あなたは、 Qt3DCore::QEntityを作成するコンポーネントとしてご QTorusMeshを追加してもQEntityのコンポーネントとしてご torusTransformsQt3DCore::QTransform)を追加する必要があり

torusEntity = new Qt3DCore::QEntity(root_entity); 
torusEntity->addComponent(torusMesh); 
torusEntity->addComponent(torusMaterial); 
torusEntity->addComponent(torusTransforms); 

QMatrix4x4について、あなたはQt3DCoreをインスタンス化することができます:: QTransformとQMatrix4x4を受けsetMatrixスロット、呼び出すことによって、その内部行列を設定::Qtのドキュメントから実行しているたとえば

torusTransforms->setMatrix(my_matrix); 

を見て、より具体的には、シーン変更子の実装である。

+0

Qt3D(qt5)にはsetMatrixメソッドがありません – Evgy

+0

(Qt3D :: QTransform)インスタンスにはsetMatrixメソッドはありません。 | C:\ Qt \ Qt5.5.1 \ Examples \ Qt-5.5 \ qt3d \ basicshapes-cpp \ scenemodifier.cpp:87:ошибка: 'class Qt3D :: QTransform'には 'setMatrix'という名前のメンバーはありません torusTransforms-> setMatrix (qmat); – Evgy

関連する問題