Qt 6.11 is out! See what's new in the release
blog
Qt3D to load scenes
-
Hi,
I'm trying to use Qt3D to load some scene files that I need to work with, but I'm not sure how to do this.
I dont need graphics support, I just need to load the scenes and modify some data for some other purposes. I have tried to create a simple Qt3D scene which contains a QSceneLoader object. I've also created an engine and Input and Render aspects but nothing happens.
Here is some code:
FracturablePart *JesusIOFile::fromFile(const QString &filename) { if (filename.endsWith(".obj")) { Qt3DCore::QAspectEngine *engine = new Qt3DCore::QAspectEngine; Qt3DInput::QInputAspect *inputAspect = new Qt3DInput::QInputAspect; Qt3DRender::QRenderAspect *renderAspect = new Qt3DRender::QRenderAspect; engine->registerAspect(inputAspect); engine->registerAspect(renderAspect); Qt3DRender::QSceneLoader *loader = new Qt3DRender::QSceneLoader; loader->setSource(filename); Qt3DCore::QEntity *loaderEntity = new Qt3DCore::QEntity; loaderEntity->addComponent(loader); engine->setRootEntity(Qt3DCore::QEntityPtr(loaderEntity)); connect(loader, &Qt3DRender::QSceneLoader::statusChanged, this, &JesusIOFile::onSceneLoaderStatusChanged); engine->startTimer(0, Qt::TimerType::CoarseTimer); } return nullptr; } void JesusIOFile::onSceneLoaderStatusChanged(Qt3DRender::QSceneLoader::Status status) { std::cout << "Status :" << status << std::endl; }Any ideas if this is even possible in Qt3D?
-
I just need the geometry data in the scene, meshes, vertex and triangles, no visualization. What I want to do is not even important for the question...
Anyway, I have tried to use a Qt3DWindow to get the normal behavior and the QSceneLoader is giving an error and I don't know why...