[Interest] [QT3D] access geometry data of a loaded model
doe at john-online.info
doe at john-online.info
Tue Jul 11 11:32:18 CEST 2017
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::statusChanged,
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.
More information about the Interest
mailing list