[Interest] [QT3D] access geometry data of a loaded model

doe at john-online.info doe at john-online.info
Thu Jul 13 13:06:39 CEST 2017


Thanks Oleg,

that gives me a good hint.
In fact, even better is the example in

qt3d\tests\manual\assimp-cpp

Which exactly does what I need:
It creates the entity tree with material, GeometryRenderer etc.
from a interactively loaded model with sceneloader and lists the  
entity tree recursively.

This as an example in the docu would have helped a lot.

All the best, JD


Oleg Evseev

> 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
>>






More information about the Interest mailing list