Qt3d Using QSceneLoader with qt 5.8

前端 未结 1 871
感动是毒
感动是毒 2021-01-14 10:09

I unsuccessfully try to use QSceneLoader to load a 3d scene created in an external editor. And always I get assertions at loading stage. I use the example of OBJ model qt, w

相关标签:
1条回答
  • 2021-01-14 10:28

    I use http://code.qt.io/cgit/qt/qt3d.git/tree/tests/manual/assimp-cpp to load my own Collada robot model which works without errors. The important lines are:

    // Root entity
    Qt3DCore::QEntity *sceneRoot = new Qt3DCore::QEntity();
    ...
    // Scene loader
    Qt3DCore::QEntity *sceneLoaderEntity = new Qt3DCore::QEntity(sceneRoot);
    Qt3DRender::QSceneLoader *sceneLoader = new Qt3DRender::QSceneLoader(sceneLoaderEntity);
    SceneWalker sceneWalker(sceneLoader);
    QObject::connect(sceneLoader, &Qt3DRender::QSceneLoader::statusChanged, &sceneWalker, &SceneWalker::onStatusChanged);
    sceneLoaderEntity->addComponent(sceneLoader);
    

    So try it out with your obj file.

    0 讨论(0)
提交回复
热议问题