[Interest] [QT3D] access geometry data of a loaded model
Oleg Evseev
ev.mipt at gmail.com
Tue Jul 11 11:48:04 CEST 2017
Hi,
Take a look on qt3d\tests\manual\assimp example, from there you will
understand how to find specific entities or components of scene loader tree.
---
With regards, Oleg
2017-07-11 12:32 GMT+03:00 <doe at john-online.info>:
>
>
> Hi
>
> I use QT5.8 C++ API.
> I know how to create and display models with vertex and index buffers.
> How can I access data of a model loaded with Sceneloader() ?
> I.e. I load an arbitrary model and afterwards want to read out the
> vertices, indices, materials etc. in order to
> process this information.
>
> Issue:
> When I create my own models via my own buffers I have a hierarchy of
> entities & components which shows my creations (material/color,
> transformation, vertices, indices, textures)
>
> Howevr, when I load an object like .obj or .ply, I always only see the url
> referrer to the source.
> There is no entity tree other than the single child with the url apart
> from a trivial root node.
> Is this intended or a bug? Can this be related to the OS/VM? (hardly
> imaginable though)
>
>
> => How can I access the actual object data?
>
>
>
> Codewise i do the following:
>
> m_meshEntity = new Qt3DCore::QEntity();
> m_rootEntity = new Qt3DCore::QEntity();
>
> Qt3DRender::QSceneLoader *loader = new
> Qt3DRender::QSceneLoader(m_meshEntity);
>
> QString fileName = "../3dModels/someModel.obj";
> QUrl url = QUrl::fromLocalFile(fileName);
>
> QObject::connect(loader, &Qt3DRender::QSceneLoader::sta
> tusChanged,
> this, [](Qt3DRender::QSceneLoader::Status
> s){ qDebug() << s; return false;});
>
>
> loader->setSource(url);
>
> m_meshEntity->addComponent(loader);
>
> m_meshEntity->setParent(m_rootEntity);
> view->setRootEntity(m_rootEntity);
> view->show();
>
> Then, m_meshEntity/m_rootEntity are trivial as described above. Its
> visible in the 3d window (view) but trivial from the "programmatical"
> content.
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170711/9d5baa3a/attachment.html>
More information about the Interest
mailing list