Unsolved Loading Custom mesh QT 3D
-
Hello,
I'm trying to load a custom mesh with an OBJ file that i have in my computer. I used the example project from QT 3d Basic shapes c++ and tried to replace the sphere by a custom mesh, the problem is that the selected mesh doesn't load.
Where is what i have:
QUrl url; url.setPath("/home/jvrs/ProjetosQT/3dviewer/Triss_h20.obj"); Qt3DRender::QMesh *m_mesh = new Qt3DRender::QMesh(); m_mesh->setSource(url); // Sphere shape data // Qt3DExtras::QSphereMesh *sphereMesh = new Qt3DExtras::QSphereMesh(); // sphereMesh->setRings(20); // sphereMesh->setSlices(20); // sphereMesh->setRadius(2); // Sphere mesh transform Qt3DCore::QTransform *sphereTransform = new Qt3DCore::QTransform(); sphereTransform->setScale(1.1f); sphereTransform->setTranslation(QVector3D(-0.0f, -0.0f, 0.0f)); Qt3DExtras::QPhongMaterial *sphereMaterial = new Qt3DExtras::QPhongMaterial(); sphereMaterial->setDiffuse(QColor(QRgb(0xa69929))); // Sphere m_sphereEntity = new Qt3DCore::QEntity(m_rootEntity); m_sphereEntity->addComponent(m_mesh); m_sphereEntity->addComponent(sphereMaterial); m_sphereEntity->addComponent(sphereTransform);
Here the file i want to load is located at /home/jvrs/ProjetosQT/3dviewer/Triss_h20.obj, which is not the same path where the application is.
Best Regards,
Joaquim