[Interest] How to load 3D scene with QSceneLoader

Andy asmaloney at gmail.com
Thu Sep 13 19:35:21 CEST 2018


I've never used QSceneLoader, but don't you have to check for a status of
Qt3DRender::QSceneLoader::Ready and then use QSceneLoader::entity() to
access the entity that was read in?

Maybe take a look at tests/manual/assimp-cpp for inspiration?

---
Andy Maloney  //  https://asmaloney.com
twitter ~ @asmaloney <https://twitter.com/asmaloney>



On Thu, Sep 13, 2018 at 1:25 PM Botond D <dns.botond at gmail.com> wrote:

> Hi,
>
> I've been struggling to load a 3D scene from a Collada (DAE) file. I've
> been experimenting with the following piece of code:
>
> Qt3DCore::QEntity *importScene()
> {
>     // Root entity
>     Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity;
>
>     auto importedScene = new Qt3DCore::QEntity(rootEntity);
>     auto loader = new Qt3DRender::QSceneLoader;
>     loader->setSource(QUrl("/home/botond/Desktop/castle_on_hill.dae"));
>     QObject::connect(loader, &Qt3DRender::QSceneLoader::statusChanged, []
> (Qt3DRender::QSceneLoader::Status s) {
>         std::cout << "status: " << s << std::endl;
>     });
>
>     Qt3DCore::QTransform *transform = new Qt3DCore::QTransform;
>     transform->setScale3D(QVector3D(1.5, 1, 0.5));
>
>     importedScene->addComponent(loader);
>     importedScene->addComponent(transform);
>
>     return rootEntity;
> }
>
> However nothing is rendered and no status change is detected. What am I
> doing wrong? What is the intended usage of `QSceneLoader`?
>
> Thanks,
> Botond
> _______________________________________________
> 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/20180913/805f58a8/attachment.html>


More information about the Interest mailing list